Currently Psychopath Xpath processor uses XercesLoader class to load bytestream and create org.w3c.dom.Document and it can be passed to evaluate the Xpath.
InputStream is = new FileInputStream("resources/test.xml");
DOMLoader loader = new XercesLoader();
Document doc = loader.load(is);
I created org.w3c.dom.Document using axiom and passed it to Psychopath.
OMElement documentElement = new StAXOMBuilder("resources/test.xml").getDocumentElement();
XMLStreamReader llomReader = documentElement.getXMLStreamReader();
OMFactory doomFactory = DOOMAbstractFactory.getOMFactory();
StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, llomReader);
//Get the document element
OMElement newElem = doomBuilder.getDocumentElement();
Document doc2 = getDomDocument(newElem);
public static org.w3c.dom.Document getDomDocument(OMElement element){
OMFactory doomFactory = DOOMAbstractFactory.getOMFactory();
StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory,element.getXMLStreamReader());
return (org.w3c.dom.Document) doomBuilder.getDocument();
}
But when passing doc2 to evaluate XPath in Psychopath it gives the error
org.w3c.dom.DOMException: NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation.
Needs an explanation.