Re: [xml] XPath queries on document fragments without a document
- From: Sean Chittenden <sean chittenden org>
- To: Daniel Veillard <veillard redhat com>
- 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 12:50:18 -0700
[...] 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.
Ahh, heh.
A document fragment ain't an XML document. Make it a document and
everything becomes smooth,
Alrighty, groovy. Just thought there could be an easy fix. ::shrug::
Hey, fwiw, if anyone's interested in a libxml/libxslt bindings for
Ruby, let me know. They're adhering to the C API so far but aren't
finished and should be pretty easy to use. -sc
--
Sean Chittenden
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]