[xml] Problem with white space characters in attributes?



Hey there!

I got this XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<root id="123">
  <section label="Contract">
    ...    
  </section>
  <section label="Machine 123 AB-22-MK">
    <block label="Technical Data">
      <item label="SID">
        <value>This one.</value>
      </item>
  </section>
  <section label="Machine 32 XY-45-WE:3434">
    <block label="Technical Data">
      <item label="SID">
        <value>Not this one.</value>
      </item>
  </section> 
  <section label="Further stuff">
    ...    
  </section>   
</root>

Now i'd like to get the value of SID from Machine 123 AB-22-MK ("This one."). On PHP I used the following 
XPath expression:

$elements = $xpath->query("//section[ label='Machine 123 AB-22-MK']/*/item[ label='SID']/value");

Works fine on my local machine with libxml 2.7.2, however I get no result on my remote server running libxml 
2.6.27. Is there a workaround or could I improve my expression? Yet I did not fully figure out what's wrong. 
Seems like the old libxml gets confused by the spaces in the attributes value or because there are several 
nodes having SID-attributes!?

Can anybody help?

Thanks in advance,
Bernd
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]