Browse Source

Working XML stream parser.

Steve Thielemann 6 months ago
parent
commit
63d6d72fd6
1 changed files with 4 additions and 1 deletions
  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 {
     for e in parser {
         match e {
         match e {
-            Ok(XmlEvent::StartElement { name, .. }) => {
+            Ok(XmlEvent::StartElement { name, attributes, .. }) => {
                 element_name = name.local_name.clone();
                 element_name = name.local_name.clone();
                 if element_name == "graph" {
                 if element_name == "graph" {
                     // Check the attributes here
                     // Check the attributes here
                     // <graph specific-type="Plain" type="sudoku" order="9"/>
                     // <graph specific-type="Plain" type="sudoku" order="9"/>
                     // Verify these are correct / not some other puzzle type!
                     // Verify these are correct / not some other puzzle type!
+
                 }
                 }
             }
             }
             Ok(XmlEvent::Characters(text)) => {
             Ok(XmlEvent::Characters(text)) => {
@@ -79,6 +80,8 @@ pub fn save_ksudoku(
     event = WrXmlEvent::end_element().into();
     event = WrXmlEvent::end_element().into();
     writer.write(event)?;
     writer.write(event)?;
 
 
+    // Apparently, the events are consumed...
+    
     event = WrXmlEvent::end_element().into();
     event = WrXmlEvent::end_element().into();
     writer.write(event)?;
     writer.write(event)?;
     event = WrXmlEvent::end_element().into();
     event = WrXmlEvent::end_element().into();