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.


On Wed, Sep 11, 2013 at 5:45 PM, Asiri Liyana Arachchi
<asiriw...@gmail.com>wrote:

> That was exactly the mistake I did. Thank you for pointing that out. After
> removing
> "import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
> import com.sun.org.apache.xerces.internal.xs.XSModel;
> import com.sun.xml.internal.ws.api.pipe.Engine;
> "
> these imports code worked fine.
>
> Thank you.
>
> Regards
> Asiri
>
>
> On Wed, Sep 11, 2013 at 5:22 PM, Jesper Steen Møller <jes...@selskabet.org
> > wrote:
>
>>
>> On 11/09/2013, at 13.08, Asiri Liyana Arachchi wrote:
>>
>> I've downloaded Psychopath and other dependencies and checked it with
>> using the code provided here [1] for non schema aware processing. It shows
>> two errors
>> 1) constructor Engine is undefined.
>> 2)The method parseExpression(String, StaticContextBuilder) is undefined
>> for the type Engine
>>
>>
>> I'm guessing you've imported the wrong 'Engine' class. You need
>> org.eclipse.wst.xml.xpath2.processor.Engine. it looks like you
>> have com.sun.xml.internal.ws.api.pipe.Engine instead.
>>
>>
>> Is there a mailing list to get help for psychopath processor issues?
>>
>>
>> There is a forum for WTP [1], but with very little XPath2 contents, so I
>> don't watch it regularly. If you post your XPath2 implementation questions
>>  there, please send me a mail to let me know to look there. Or - for more
>> general XPath2 usage questions, you should consider using StackOverflow,
>> there are many helpful souls out there, too.
>>
>> [1] http://www.eclipse.org/forums/index.php/f/88/
>>
>> -Jesper
>>
>>
>> _______________________________________________
>> wtp-dev mailing list
>> wtp-dev@eclipse.org
>> https://dev.eclipse.org/mailman/listinfo/wtp-dev
>>
>>
>
_______________________________________________
wtp-dev mailing list
wtp-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/wtp-dev

Reply via email to