Re: [xml] xmlGetNodePath and default namespaces

On Tue, Mar 04, 2008 at 11:02:56AM -0500, Andrew Jackson wrote:

I've been writing some code using the version of libxml2 that is  
shipped with OS X 10.4 and using xmlGetNodePath to list the elements  
in my files (which use a default namespace). I recently switched to  
the latest version and now, instead of a listing of names I get  
things like /*/*[3].

Looking at the archives and the code I see that in tree.c there is a  
comment (around line 4318) that says:

     * We cannot express named elements in the default
     * namespace, so use "*".

I understand that this change was to ensure that XPath useable  
strings were returned, but that doesn't do me any good as I don't  
know what I'm getting back if I use the string since I don't know  
what the element is.

How should I go about extracting the names of the elements?

The name is part of the node structure for elements, attributes, etc...
so if elem->type is XML_ELEMENT_NODE you can get them as:


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]