title: Best way to implement an xpath-like configuration system
body: <p>I'm trying to come up with the best way to handle configuration in an application. At first i just used SimpleXML and put the code in a singleton. </p>
  
  <p>I've decided to try to create a way to query the configuration with something like <code>$config-&gt;getConfig('/module/name');</code></p>
  
  <p>Do you have to use xpath to do this or is there any other method that is faster/easier to use? I know Magento uses this scheme but with a custom xpath-like syntax.</p>
  
  <p>Feel free to suggest different schemes as long as it is based on XML.</p>
  
  <p>SimpleXML is a nice approach however i feel the need to wrap something around it as the return values are almost always objects where I want a string value.</p>
  
  <p>Could someone explain how to wrap the xpath call to return a string value if the query returns a value, or an object if the query has multiple children?</p>
  
  <pre><code>        $xml = $this-&gt;xml-&gt;xpath($path);
  </code></pre>
  
  <p>How do you detect if the node returned is a leaf node?</p>