Re: jdom 1.1
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <[email protected]> |
I read the same file using jdom 1.0 and jdom 1.1
a file of 25Mb is parsed in 9 seconds with jdom 1.0 and with jdom 1.1 in 5 minutes.
a file of 73Mb is parsed in 44 seconds with jdom 1.0 and with jdom 1.1 in 47 minutes!
I only changed the jar files. The code is the same, but the duration increased with a factor 60.
Can someone tell me why?
Thanks a lot.
import
java.io.FileInputStream;
import
java.io.InputStream;
import
java.util.ArrayList;
import
java.util.Calendar;
import
java.util.Iterator;
import
java.util.List;
import
org.jdom.Document;
import
org.jdom.Element;
import
org.jdom.input.SAXBuilder;
public
public static void main(String[] args) {
SAXBuilder saxBuilder=new SAXBuilder(false);try{new FileInputStream("C:/catalogueDOM36.xml");
System.out.println("min: "+Calendar.getInstance().get(Calendar.MINUTE)+" sec: "+Calendar.getInstance().get(Calendar.SECOND));readXMLFileWithJDom(jdomDocument);out.println("min: "+Calendar.getInstance().get(Calendar.MINUTE)+" sec: "+Calendar.getInstance().get(Calendar.SECOND));catch (Exception e) {
InputStream input=
Document jdomDocument= saxBuilder.build(input);
System.
}
e.printStackTrace();
}
}
public static void readXMLFileWithJDom(org.jdom.Document jdomDocument){
Element catalogueElement=jdomDocument.getRootElement();
Catalogue catalogue=readCatalogueElement(catalogueElement);
}
public static Catalogue readCatalogueElement(Element element){new Catalogue();if(children !=null){while (iterator.hasNext()) {
catalogue.setDateCreated(readDate(child));
}
catalogue.setDateModified(readDate(child));
}
catalogue.setComment(child.getText());
}
bookList=
catalogue.setBookList(bookList);
readListOfBooks(child, catalogue);
}
cdList=
catalogue.setCdList(cdList);
readListOfCds(child,catalogue);
}
}
}
}
if(child.getName()=="date_created"){else if(child.getName()=="date_modified"){else if(child.getName()=="comment"){else if(child.getName()=="books"){new ArrayList();else if(child.getName()=="cds"){new ArrayList();return catalogue;
ArrayList bookList;
ArrayList cdList;
Catalogue catalogue=
List children=element.getChildren();
Iterator iterator=children.iterator();
Element child = (Element) iterator.next();
class JDomReaderSax {
Dit bericht is onderworpen aan de voorwaarden beschikbaar op onze website
Ce message est soumis aux conditions disponibles sur notre site web
This message is subject to the terms and conditions available on our website
Dit bericht is onderworpen aan de voorwaarden beschikbaar op onze website
Ce message est soumis aux conditions disponibles sur notre site web
This message is subject to the terms and conditions available on our website
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]