@@ -20,8 +20,8 @@ pub fn compile_xml(xml: &str, table: &Table) -> Result<Chunk> {
2020 chunks. push ( Chunk :: XmlStartNamespace (
2121 ResXmlNodeHeader :: default ( ) ,
2222 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 ( ) ) ? ,
2525 } ,
2626 ) ) ;
2727 }
@@ -30,8 +30,8 @@ pub fn compile_xml(xml: &str, table: &Table) -> Result<Chunk> {
3030 chunks. push ( Chunk :: XmlEndNamespace (
3131 ResXmlNodeHeader :: default ( ) ,
3232 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 ( ) ) ? ,
3535 } ,
3636 ) ) ;
3737 }
@@ -107,7 +107,7 @@ fn compile_node(
107107 size : 8 ,
108108 res0 : 0 ,
109109 data_type : ResValueType :: String as u8 ,
110- data : strings. id ( attr. value ( ) ) as u32 ,
110+ data : strings. id ( attr. value ( ) ) ? as u32 ,
111111 }
112112 } ;
113113 let raw_value = if value. data_type == ResValueType :: String as u8 {
@@ -116,8 +116,8 @@ fn compile_node(
116116 -1
117117 } ;
118118 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 ( ) ) ? ,
121121 raw_value,
122122 typed_value : value,
123123 } ;
@@ -126,9 +126,9 @@ fn compile_node(
126126 let namespace = node
127127 . tag_name ( )
128128 . namespace ( )
129- . map ( |ns| strings. id ( ns) )
129+ . map ( |ns| strings. id ( ns) . unwrap_or ( - 1 ) )
130130 . unwrap_or ( -1 ) ;
131- let name = strings. id ( node. tag_name ( ) . name ( ) ) ;
131+ let name = strings. id ( node. tag_name ( ) . name ( ) ) ? ;
132132 chunks. push ( Chunk :: XmlStartElement (
133133 ResXmlNodeHeader :: default ( ) ,
134134 ResXmlStartElement {
@@ -145,7 +145,7 @@ fn compile_node(
145145 ) ) ;
146146 /*let mut children = BTreeMap::new();
147147 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);
149149 }
150150 for (_, node) in children {
151151 compile_node(node, strings, chunks)?;
0 commit comments