[xml] XPath queries on document fragments without a document
- From: Christian Glahn <christian glahn uibk ac at>
- To: xml gnome org
- Subject: [xml] XPath queries on document fragments without a document
- Date: Thu, 5 Sep 2002 16:27:41 +0200
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.
i found removing the following lines in xpath.c made such queries possible.
queries from on the document root just returned -- correctly -- no value.
----8<-----8<------8<-------8<-------8<-------8<------
3673,3682d3672
else if (ctxt->doc == NULL) { \
xmlGenericError(xmlGenericErrorContext, \
"%s:%d Internal error: no document\n", \
__FILE__, __LINE__); \
} \
else if (ctxt->doc->children == NULL) { \
xmlGenericError(xmlGenericErrorContext, \
"%s:%d Internal error: document without root\n", \
__FILE__, __LINE__); \
} \
----8<-----8<------8<-------8<-------8<-------8<------
my question is now: is there a reason to refuse xpath queries on
document fragments?
thanks
christian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]