xpath « Web Service « Java Enterprise Q&A





1. Resolving namespace using xpath    coderanch.com

2. getting the xpath from the DTD    coderanch.com

3. Help Required about XPATH    coderanch.com

4. WS-BPEL 2, XPath    coderanch.com

5. XPath with namespace    coderanch.com

private void doStuff(String xmlIn) { try { System.out.println("Input: " + xmlIn); DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = db.parse(new ByteArrayInputStream(xmlIn.getBytes())); XPath xPath = XPathFactory.newInstance().newXPath(); xPath.setNamespaceContext(new NSResolver("s", "uri:osp:wsd")); Node node = (Node)xPath.evaluate("/s:request", doc, XPathConstants.NODE); if(node != null) { System.out.println("Result: OK"); }else { System.out.println("Result: FAIL"); } } catch (Exception ex) { Logger.getLogger(MyXpathParser.class.getName()).log(Level.SEVERE, null, ex); } }