Creating a model directly from a factory and not a builder AXIOMXPath will always return you null. --------------------------------------------------------------------------------------------------
Key: WSCOMMONS-388 URL: https://issues.apache.org/jira/browse/WSCOMMONS-388 Project: WS-Commons Issue Type: Bug Components: AXIOM Reporter: Thorsten Scherler On Tue, Sep 23, 2008 at 4:14 PM, Thorsten Scherler < > On Tue, 2008-09-23 at 11:53 +0200, Thorsten Scherler wrote: > > I wonder - reading your other answers - whether AXIOMXPath is only > > working with OM's that a builder has generated (parsing a file) and > > not > > like I do an OMElement that I created from the factory (without > > parsing > > a file), hence builder = null. > > I did a small test where I created a file and used it instead the former > approach to create the OMElement via the factory and this revealed that > above suspicion is right. The objects are identically besides the > builder which seems to make all the difference. > > If you create a model directly from a factory and not a builder > AXIOMXPath will not return you any node. Code to reproduce: OMElement root = factory.createOMElement("root", null); OMElement child = factory.createOMElement("child", null); root.addChild(child); AXIOMXPath xpath = new AXIOMXPath("/root/child"); OMElement injectionPoint = (OMElement)xpath.selectSingleNode(root); if(null==injectionPoint){ System.out.println("Should not be null, but the child node"); } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.