While working with xpath (which was not very long), I came across something strange.
Shortened version of xml (full xml here and snapshot available on pastebin ):
<?xml version="1.0" encoding="utf-8" ?> <body copyright="All data copyright San Francisco Muni 2013."> <route tag="all"> <message id="10268" creator="jflynn" startBoundary="1378121400000" startBoundaryStr="Mon, Sep 02 04:30:00 PDT 2013" endBoundary="1378191540000" endBoundaryStr="Mon, Sep 02 23:59:00 PDT 2013" sendToBuses="false"> <text>Sunday schedules today.</text> </message> </route> <route tag="44"> <message id="10221" creator="mlee" startBoundary="1377525600000" startBoundaryStr="Mon, Aug 26 07:00:00 PDT 2013" endBoundary="1382857140000" endBoundaryStr="Sat, Oct 26 23:59:00 PDT 2013" sendToBuses="false"> <routeConfiguredForMessage tag="44"> <stop tag="6420" title="Silver Ave & Revere Ave" /> </routeConfiguredForMessage> <text>Stop moved across Revere During Construction</text> </message> <message id="10222" creator="mlee" startBoundary="1377525600000" startBoundaryStr="Mon, Aug 26 07:00:00 PDT 2013" endBoundary="1382857140000" endBoundaryStr="Sat, Oct 26 23:59:00 PDT 2013" sendToBuses="false"> <routeConfiguredForMessage tag="44"> <stop tag="6420" title="Silver Ave & Revere Ave" /> </routeConfiguredForMessage> <text>Stop moved across Revere During Construction</text> </message> </route> </body>
Expression
returned the first route node as I expected. However, when trying to select the first message node with
several message nodes were returned, not just one.
At first I suggested that this is a platform problem, but testing on Android, Desktop Java and a couple of online xpath testers I get the same results.
What could be the problem?
source share