Folks,

          I tried out seeing if I could use XPATH inside Xalan to retrieve
the zipcode out of this xml file soap.xml just from using the
SimpleXPathAPI executable.

           I am not an Xpath expert yet but I couldn't find any way to get
to the zipcode that didn't either produce no result, an exception, or a
message about 'no such context node exists'.   It especially seemed to
absolutely hate the node that starts with 'm:getTemp' . Any time I tried to
reference that node it either gave me an exception or claimed that node did
not exist. I'm baffled, because it looks to me like it SHOULD exist.   And
I know this xml file should be good xml because you can run it in a java
program that executes SOAP and it works.

           Does anybody know why Xalan would not understand any nodes in
this file below <SOAP-ENV:Body>  ??



<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
   <SOAP-ENV:Body>
      <m:getTemp xmlns:m="urn:xmethods-Temperature"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
        <zipcode xsi:type="xsd:string">94041</zipcode>
      </m:getTemp>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

          Some of the commands I tried with SimpleXPathAPI and their
results looked like these:

        :\buildarea\xml-xalan\c\samples\SimpleXPathAPI>simplexpathapi
soap.xml    /SOAP-ENV:Envelope/SOAP-ENV:Body  zipcode
       The string value of the result is:

        (no result)

  -->      :\buildarea\xml-xalan\c\samples\SimpleXPathAPI>simplexpathapi
soap.xml    /SOAP-ENV:Envelope/SOAP-ENV:Body/m:getTemp  zipcode
       Exception caught!

     This one above is the one I thought should seriously work!!


         :\buildarea\xml-xalan\c\samples\SimpleXPathAPI>simplexpathapi
soap.xml    /SOAP-ENV:Envelope/SOAP-ENV:Body     m:getTemp/child::zipcode
      Exception caught!


          \buildarea\xml-xalan\c\samples\SimpleXPathAPI>simplexpathapi
soap.xml    /SOAP-ENV:Envelope/SOAP-ENV:Body  ../m:getTemp/chid::zipcode
     Exception caught!

       \buildarea\xml-xalan\c\samples\SimpleXPathAPI>simplexpathapi
soap.xml    /zipcode zipcode
Warning -- No nodes matched the location path "/zipcode".
Execution cannot continue...


         Basically, I'm getting the feeling here you have to specify the
whole path in the context node all the way down to the parent of zipcode
here or it won't work...apparently it looks only 1 level deep for 'nodes'.
But what on earth its problem is with m:getTemp, I have no idea. Apparently
it doesn't consider that a real node. Does anybody know why?

Thanks,
Suzanne


Reply via email to