Announcement Announcement Module
Collapse
No announcement yet.
XPathOperations - [#document: null] issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XPathOperations - [#document: null] issue

    Hi!

    I use XPathOperations on a Source with this code:

    Code:
    xpathOperator.evaluateAsObject("ns1:Capabs/pls:ServiceId",src, new NodeMapper() {
    		    public Object mapNode(Node node, int i) throws DOMException {
    		        Element servIdent = (Element) node;
    		        String type = new String();
    		        try {
    		        System.err.println(servIdent.toString());
    		        type = servIdent.getElementsByTagNameNS("pls","ServiceType").item(0).getNodeValue();
    		        System.err.println("t1");
    		        } catch (DOMException de) {
    		        	System.err.println("t2");
    		        	de.printStackTrace();
    		        }
    		        String version = servIdent.getElementsByTagNameNS("pls","ServiceTypeVersion").item(0).getNodeValue();
    		        String title = servIdent.getElementsByTagNameNS("pls","Title").item(0).getNodeValue();
    		        
    		        return new Capabilities(type, version, title);
    		    }
    		});
    This code
    Code:
    System.err.println(servIdent.toString());
    prints into the output
    Code:
    [pls:ServiceId : null]
    and I get a NullPointerException on the line
    Code:
    type = servIdent.getElementsByTagNameNS("pls","ServiceType").item(0).getNodeValue();
    I've traced the problem inside JDK classes, where XPathImpl which is being used dwells. Apparently, Document is loaded with null siblings.

    Does anyone have any idea?
Working...
X