[XOM-interest] NUX, StreamingPathFilter and OutOfMemoryError
Wolfgang Hoschek
wolfgang.hoschek at mac.com
Mon Nov 19 20:35:13 EST 2007
This example works fine here with a 10 MB heap (java -Xmx10m) and the
nux-1.6 release. I just downloaded the DBLP data (400 MB) again and
ran your snippet with sun java-1.5. BTW, since the DBLP data includes
a lot of external entities you need to bump up the entity expansion
limit according to http://java.sun.com/webservices/docs/1.5/jaxp/
ReleaseNotes.html via
System.setProperty("entityExpansionLimit", String.valueOf
(Integer.MAX_VALUE));
More detailed config and version info for your environment might help
to pinpoint the problem.
Wolfgang.
On Nov 19, 2007, at 2:39 AM, Cedric Coulon wrote:
> Hi,
>
> I want to parse a large xml file and extract the element book. The xml
> source file is dblp database (dblp.xml - 411M -
> http://dblp.uni-trier.de/xml/).
> So I use NUX and the StreamingPathFilter class. However I have an
> OutOfMemoryError... I don't know what I'm doing wrong.
>
> Thanks you for your help.
>
> Bye,
> Cedric.
>
> Here is the source of my java program:
>
> public static void main(String[] args) {
> try {
> StreamingTransform myTransform = new StreamingTransform
> () {
> public Nodes transform(Element e) {
> System.out.println(XOMUtil.toPrettyXML(e));
> return new Nodes();
> }
> };
>
> Builder builder = new Builder(new
> StreamingPathFilter("/dblp/book", null).createNodeFactory(null,
> myTransform));
> builder.build(new File("dblp.xml")); //
> http://dblp.uni-trier.de/xml/
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
More information about the XOM-interest
mailing list