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: "O'Brien-Strain, Eamonn" <eob AT exch.hpl.hp.com>
  • To: "'Elliotte Rusty Harold'" <elharo AT metalab.unc.edu>
  • 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 14:59:36 -0700

> -----Original Message-----
> From: Elliotte Rusty Harold [mailto:elharo AT metalab.unc.edu]
[...]
> Sparta seems to make no effort to
> make sure its data is well-formed. [...]
> It appears that any string at all can be used to set the element [tagName],
> including strings that contain spaces, tabs, nulls, vertical tabs,
> unmatched halves of surrogate pairs, and more.

This is true.

> Similarly, the setAttribute method isn't checking attribute
> names or values[...]

This is true for the attribute name. However it is OK to pass arbitrary
characters in the attribute value: it will be encoded in the toXml()
serializer.

> The Text class also seems to be allowing anything, well-formed or not:
[...]

Just like attribute values, it is OK to pass in arbitrary text. The toXml()
serializer will either encode the text or enclose it in <![CDATA[ ... ]]>

> XOM is fanatical about enforcing well-formedness. Sparta appears to
> be ignoring that issue completely, and relying on the client
> programmer to know, remember, and follow all the well-formedness
> rules of XML.

Yes, Sparta does assume that certain preconditions are met and these should
be documented in the JavaDoc. Perhaps I should move some of the checks from
the parser to the DOM creation code -- which would probably not increase the
code size much. But then more of the DOM methods would have to throw
exceptions, which would be annoying. Another approach is to "encode" bad tag
and attribute names as correct names -- but I am a bit dubious about that.

__
Eamonn O'Brien-Strain
HP Labs
eob AT hpl.hp.com






Archive powered by MHonArc 2.6.24.

Top of Page