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>, "'xom-interest AT lists.ibiblio.org'" <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Sparta: similar to XOM.
  • Date: Fri, 27 Sep 2002 23:53:38 -0400

One other big difference I noticed, though only by browsing the source code, so I could be wrong. Sparta seems to make no effort to make sure its data is well-formed. For instance here's the Element constructor:



public Element(String tagName)
{
tagName_ = tagName;
}


It appears that any string at all can be used to set the element, including strings that contain spaces, tabs, nulls, vertical tabs, unmatched halves of surrogate pairs, and more.

Similarly, the setAttribute method isn't checking attribute names or values:


public void setAttribute(String name, String value){
if( attributes_.get(name)==null )
attributeNames_.addElement(name);
attributes_.put(name,value);
notifyObservers();
}

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

public Text(String data)
{
text_ = new StringBuffer(data);
}

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.


--

+-----------------------+------------------------+-------------------+
| 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