Re: [xml] parsing DTD

On Tue, Jun 26, 2001 at 01:07:43PM -0700, Monika Baraniuk wrote:
<!ELEMENT a(b, c, d*)>
You need
<!ELEMENT a (b, c, d*)>

I usually use a layout like this:
<!ELEMENT lower-leg
    (shin, ankle, instep, toes)

<!ATTLIST lower-leg
    amputated (below-ankle|above-ankle|no) "no"
    hairy (yes|no|slightly|very) #REQUIRED

with blank lines between groups for different elements.  If you do this,
you'll find it easier to edit and may make fewer errors.  It's also
easier to read when you print it out.

Is there any way to access the content specification?
Yes, and I see Daniel has replied separately with that information.

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


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

Neither an SGML nor an XML dtd file can contain DOCTYPE, although a
number of SGML vendors (unfortunately for interoperability) added
a requirement that DTDs contain DOCTYPE.

One workaround I have found is this:

<!DOCTYPE book SYSTEM "book.bvi">

book.bvi looks like this:

<!DOCTYPE book [
  <!ENTITY % theDTD SYSTEM "book.dtd">

The book.dtd file contains the actual DTD with no DOCTYPE line, and no ]>
at the end of it (bvi stands for Broken Vendor Implementation).

You process your documents to use .bvi or .dtd accordingly.

There are variants on this approach involving setting up parameter entities,
but they are hard to get right, particularly because XML has restrictions
on the use of parameter entities in the internal dtd subset.


Liam Quin - Barefoot in Toronto - liam holoweb net -
Author, Open Source XML Database Toolkit, Wiley August 2000
Co-author: The XML Specification Guide, Wiley 1999; Mastering XML, Sybex 2001

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