|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: The subsetting has begun
At 10:57 AM -0500 2/21/03, Mike Champion wrote: >I'm not sure what "processing" a DTD means in a technical sense. >Accepting the entity declarations, setting the default attribute >values, etc. but not enforcing any content model constraints? Or >just parsing DTDs and ignoring everthing in there. (IIRC either >would be "legal" for a non- validating parser). What would you >suggest J2ME parsers do? At a minimum J2ME parsers should read the DOCTYPE declaration (not necessarily the full DTD) and apply default attribute values and resolve internal entities up till the point where they encounter an external parameter entity they have not resolved. They should also throw a SAXParseException if there's a well-formedness error somewhere in the DOCTYPE declaration. "parsing DTDs and ignoring everthing in there" is not conformant with XML. If a parser wants to read the rest of the DTD it can, in which case it must apply the default attribute values and entities it finds there. >Channeling my inner newbie, I'd rather get slapped down on line 2 >when a DTD reference or subset is rejected than on line 666 when I >referenced an entity whose declaration was "processed" but not >actually defined by the parser. Conformance to XML 1.0 by J2ME is >cold comfort to someone with a bug to fix and an incomprehensible >message from the XML library to work with. Would you rather have every XHTML document rejected on line 2 whether you used entities or not? Whether the document was well-formed or not? An undefined entity is a genuine error when the parser reads the full DTD. A DOCTYPE declaration is not an error. I prefer to reserve SAXParseExceptions for real errors rather than having the parser throw the document away on line 2 because there might be an error a few hundred lines later. Then real fix here is better error messages. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@m... | Writer/Programmer | +-----------------------+------------------------+-------------------+ | Processing XML with Java (Addison-Wesley, 2002) | | http://www.cafeconleche.org/books/xmljava | | http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








