Re: [xml] XPath queries on document fragments without a document



On Thu, Sep 05, 2002 at 04:27:41PM +0200, Christian Glahn wrote:
hi all,

while tracing a problem with XPath queries and document fragments I found
that it is not possible to  XPath query an document fragment, that is 
parsed by xmlParseBalancedChunkMemory(). this means the fragment does not
belong to a document tree ( node->doc == NULL ).

now a xpath query run through xmlXPathCompiledEval() on such a fragment will 
allways returns nothing. apart from i think it's anoying ;) i wonder if there 
is a reason to refuse such queries. 
[...]
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 ...

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]