Selaa lähdekoodia

Working XML stream parser.

Steve Thielemann 6 kuukautta sitten
vanhempi
commit
63d6d72fd6
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  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();