Explorar o código

Working XML stream parser.

Steve Thielemann hai 6 meses
pai
achega
63d6d72fd6
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      sudoku/src/ksudoku.rs

+ 4 - 1
sudoku/src/ksudoku.rs

@@ -17,12 +17,13 @@ pub fn load_ksudoku(filename: std::path::PathBuf) -> Result<String, Box<dyn Erro
 
     for e in parser {
         match e {
-            Ok(XmlEvent::StartElement { name, .. }) => {
+            Ok(XmlEvent::StartElement { name, attributes, .. }) => {
                 element_name = name.local_name.clone();
                 if element_name == "graph" {
                     // Check the attributes here
                     // <graph specific-type="Plain" type="sudoku" order="9"/>
                     // Verify these are correct / not some other puzzle type!
+
                 }
             }
             Ok(XmlEvent::Characters(text)) => {
@@ -79,6 +80,8 @@ pub fn save_ksudoku(
     event = WrXmlEvent::end_element().into();
     writer.write(event)?;
 
+    // Apparently, the events are consumed...
+    
     event = WrXmlEvent::end_element().into();
     writer.write(event)?;
     event = WrXmlEvent::end_element().into();