title: How to capture some values using xml-rs (if it's possible)
body: <p>I'm using <a href="https://crates.io/crates/xml-rs" rel="nofollow noreferrer">xml-rs 0.4</a> and I need to capture several fields and values:</p>
  
  <ul>
  <li>name</li>
  <li>"visible" </li>
  <li>True</li>
  </ul>
  
  <p>From this sample XML file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;interface&gt;
    &lt;requires lib="rsTest+" version="1.00"/&gt;
    &lt;object class="rsTestWindow" id="window1"&gt;
      &lt;property name="can_focus"&gt;False&lt;/property&gt;
    &lt;/object&gt;
  &lt;/interface&gt;
  </code></pre>
  
  <p>After looking at the xml-rs code in Github, I was able to capture <code>name</code> and <code>"visible"</code>:</p>
  
  <pre><code>for att in attributes {
      // test
      let temp_name_local_name = att.name.local_name.clone();
      let temp_value= att.value.clone();
  
      println!("{}+{}+{}", temp_name_local_name, temp_value);
  }
  </code></pre>
  
  <p>Stdout:</p>
  
  <pre class="lang-none prettyprint-override"><code>name+visible
  </code></pre>
  
  <p>I could not figure out how to capture <code>True</code>.</p>
  
  <p>This is my complete code:</p>
  
  <pre><code>extern crate xml;
  
  use std::fs::File;
  use std::io::BufReader;
  
  use xml::reader::{EventReader, XmlEvent};
  use xml::name::{Name, OwnedName};
  
  fn indent(size: usize) -&gt; String {
      const INDENT: &amp;'static str = "    ";
      (0..size)
          .map(|_| INDENT)
          .fold(String::with_capacity(size * INDENT.len()), |r, s| r + s)
  }
  
  fn main() {
      let file = File::open("./src/sample.xml").unwrap();
      let file = BufReader::new(file);
  
      let parser = EventReader::new(file);
      let mut depth = 0;
  
      for e in parser {
          match e {
              Ok(XmlEvent::StartElement {
                     name,
                     attributes,
                     namespace,
                 }) =&gt; {
  
                  /* //test
                      let n: xml::namespace::Namespace = namespace;
  
                      if n.is_empty() {
                          println!("empty");
                      }else{
                          println!("no empty");
                      }
                      */
  
                  let t: String = name.local_name;
                  println!("{}", t);
  
                  if name.prefix.is_some() == true {
                      println!("{}", name.prefix.clone().unwrap().clone());
                  }
                  if name.namespace.is_some() == true {
                      println!("{}", name.namespace.unwrap().clone());
                  }
  
                  if attributes.is_empty() == true {
                      //"test".to_string()
                  } else {
  
                      for att in attributes {
  
                          //let tet: xml::name::OwnedName = att.name;
                          let temp_name_local_name = att.name.local_name.clone();
                          let temp_value = att.value.clone();
  
                          println!("{}+{}", temp_name_local_name, temp_value);
  
                          /* //test
                              if att.name.namespace.is_some() == true {
                                   println!("{}", att.name.namespace.unwrap().clone());
                              }
                              if att.name.prefix.is_some() == true {
                                   println!("{}", att.name.prefix.unwrap().clone());
                              }
                              */
                      }
                  }
                  depth += 1;
              }
              Ok(XmlEvent::ProcessingInstruction { name, data }) =&gt; {
                  /* //test
                      if data.is_some() == true {
                          println!("{}", data.unwrap().clone());
                      }
                      println!("{}", name );
                      */
              }
              Ok(XmlEvent::EndElement { name }) =&gt; {
                  //println!("{}-{}", indent(depth), name);
              }
              Err(e) =&gt; {
                  //println!("Error: {}", e);
                  break;
              }
              _ =&gt; {}
          }
      }
  }
  </code></pre>
  
  <p>And my dependencies in Cargo.toml:</p>
  
  <pre><code>[dependencies]
  xml-rs = "0.4"
  </code></pre>