xsl-list
[Top] [All Lists]

[xsl] XPATH Issue

2010-11-30 20:20:03
Hi

I have a very strange problem and I have spend a whole day trying to figure 
what 
is wrong. 


I  have a XPATH expression, and if I evaluate from a XML File on disk it  
works. 
If I evaluate from a DOM Object from a HTTP Source, it doesn't  work. Both the 
documents are exactly same. 


XML Document 
SUCCESS </RetrieveResult></RetrieveResponse></s:Body></s:Envelope>


// Document from File

                // Parse the XML as a W3C document.
                DocumentBuilder builder =
                    DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document document = builder.parse(new 
File("C:\\Users\\smirxj0\\Documents\\Java\\GPN.xml"));
      

// Alternatively Document  from HTTP 
              
              InputStream isr = httpConn.getInputStream();
              Document document = builder.parse(isr);

// If I print this Document, I have the same output as the XML file


// XPATH Expression

                XPath xpath = XPathFactory.newInstance().newXPath();
                expression = "//RetrieveResponse/RetrieveResult/StatusType";
                String statusString = (String)
                    xpath.evaluate(expression, document, 
XPathConstants.STRING);       

                System.out.println("String is: " + statusString);

Please let me know where am I going wrong?

Is it a XPATH issue?

Rajesh


      

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] XPATH Issue, Rajesh Jain <=