[jdom-interest] JDOM taking too much time to convert xml string to
Document object
Jason Hunter
jhunter at servlets.com
Fri May 10 15:44:35 PDT 2002
JDOM doesn't get directly involved in DTD validation, so this would be
an issue in the parser. I'd suggest you try Crimson and see if that
helps you isolate Xerces as the problem.
-jh-
"Chabbewal, Navjeet" wrote:
>
> I have been using JDON ony my project for a while but recently we had a
> modification in a dtd which seens to cause an substantial increase in
> the time taken to convert an xml string into Document object. The change
> was that one of the elements which had 22 sub-elements now has 39
> sub-elements. Now this is the weird behaviour I am seeing. When the xml
> string does not have one particular xml element ( one of the 39
> sub-elements) it takes 4-5 times more time to process the xml. All these
> sub-elements are optional. I have been using JDOM-B7 but I downloaded
> JDOM-B8 with the same results. Here is the code to convert the xml to
> Document object:
>
> public Document buildDocument(String xml) throws XMLConversionException
> {
> Timer methodTimer = new Timer("buildDocument(xml)");
> methodTimer.start();
> Document document = null;
> SAXBuilder saxBuilder = new SAXBuilder(true);
> try {
> document =
> saxBuilder.build(new InputSource(new
> StringReader(xml)));
> } catch (JDOMException e) {
> log.error("build document failed", e);
> throw new XMLConversionException(e.toString());
> }
> methodTimer.stop();
> log.info( methodTimer.toString() );
> return document;
> }
>
> I have xerces and xalan jar files which come with JDOM in my classpath
> before jdom jar file.
>
> Any ideas what could be happening !!!!
>
>
> --Navjeet
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list