@@ -20,8 +20,8 @@ pub fn compile_xml(xml: &str, table: &Table) -> Result<Chunk> {
20
20
chunks. push ( Chunk :: XmlStartNamespace (
21
21
ResXmlNodeHeader :: default ( ) ,
22
22
ResXmlNamespace {
23
- prefix : ns. name ( ) . map ( |ns| strings. id ( ns) ) . unwrap_or ( -1 ) ,
24
- uri : strings. id ( ns. uri ( ) ) ,
23
+ prefix : ns. name ( ) . map ( |ns| strings. id ( ns) . unwrap_or ( - 1 ) ) . unwrap_or ( -1 ) ,
24
+ uri : strings. id ( ns. uri ( ) ) ? ,
25
25
} ,
26
26
) ) ;
27
27
}
@@ -30,8 +30,8 @@ pub fn compile_xml(xml: &str, table: &Table) -> Result<Chunk> {
30
30
chunks. push ( Chunk :: XmlEndNamespace (
31
31
ResXmlNodeHeader :: default ( ) ,
32
32
ResXmlNamespace {
33
- prefix : ns. name ( ) . map ( |ns| strings. id ( ns) ) . unwrap_or ( -1 ) ,
34
- uri : strings. id ( ns. uri ( ) ) ,
33
+ prefix : ns. name ( ) . map ( |ns| strings. id ( ns) . unwrap_or ( - 1 ) ) . unwrap_or ( -1 ) ,
34
+ uri : strings. id ( ns. uri ( ) ) ? ,
35
35
} ,
36
36
) ) ;
37
37
}
@@ -107,7 +107,7 @@ fn compile_node(
107
107
size : 8 ,
108
108
res0 : 0 ,
109
109
data_type : ResValueType :: String as u8 ,
110
- data : strings. id ( attr. value ( ) ) as u32 ,
110
+ data : strings. id ( attr. value ( ) ) ? as u32 ,
111
111
}
112
112
} ;
113
113
let raw_value = if value. data_type == ResValueType :: String as u8 {
@@ -116,8 +116,8 @@ fn compile_node(
116
116
-1
117
117
} ;
118
118
let attr = ResXmlAttribute {
119
- namespace : attr. namespace ( ) . map ( |ns| strings. id ( ns) ) . unwrap_or ( -1 ) ,
120
- name : strings. id ( attr. name ( ) ) ,
119
+ namespace : attr. namespace ( ) . map ( |ns| strings. id ( ns) . unwrap_or ( - 1 ) ) . unwrap_or ( -1 ) ,
120
+ name : strings. id ( attr. name ( ) ) ? ,
121
121
raw_value,
122
122
typed_value : value,
123
123
} ;
@@ -126,9 +126,9 @@ fn compile_node(
126
126
let namespace = node
127
127
. tag_name ( )
128
128
. namespace ( )
129
- . map ( |ns| strings. id ( ns) )
129
+ . map ( |ns| strings. id ( ns) . unwrap_or ( - 1 ) )
130
130
. unwrap_or ( -1 ) ;
131
- let name = strings. id ( node. tag_name ( ) . name ( ) ) ;
131
+ let name = strings. id ( node. tag_name ( ) . name ( ) ) ? ;
132
132
chunks. push ( Chunk :: XmlStartElement (
133
133
ResXmlNodeHeader :: default ( ) ,
134
134
ResXmlStartElement {
@@ -145,7 +145,7 @@ fn compile_node(
145
145
) ) ;
146
146
/*let mut children = BTreeMap::new();
147
147
for node in node.children() {
148
- children.insert(strings.id(node.tag_name().name()), node);
148
+ children.insert(strings.id(node.tag_name().name())? , node);
149
149
}
150
150
for (_, node) in children {
151
151
compile_node(node, strings, chunks)?;
0 commit comments