ewitness - Ben Fowler wrote: > > [ big snip ]
You are stating that the document contains an 'example' tag as the root element, but not stating what the root element contains is an error. The following XML is valid:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <!DOCTYPE example [ <!ELEMENT example (title,para)> <!ELEMENT title (#PCDATA)> <!ELEMENT para (#PCDATA)> <!ENTITY ldquo "“"> <!-- --> <!ENTITY rdquo "”"> <!-- RIGHT DOUBLE QUOTATION MARK --> ]> <example> <title>A Canonical Greeting</title> <para>“Hello World!”</para> </example>
[ snip ]
A validating parser should read the external DTD, whereas a non-validating may, but is not required to, even if standalone is set to "no". Basically this means that if the external subset contains declarations with consequences for a document's content, the document's content depends on the parser in use and how it is configured.
There are a couple of points.
1. What I was hoping to do is have entities but no external DTD. Is this impossible? Or alternatively possible only at the penalty of putting a reasonable DTD in the internal subset?
I don't see why my orignal request cannot be satisfied? Is it something that has been true of SGML all along and is therefore grandfathered into XML. If so, there is a distinction that could be made in that since a DTD is required for SGML nobody would have noticed that this was part and parcel of declaring ENTITYs.
What I would like would be to independently switch on or off validation and general entities?
2. I have never seen a parser that does not switch into validating mode when there is an external subset. Reading an external DTD is a sine qua non for accessing the ENTITYs in it.
At least this adds colour to my assertion that it is sometimes easier to use a numeric form of entity rather than a general entity.
Note that this does not apply to HTML because in HTML a lot of entities are made available without there being a DTD at all.
Ben.