[jdom-interest] JDOM taking too much time to convert xml string to Document object
Alex Rosen
arosen at silverstream.com
Sun May 12 13:38:06 PDT 2002
- It's unlikely that JDOM is causing the slowdown. JDOM is not a parser,
it's using Xerces to do the XML parsing. JDOM is just building a tree from
the results that Xerces passes in. You might try just using Xerces to parse
the file into a DOM tree and see if you see the same behavior.
- Not knowing anything about your DTD or XML, the first thing that comes to
my mind when such a dramatic slowdown occurs is that maybe it's now
retrieving some data from another machine. E.g. if something in your DTD is
now referencing an entity on a remote server, or something along those lines
Alex
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Chabbewal, Navjeet
> Sent: Tuesday, May 07, 2002 4:04 PM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] JDOM taking too much time to convert
> xml string
> to Document object
>
>
> 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/yo
uraddr at yourhost.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2892 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20020512/5991bfdf/winmail.bin
More information about the jdom-interest
mailing list