Re: [xml] XPath queries on document fragments without a document
- From: Daniel Veillard <veillard redhat com>
- To: Sean Chittenden <sean chittenden org>
- Cc: Christian Glahn <christian glahn uibk ac at>, xml gnome org
- Subject: Re: [xml] XPath queries on document fragments without a document
- Date: Thu, 5 Sep 2002 15:22:05 -0400
On Thu, Sep 05, 2002 at 12:15:09PM -0700, Sean Chittenden wrote:
[...] my question is now: is there a reason to refuse xpath
queries on document fragments?
yes, the XPath semantic is not defined. For example what does "/"
XPath evaluation should return ??? And an awful lot of XPath
queries use / , /foo or //foo to start a lookup, no really, having
element without a document breaks an awful lot of things in the XML
infrastructure, each time I suggest not to do it, people do it
anyway and have troubles, big surprise ...
Return NULL on all queries that start with / and node->doc == NULL? -sc
foo[ id = /bar/value]
and this breaks.
THE SOLUTION, is to keep a surrounding document element, as well as
a fake root element to encapsulate the well-balanced chunk and run the
query on this perfectly well defined document.
A document fragment ain't an XML document. Make it a document and
everything becomes smooth,
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]