Re: [xml] search by element name

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

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

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.


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]