Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-333

XPath queries using the "child" and "descendant" axes return the same results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • Version 2.1
    • None
    • XPath
    • None
    • WIndows XP, Java

    Description

      The following 2 queries Strings return the same set of elements when used in XmlObject's and XmlCursor's selectPath(String path) method.

      "declare namespace ns1='http://www.gamingstandards.com/s2s/schemas/v1.2.6/' .//s2s:s2sBody/child::*"

      "declare namespace ns1='http://www.gamingstandards.com/s2s/schemas/v1.2.6/' .//s2s:s2sBody/descendant::*"

      The document the being queried has the form:

      <s2s:s2sMessage xmlns:s2s="http://www.gamingstandards.com/s2s/schemas/v1.2.6/">
      <s2s:s2sHeader s2s:messageId="1181262999443" s2s:fromSystem="FromSystem" s2s:toSystem="ToSystem" s2s:dateTimeSent="2007-06-07T18:36:39.474-06:00"/>
      <s2s:s2sBody>
      <s2s:communications s2s:commandId="1181262999568" s2s:dateTime="2007-06-07T18:36:39.568-06:00" s2s:propertyId="1">
      <s2s:commsOnLine s2s:s2sLocation="Here" s2s:s2sVersion="v1.0"/>
      </s2s:communications>
      </s2s:s2sBody>
      </s2s:s2sMessage>

      Both queries return:

      <xml-fragment v1:commandId="1181263236694" v1:dateTime="2007-06-07T18:40:36.694-06:00" v1:propertyId="1" xmlns:v1="http://www.gamingstandards.com/s2s/schemas/v1.2.6/">
      <v1:commsOnLine v1:s2sLocation="Here" v1:s2sVersion="v1.0"/>
      </xml-fragment>
      <xml-fragment v1:s2sLocation="Here" v1:s2sVersion="v1.0" xmlns:v1="http://www.gamingstandards.com/s2s/schemas/v1.2.6/"/>

      Which I believe is the correct result for the query that uses "descendants" that is all descendants (children, grandchildren, etc.) of the Body element are returned.

      But my understanding is that the query using "child" should only return the immediate child of Body that is:

      <xml-fragment v1:commandId="1181263236694" v1:dateTime="2007-06-07T18:40:36.694-06:00" v1:propertyId="1" xmlns:v1="http://www.gamingstandards.com/s2s/schemas/v1.2.6/">
      <v1:commsOnLine v1:s2sLocation="Here" v1:s2sVersion="v1.0"/>
      </xml-fragment>

      Attachments

        Activity

          People

            Unassigned Unassigned
            jconti13 Joseph Conti
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: