Re: [xml] DTD navigation within libxml



On Wed, Jan 09, 2002 at 02:43:00PM +0000, james binks wrote:
The question I have for the list is how do I find out how many subelements 
an element may contain ?

e.g. in my DTD I have
<!ELEMENT ACCUNIT (COUNTER*, REJECTREASON?, SYSTEM?)>

I'm trying to extract the logic that ACCUNIT may contain zero or more 
COUNTER elements then optional REJECTREASON and SYSTEM elements. Do 
functions/properties exist that could give me this info, where should I be 
looking ?

  I the DTD you will get nodes xmlElementPtr for each of the element
declarations. The structure is defined in tree.h
   That structure has an  xmlElementContentPtr content field which conatains
the element content. The various structures and enums are described in
tree.h:
   xmlElementTypeVal
   xmlElementContent
   xmlElementContentOccur
   xmlElementContentType

 Since the validation is based on those informations they are complete.
Note that the existing function:
  xmlValidGetPotentialChildren() in valid.c

  probably does most of what you seems to look for. Alos look at
  xmlValidGetValidElements()
    
Apologies if this is a dumb question, I'm pretty new to the world of XML but 
desperately trying to get up to speed in it for a demanding project at work 
! Any assistance much appreciated,

  It's not related to learning XML but learning the libxml library internals.
Very different.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]