Re: [xml] Listing possible valid attributes



On Sat, Oct 03, 2009 at 01:34:02AM -0700, D Haley wrote:
Hello,

I have been hunting around the API, but I cannot seem to find any way to obtain a list of attributes as 
specified by the DTD for a given type of node.

I am basically building a simple XML writing "helper" app and I would like to show users what their 
attribute options are. Does anyone know how I might do this, or where I should look?

  Hum, right, there is no equivalent to xmlValidGetPotentialChildren()
but for attributes... The solution is:
 - use xmlGetDtdElementDesc/xmlGetDtdQElementDesc to find the DTD
   element description for the element
 - walk the list of struct _xmlElement returned called attributes
   IIRC the list use the ->next link to get to the next attribute
   on that node (nexth is used internally for the attribute hash table
   of the full DTD).

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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