Re: [xml] search by element name



On Sun, Apr 20, 2008 at 04:20:01AM -0500, George Neill wrote:
Hi,

Is there a function that would allow me to search for a DOM element by
name without using xpath?  I can't seem to find one in the API
documentation.

Something like,

xmlNode* xmlFindElementByName(xmlNode * haystack, xmlChar * needle);

  No. There is a full XPath support, use XPath. Trying to 'invent' a 
subset like this is just gonna generate tons of problems:
  - what if the node is namespaced ?
  - how do you select with the namespace ?
  - what if you need to look for a PI and attribute ?

trying to reinvent the wheel that way is useless, if you want to implement
a simpler semantic on top of XPath just define a function doing the wrapping.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]