camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Coelho <Jason_Coe...@Comcast.com>
Subject Splitting a large xml file
Date Sat, 17 Jul 2010 19:02:46 GMT
I just recently started using Apache Camel and am trying to persist a very
large xml file (about 1Gb). At the same, I would like to create jms messages
/ events for each entry in the xml file.

My current approach is to split the XML file using the splitter and then
unmarshalling each entry and saving it to the DB.

XStream xstream = new XStream(new StaxDriver());
XStreamDataFormat dataFormat = new XStreamDataFormat(xstream);

from("file://somefile.xml").process(new
FileToInputStreamProcessor()).split(xPathBuilder).unmarshal(dataFormat)
                .process(new SaveRovi()).to("log:loggingCategory");

Unfortunately, I get an exception when I try the above.


java.lang.ClassCastException: java.io.FileInputStream cannot be cast to
org.w3c.dom.Node
    at 
com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpress
ionImpl.java:116)
    at 
com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpress
ionImpl.java:98)


Any ideas / solutions ? How do I fix this ? Since the xml file is large, I
don't want to use a DOM parser

Jason.



Mime
View raw message