[Home] [By Thread] [By Date] [Recent Entries]

  • To: <xml-dev@l...>
  • Subject: RE: expat question: reading DTD
  • From: "scott wiseman" <scott@i...>
  • Date: Tue, 18 Jan 2005 08:22:47 -0800
  • Thread-index: AcT9eO733/LdSbqmRbainxmshWklUQABDcyw
  • Thread-topic: expat question: reading DTD



-----Original Message-----
From: rickc@r... [mailto:rickc@r...] 
Sent: Tuesday, January 18, 2005 8:14 AM
To: xml-dev@l...
Subject:  expat question: reading DTD


Hello -

Somewhere in the expat docs this list is given as a place to
ask questions. I've looked on the web for an answer
and have come up empty, so I hope it's OK to ask here.

What I want to do is use expat to read HTML 4.01. I have
no problem with the requirement of the input being
well formed. But, to do this I have to read the standard
"loose" or "strict" DTD. 

What I've tried:

XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
XML_SetExternalEntityRefHandler(parser,ext_ref_handler);

and then in ext_ref_handler, create a sub_parser:

XML_ExternalEntityParserCreate(parser,context,encoding)

and feed the DTD file to it.

The problem:

It chokes on the first non-comment line (an ENTITY) in loose.dtd
from w3.org with a syntax error. It doesn't seem to like the "--"
as a comment delimiter.

Should I not use loose.dtd? I kinda assumed it is a valid DTD...

Are there any examples/samples of parsing a DTD? I found lots of
descriptions of how to do it (which seems to be what I did) but
no code.

This is with version expat-1.95.8 

Thanks,

Rick

rickc
rdrop.com



-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://www.oasis-open.org/mlmanage/index.php>
<a href="http://www.avidware.net/">Microsoft Certified Partner los
angeles</a>

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member