Skip to Content.
Sympa Menu

xom-interest - RE: [XOM-interest] Sparta: similar to XOM.

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: "O'Brien-Strain, Eamonn" <eob AT exch.hpl.hp.com>
  • Cc: "'xom-interest AT lists.ibiblio.org'" <xom-interest AT lists.ibiblio.org>
  • Subject: RE: [XOM-interest] Sparta: similar to XOM.
  • Date: Sun, 29 Sep 2002 17:34:49 -0400

At 1:54 PM -0700 9/29/02, O'Brien-Strain, Eamonn wrote:

Sparta does handle some well-formedness checks, like making sure that elements names have correct characters. However, because Sparta does not validate DTDs and is designed to be as fast and small as possible, it ignores everything it can in the <!DOCTYPE ...> section and so there are bound to be some well-formedness checks that it fails -- but these should not effect the DOM tree.

I was afraid of this. XMLPULL has the same problem. Well-formedness checks on the document entity are not optional. If Sparta isn't doing them, then Sparta is not an XML processor as defined by XML 1.0. From section 5.1 of the spec:

Validating and non-validating processors alike must report violations of this specification's well-formedness constraints in the content of the document entity and any other parsed entities that they read.
...
Non-validating processors are required to check only the document entity, including the entire internal DTD subset, for well-formedness. [Definition: While they are not required to check the document for validity, they are required to process all the declarations they read in the internal DTD subset and in any parameter entity that they read, up to the first reference to a parameter entity that they do not read; that is to say, they must use the information in those declarations to normalize attribute values, include the replacement text of internal entities, and supply default attribute values.] Except when standalone="yes", they must not process entity declarations or attribute-list declarations encountered after a reference to a parameter entity that is not read, since the entity may have contained overriding declarations.

Given Sparta's failure to satisfy this requirement, the comparisons on its web page to Xerces are unfair. Gaining speed by not performing the mandated well-formedness checks is cheating. More importantly, it's extremely damaging to the XML ecosystem. The one thing that's guaranteed in XML is well-formedness. It is the foundation on which everything else rests. If you're letting malformed XML through your parser, then you're polluting the XML ecosystem. I can't recommend that anybody use a parser that deliberately chooses not to check for well-formedness. In fact, I actively recommend that they don't.
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+




Archive powered by MHonArc 2.6.24.

Top of Page