[jdom-interest] Reusing parsers
Elliotte Rusty Harold
elharo at metalab.unc.edu
Tue Apr 15 03:27:11 PDT 2003
At 10:01 AM +0200 4/15/03, Laurent Bihanic wrote:
>The problem here is that I'm not sure all parsers support being
>reused in all cases. I suspects some parsers could not be reused
>after some parsing errors were encountered. This is the reason
>parser reuse is not the enabled by default.
>Removing the method setReuseParser method would mean forcing parser
>reuse. I don't think we have enough feedback on this to do that yet.
Hmm, I think they do. Can you point to one parser that is not
reusable? Should we take this up with the SAX folks? In fact, never
miond. They already say this, and I quote from
http://www.saxproject.org/apidoc/org/xml/sax/XMLReader.html#parse(org.xml.sax.InputSource):
Applications may not invoke this method while a parse is in progress
(they should create a new XMLReader instead for each nested XML
document). Once a parse is complete, an application may reuse the
same XMLReader object, possibly with a different input source.
Any XML parser that does not allow reuse is not conformant with the
SAX specification. I think we're reasonably safe in relying on parser
reuse, and there's no need to clutter the API with an additional
method to turn parser reuse on and off.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | 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/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list