You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Nuno Ferreira <nu...@gmail.com> on 2008/04/06 19:41:01 UTC
Question about XPath
Hi, i'm using Xerces 3.0.0.b1 and i can't get xpath to work
Basically i'm parsing a file with XercesDOMParser
then i grab the stuff to a DOMDocument
DOMDocument* domDoc = xdomp->getDocument();
initialise the xpath stuff
DOMXPathEvaluator* xpath = (DOMXPathEvaluator*) domDoc;
DOMXPathResult *xpres;
and finally in a try/catch i try to get the result
xpres = (DOMXPathResult *)
xpath->evaluate(XMLString::transcode("packet/group/offset"),
domDoc->getDocumentElement(), NULL, DOMXPathResult::ANY_TYPE, NULL);
However i always get a message saying: "The requested result type is not
supported".
Any help?
Thanks
RE: Question about XPath
Posted by ka...@wipro.com.
Hi,
I don't think xerces-c supports Xpath. "Request type not supported" is the default print in their implementation.
You can try using Xqilla (http://xqilla.sourceforge.net/HomePage) which works on top of Xerces and support Xquery and Xpath. Xqilla needs Xerces-c v 2.8.
Regards,
Karuna
________________________________
From: Nuno Ferreira [mailto:nuno.and.ferreira@gmail.com]
Sent: Sun 4/6/2008 11:11 PM
To: c-users@xerces.apache.org
Subject: Question about XPath
Hi, i'm using Xerces 3.0.0.b1 and i can't get xpath to work
Basically i'm parsing a file with XercesDOMParser
then i grab the stuff to a DOMDocument
DOMDocument* domDoc = xdomp->getDocument();
initialise the xpath stuff
DOMXPathEvaluator* xpath = (DOMXPathEvaluator*) domDoc;
DOMXPathResult *xpres;
and finally in a try/catch i try to get the result
xpres = (DOMXPathResult *)
xpath->evaluate(XMLString::transcode("packet/group/offset"),
domDoc->getDocumentElement(), NULL, DOMXPathResult::ANY_TYPE, NULL);
However i always get a message saying: "The requested result type is not
supported".
Any help?
Thanks
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
Re: Question about XPath
Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Nuno,
Nuno Ferreira <nu...@gmail.com> writes:
> Hi, i'm using Xerces 3.0.0.b1 and i can't get xpath to work
After b1 was released Alberto added the -xpath option to the
DOMPrint example to shown how to use built-in support for basic
XPath in 3.0.0. You can view the relevant code in DOMPrint.cpp
in the SVN repository:
http://svn.apache.org/viewvc/xerces/c/trunk/samples/src/DOMPrint/DOMPrint.cpp?view=co
Boris
--
Boris Kolpackov, Code Synthesis Tools
Open source XML data binding for C++: http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde
Re: Question about XPath
Posted by Nuno Ferreira <nu...@gmail.com>.
You have to download the 3.0.0 version
http://marc.info/?l=xerces-c-users&m=120541881312475&w=2
On Wed, Apr 9, 2008 at 1:56 PM, Ferdinand Knapitsch <no...@tugraz.at>
wrote:
> Am Mon, 7 Apr 2008 11:37:19 +0100 schrieb Nuno Ferreira:
>
> > Problem solved.
> > Thanks a lot!
>
> Hi,
>
> does XERCES now support the evaluating of XPath expressions? I use XERCES
> 2.8!
> Does anybody know?
>
>
> Thx
> Ferdinand
>
>
>
>
>
>
Re: Question about XPath
Posted by Ferdinand Knapitsch <no...@tugraz.at>.
Am Wed, 09 Apr 2008 16:10:54 +0200 schrieb Alberto Massari:
> Yes; even when using 3.0, you will have to use XQilla if you need
> anything more than simple element navigation.
>
> Alberto
Thank you very much for your answer!
Re: Question about XPath
Posted by Alberto Massari <am...@datadirect.com>.
Yes; even when using 3.0, you will have to use XQilla if you need
anything more than simple element navigation.
Alberto
Ferdinand Knapitsch wrote:
> Am Wed, 09 Apr 2008 15:43:51 +0200 schrieb Alberto Massari:
>
>
>> Hi Ferdinand,
>> (limited) XPath evaluation is available only in Xerces 3.0
>>
>> Alberto
>>
>
> Hello Alberto!
>
> Thank you for your answer!
> That means I have to use the XQilla Implementation anyway if I want to have
> XPath Support?
>
>
> Bye
> Ferdinand
>
>
>
>
>
>
Re: Question about XPath
Posted by Ferdinand Knapitsch <no...@tugraz.at>.
Am Wed, 09 Apr 2008 15:43:51 +0200 schrieb Alberto Massari:
> Hi Ferdinand,
> (limited) XPath evaluation is available only in Xerces 3.0
>
> Alberto
Hello Alberto!
Thank you for your answer!
That means I have to use the XQilla Implementation anyway if I want to have
XPath Support?
Bye
Ferdinand
Re: Question about XPath
Posted by Alberto Massari <am...@datadirect.com>.
Hi Ferdinand,
(limited) XPath evaluation is available only in Xerces 3.0
Alberto
Ferdinand Knapitsch wrote:
> Am Mon, 7 Apr 2008 11:37:19 +0100 schrieb Nuno Ferreira:
>
>
>> Problem solved.
>> Thanks a lot!
>>
>
> Hi,
>
> does XERCES now support the evaluating of XPath expressions? I use XERCES
> 2.8!
> Does anybody know?
>
>
> Thx
> Ferdinand
>
>
>
>
>
>
>
>
Re: Question about XPath
Posted by Ferdinand Knapitsch <no...@tugraz.at>.
Am Mon, 7 Apr 2008 11:37:19 +0100 schrieb Nuno Ferreira:
> Problem solved.
> Thanks a lot!
Hi,
does XERCES now support the evaluating of XPath expressions? I use XERCES
2.8!
Does anybody know?
Thx
Ferdinand
Re: Question about XPath
Posted by Nuno Ferreira <nu...@gmail.com>.
Problem solved.
Thanks a lot!
On Mon, Apr 7, 2008 at 8:19 AM, Alberto Massari <am...@datadirect.com>
wrote:
> Nuno Ferreira wrote:
>
> > Hi, i'm using Xerces 3.0.0.b1 and i can't get xpath to work
> >
> > Basically i'm parsing a file with XercesDOMParser
> >
> > then i grab the stuff to a DOMDocument
> >
> > DOMDocument* domDoc = xdomp->getDocument();
> >
> > initialise the xpath stuff
> >
> > DOMXPathEvaluator* xpath = (DOMXPathEvaluator*) domDoc;
> > DOMXPathResult *xpres;
> >
> > and finally in a try/catch i try to get the result
> >
> > xpres = (DOMXPathResult *)
> > xpath->evaluate(XMLString::transcode("packet/group/offset"),
> > domDoc->getDocumentElement(), NULL, DOMXPathResult::ANY_TYPE, NULL);
> >
> >
>
> The XPath processing can only return nodes, so the types that are
> supported are DOMXPathResult::FIRST_ORDERED_NODE_TYPE,
> DOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE,
> DOMXPathResult::ANY_UNORDERED_NODE_TYPE and
> DOMXPathResult::UNORDERED_NODE_SNAPSHOT_TYPE
>
> Alberto
>
>
> However i always get a message saying: "The requested result type is not
> > supported".
> >
> > Any help?
> >
> > Thanks
> >
> >
> >
>
>
>
Re: Question about XPath
Posted by Alberto Massari <am...@datadirect.com>.
Nuno Ferreira wrote:
> Hi, i'm using Xerces 3.0.0.b1 and i can't get xpath to work
>
> Basically i'm parsing a file with XercesDOMParser
>
> then i grab the stuff to a DOMDocument
>
> DOMDocument* domDoc = xdomp->getDocument();
>
> initialise the xpath stuff
>
> DOMXPathEvaluator* xpath = (DOMXPathEvaluator*) domDoc;
> DOMXPathResult *xpres;
>
> and finally in a try/catch i try to get the result
>
> xpres = (DOMXPathResult *)
> xpath->evaluate(XMLString::transcode("packet/group/offset"),
> domDoc->getDocumentElement(), NULL, DOMXPathResult::ANY_TYPE, NULL);
>
The XPath processing can only return nodes, so the types that are
supported are DOMXPathResult::FIRST_ORDERED_NODE_TYPE,
DOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE,
DOMXPathResult::ANY_UNORDERED_NODE_TYPE and
DOMXPathResult::UNORDERED_NODE_SNAPSHOT_TYPE
Alberto
> However i always get a message saying: "The requested result type is not
> supported".
>
> Any help?
>
> Thanks
>
>