Re: [xml] parsing DTD



On Tue, Jun 26, 2001 at 01:07:43PM -0700, Monika Baraniuk wrote:
Hi, 

I'v just started to use libxml and I'm trying to parse a DTD. My
understanding is that with libxml I can not interpret the hierarchy of
elements even though that the content specification (what is and isn't
allowed in the document) is included in DTD. Therefore I'm trying to

   I can't understand what you wrote, sorry.
you can parse a DTD with 

  xmlDtdPtr       xmlParseDTD             (const xmlChar *ExternalID,
                                           const xmlChar *SystemID);

write my small parser to interpret the content specification. My

   You should not have to write you own DTd parser libxml has one...

problem is that I did not find any way to access the content
specification. I only receive back the element names, comments and so
on. 

Just to clarify I need to access what 'a' element contains in the
following declaration:
<!ELEMENT a(b, c, d*)>

             ^ wron you need a space between a and (

and so I shall get (b,c,d*).

Is there any way to access the content specification?

  xmlElementPtr   xmlGetDtdElementDesc    (xmlDtdPtr dtd,
                                           const xmlChar *name);

Also I noticed that my DTD can NOT include the !DOCTYPE declaration:
<!DOCTYPE X [

]>

  right it's not allowed, read the spec.

Is there any work around for parsing a DTD with !DOCTYPE declaration?

  No this is not XML.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Sep 17-18 2001 Brussels Red Hat TechWorld http://www.redhat-techworld.com




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