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

Re: [xml] Building XML response from a DTD



On Tue, Feb 04, 2003 at 11:37:28AM -0500, Jeff Blain wrote:
> I’m relatively new to XML.  I’ve been doing some research regarding a
> project of which my team is participating.  Fortunately, someone pointed me
> to the XML C library for Gnome site.
>  
> Our hope is to be able to read into memory (parse) a given DTD from a file
> and then “walk” the DTD to build an XML response populated with data
> returned from the DB.  I’ve been trying to read as much of the documentation
> on the site including the archives.  I think the tools exist within libxml2
> to accomplish our task.  I was hoping someone might be able to suggest the
> functions/routines necessary to do this.  It would help confirm we’re on the
> right track.

  read include/libxml/parser.h you will see
  xmlDtdPtr       xmlParseDTD             (const xmlChar *ExternalID,
                                           const xmlChar *SystemID);
					   
that should allow the first part.
  For the second part read include/libxml/valid.h you will see
   xmlElementPtr   xmlGetDtdElementDesc    (xmlDtdPtr dtd,
                                            const xmlChar *name);

  the xmlElementPtr structure will allow you to lookup the content model
    
Check also 
int             xmlValidGetValidElements(xmlNode *prev,
                                         xmlNode *next,
                                         const xmlChar **list,
                                         int max);
int             xmlValidGetPotentialChildren(xmlElementContent *ctree,
                                         const xmlChar **list,
                                         int *len,
                                         int max);

   You will have to dig into libxml2 data structures, but most of them
are public, so...

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]