On Tue, Mar 04, 2008 at 11:02:56AM -0500, Andrew Jackson wrote: > Hi, > > 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: elem->name elem->parent->name etc... Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
