Hi I have a SOAP file.... i converted into string.
i would like to search the value of a perticular node.
The soap String is: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><GetQuoteRequest xmlns="http://schemas.vanguard.com/StockQuote"><symbol xmlns="">wqw</symbol><company xmlns="">qwq</company></GetQuoteRequest></soapenv:Body></soapenv:Envelope>
the program to look for perticular node is public XPathNavigator(String xmlSource) throws TransformerException{
if ( xmlSource!=null) {
Debug.println("XPath xml=" + xmlSource);
String xpath = "/Envelope/Body/GetQuoteRequest/symbol";
InputSource inputSource = new InputSource(new ByteArrayInputStream(xmlSource.getBytes()));
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
try {
root = dfactory.newDocumentBuilder().parse(inputSource);
NodeIterator nodeIterator = XPathAPI.selectNodeIterator(root, xpath);
Node node = nodeIterator.nextNode();
System.out.println("the node u r searching is : " + node.getNodeName());
System.out.println("value of the node : " + node.getNodeValue());
}
catch (ParserConfigurationException pce) {
throw new TransformerException(pce.getMessage());
}
catch (IOException ioe) {
throw new TransformerException(ioe.getMessage());
}
catch (SAXException se){
throw new TransformerException(se.getMessage());
}
}
I am getting the node.But the value of the node am getting is null PLZ help me ....