Re: [xml] Relative XPath search
- From: "m curcio libero it" <m curcio libero it>
- To: "veillard" <veillard redhat com>
- Cc: xml <xml gnome org>
- Subject: Re: [xml] Relative XPath search
- Date: Wed, 13 Jul 2005 11:34:25 +0200
First of all thank you for the quick response ^___^
I understand the point in your answer and I'm fine with it.
I'm currently forced to use this trick because my previous solution (1.creating a new temporary document,
2.setting the context node as its root node, 3.performing the relative Xpath search in the "proper" way,
4.detach the context node from its temporary document) gave me some weird problems in some circumstances
(nodes "disappearing" ^__^) even if I forced the subtree to point to the temporary document, and then removed
this pointing, using the xmlSetTreeDoc API on the context node.
There's just one more doubt that I have:
By saying "none of the XPath expressions need to access the root" you're referring to the explicit usage,
within the XPath string, of axis like 'ancestor', 'ancestor-or-self', 'namespace', 'parent' ?
Thank you again, bye
Massimiliano
---------- Initial Header -----------
From : "Daniel Veillard" veillard redhat com
To : "m curcio libero it" m curcio libero it
Cc : "xml" xml gnome org
Date : Wed, 13 Jul 2005 04:59:18 -0400
Subject : Re: [xml] Relative XPath search
On Wed, Jul 13, 2005 at 10:31:08AM +0200, m curcio libero it wrote:
My application needs to be able to do that even if "xmlNode" does not belong to any DOM (that is, a
subtree of nodes created by scratch). I tried to do this:
// Create xpath evaluation context
xpathCtx = xmlXPathNewContext(NULL);
and it seems to be working properly.
But I wonder, is that safe ?
This should be safe as long as none of the XPath expressions need to
access the root, but this is a non-common situation so you are exposing
yourself to potential bugs that may have been unnoticed because everybody
tests with document where all nodes refers to a doc.
I can't give a formal "this is safe" statement.
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
____________________________________________________________
6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
Scaricalo su INTERNET GRATIS 6X http://www.libero.it
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]