title: Confused about std.xml - how do I read attributes?
body: <p>I've just thrown together an XML control file for a command-line tool I'm writing to manage my compilers. My goal is to basically use this XML file to take a statement like <code>compile d -release foo.d</code> made at the shell, process it to form <code>dmd -m64 -O -inline -release -noboundscheck foo.d</code> and execute it. I've reproduced the XML file here for clarity:</p>
  
  <pre><code>&lt;compilers&gt;
  &lt;compiler id="d"&gt;
      &lt;command&gt;"dmd -m64"&lt;/command&gt;
      &lt;modes&gt;
          &lt;mode id="-debug"&gt;"-debug -unittest -w -de"&lt;/mode&gt;
          &lt;mode id="-release"&gt;"-O -inline -release -noboundscheck"&lt;/mode&gt;
      &lt;/modes&gt;
  &lt;/compiler&gt;
  &lt;compiler id="java"&gt;
      &lt;command&gt;"javac"&lt;/command&gt;
      &lt;modes&gt;
          &lt;mode id="-debug"&gt;"-g -Xlint"&lt;/mode&gt;
      &lt;/modes&gt;
  &lt;/compiler&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now, from my reading of <code>std.xml</code>, I have to do something like this:</p>
  
  <pre><code>import std.xml, std.stdio, std.string, std.file;
  
  void main(string[] args) {
      auto from_command_line = someFunctionThatDealsWithInput(args);
      string s = cast(string)std.file.read("path/to/xml/file.xml");
      check(s);
      auto parsed = DocumentParser(s);
      //deal with the XML somehow to construct a valid command line command
      //send it to the shell
   }
  </code></pre>
  
  <p>I know how to execute stuff at the shell, but I'm not sure how to make use of the XML document using the <code>std.xml</code> API. In particular, I'm unclear how to get at the content of a node's attributes (but to be honest, the whole thing doesn't make a lot of sense to me).</p>