[jdom-interest] [Fwd: JDOM ?]
Dennis Sosnoski
dms at sosnoski.com
Tue Mar 12 09:08:32 PST 2002
The SAX specification says that parser instances are reusable:
http://www.saxproject.org/apidoc/org/xml/sax/XMLReader.html#parse(org.xml.sax.InputSource):
"Once a parse is complete, an application may reuse the same XMLReader
object, possibly with a different input source."
- Dennis
Alex Rosen wrote:
>If we're sure that all parser support being reused (or are supposed to
>support it), then it does seem like a good idea. Doing a quick search, I
>found that the original (i.e. very old) IBM4J parser says this about its
>parsing methods: "Once this method is invoked, the parser instance is of no
>further use, and should NOT be reused." I don't know about newer parsers.
>The JAXP spec doesn't say one way or the other...
>
>http://www-4.ibm.com/software/webservers/appserv/doc/v20dcadv/doc/apidocs/co
>m.ibm.xml.parser.Parser.html
>
>Alex
>
>>-----Original Message-----
>>From: jdom-interest-admin at jdom.org
>>[mailto:jdom-interest-admin at jdom.org]On Behalf Of Dennis Sosnoski
>>Sent: Monday, March 11, 2002 9:08 PM
>>To: Jason Hunter
>>Cc: JDOM Interest; K.Gillies
>>Subject: Re: [jdom-interest] [Fwd: JDOM ?]
>>
>>
>>You can subclass SAXBuilder and override the createParser
>>method to only
>>create a parser the first time through. That's probably the simplest
>>solution to get reusability (though I haven't looked into
>>whether there
>>might be other issues).
>>
>>It seems like this is a reasonable thing for SAXBuilder to do by
>>default, though. Is there any reason you'd want the code to
>>always build
>>a new parser? I can't think of any.
>>
>> - Dennis
>>
>
More information about the jdom-interest
mailing list