Hi,

I've found a problem with saxon when trying to perform a complex xpath (ie. use a function like count) against an XmlBeans XmlObject. In the first example the xpath works fine, but in the second example the xpath fails. When I dump out the XmlObject I see that the failed xpath is working on an xml structure with the following outputted - '*:R:<cur>[0]'. I'm presuming it means that this is the root of the xml document, but even so I cannot see why the xpath would fail. All non-complex xpaths work fine in both examples.

Any input gratefully accepted, otherwise looks like I'll have to raise a bug.

Using: XmlBeans: v2.4.0 Saxon: 9.0.0.4 (recommended to be used together)

1 ----------------------------------------------------------------------------------------------------------------------------------------

THIS WORKS…..

Xpath expression: count($this/s:beginString)

Xml:

<xml-fragment xmlns:q="http://www.temp.com/fx/Quote" xmlns:s="http://www.temp.com/fx/Session" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <s:beginString>FIX.4.4</s:beginString>
  <s:senderCompID>DEV1</s:senderCompID>
  <s:targetCompID>ABC-MARKETS-PD</s:targetCompID>
</xml-fragment>

xmlObject.dump:

  ROOT (USER) <mark>[0] (DocumentFragXobj)
    ATTR xmlns:q@http://www.w3.org/2000/xmlns/ Value( "http://www.temp.com/fx/Quote" ) (AttrXobj)
    ATTR xmlns:s@http://www.w3.org/2000/xmlns/ Value( "http://www.temp.com/fx/Session" ) (AttrXobj)
    ATTR xmlns:xsi@http://www.w3.org/2000/xmlns/ Value( "http://www.w3.org/2001/XMLSchema-ins..." ) After( "\n\t\t\t\t\t\t" ) (AttrXobj)

    ELEM s:session@http://www.temp.com/fx/Session Value( "\n\t\t\t\t\t\t\t" ) After( "\n\t\t\t\t\t" ) (ElementXobj)
      ELEM s:beginString@http://www.temp.com/fx/Session Value( "FIX.4.4" ) After( "\n\t\t\t\t\t\t\t" ) (ElementXobj)
      ELEM s:senderCompID@http://www.temp.com/fx/Session Value( "DEV1" ) After( "\n\t\t\t\t\t\t\t" ) (ElementXobj)
      ELEM s:targetCompID@http://www.temp.com/fx/Session Value( "ABC-MARKETS-PD" ) After( "\n\t\t\t\t\t\t" ) (ElementXobj)

    ELEM s:sessionStartResponse@http://www.temp.com/fx/Session (USER) (ElementXobj)
      ELEM s:session@http://www.temp.com/fx/Session (USER) *:R:<cur>[0] (ElementXobj)
        ELEM s:beginString@http://www.temp.com/fx/Session Value( "FIX.4.4" ) (ElementXobj)
        ELEM s:senderCompID@http://www.temp.com/fx/Session Value( "DEV1" ) (ElementXobj)
        ELEM s:targetCompID@http://www.temp.com/fx/Session Value( "ABC-MARKETS-PD" ) (ElementXobj)

2 ----------------------------------------------------------------------------------------------------------------------------------------

THIS DOESN'T WORK….ONLY DIFFERENCE I CAN SEE IS THE '*:R:<cur>[0]' IN THE DUMP OF THE XML STRUCTURE.
If I execute the xpath against an element below the root of the xml document (changing the xpath accordingly) then the xpath works as expected.

Xpath expression: $this/count(s:userRequestID)

Xml:

<xml-fragment xmlns:s="http://www.temp.com/fx/Session" xmlns:q="http://www.temp.com/fx/Quote" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <s:userRequestID>4</s:userRequestID>
  <s:userRequestType>1</s:userRequestType>
  <s:username>FIX-ABC-CP2</s:username>
  <s:password>q</s:password>
  <s:userResponse>
    <s:userRequestID>4</s:userRequestID>
    <s:username>FIX-ABC-CP2</s:username>
    <s:userStatus>2</s:userStatus>
    <s:userStatusText>Account locked.</s:userStatusText>
  </s:userResponse>
</xml-fragment>

xmlObject.dump():

  ROOT (USER) *:R:<cur>[0] <mark>[0] (DocumentFragXobj)
    ATTR xmlns:s@http://www.w3.org/2000/xmlns/ Value( "http://www.temp.com/fx/Session" ) (AttrXobj)
    ATTR xmlns:q@http://www.w3.org/2000/xmlns/ Value( "http://www.temp.com/fx/Quote" ) (AttrXobj)
    ATTR xmlns:xsi@http://www.w3.org/2000/xmlns/ Value( "http://www.w3.org/2001/XMLSchema-ins..." ) After( "\n\t\t\t\t\t\t\t" ) (AttrXobj)

    ELEM s:userRequestID@http://www.temp.com/fx/Session Value( "4" ) (ElementXobj)
    ELEM s:userRequestType@http://www.temp.com/fx/Session Value( "1" ) After( "\n\t\t\t\t\t\t\t" ) (ElementXobj)
    ELEM s:username@http://www.temp.com/fx/Session Value( "FIX-ABC-CP2" ) After( "\n\t\t\t\t\t\t\t" ) (ElementXobj)
    ELEM s:password@http://www.temp.com/fx/Session Value( "q" ) After( "\n\t\t\t\t\t\t" ) (ElementXobj)
    ELEM s:userResponse@http://www.temp.com/fx/Session (ElementXobj)
      ELEM s:userRequestID@http://www.temp.com/fx/Session Value( "4" ) (ElementXobj)
      ELEM s:username@http://www.temp.com/fx/Session Value( "FIX-ABC-CP2" ) (ElementXobj)
      ELEM s:userStatus@http://www.temp.com/fx/Session Value( "1" ) (ElementXobj)
      ELEM s:userStatusText@http://www.temp.com/fx/Session Value( "Login successful." ) (ElementXobj)



Paul Seddon | Analyst/Developer | Pricing & Distribution | Markets | ANZ
paul.seddon@anz.com | +61 3 9273 2513 | 11th Floor (Podium), 530 Collins Street, Melbourne VIC 3000

 

 

"This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential,  may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ National Bank Limited (together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication."