camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: XML performance concerns
Date Mon, 06 Dec 2010 14:42:25 GMT
Hi Patrice,

Camel uses the javax.xml.xpath librairies of the KDK. To parse the 
document, it uses DOM class of org.w3c.dom.Document, Node, ...

But you can use a different documentType to convert the string into a 
Sax stream instead of a DOM

     /**
      * Configures the document type to use.
      * <p/>
      * The document type controls which kind of Class Camel should 
convert the payload
      * to before doing the xpath evaluation.
      * <p/>
      * For example you can set it to {@link InputSource} to use SAX 
streams.
      * By default Camel uses {@link Document} as the type.
      *
      * @param documentType the document type
      * @return the current builder
      */
     public XPathBuilder documentType(Class<?> documentType) {
         setDocumentType(documentType);
         return this;
     }

Remark : If your file is really big, then consider to use camel-stream 
to avoid memory leak or one of the strategy mentioned by Saxon --> 
http://www.saxonica.com/documentation/sourcedocs/streaming.xml.

Regards,

Charles

On 06/12/10 15:05, patrice.godard@orange-ftgroup.com wrote:
> Hi,
> I'm handling big XML messages (they may be a few MB big).
> I'm concerned about potential performance issues.
> How is XML handled internally in Camel?
>
> What happens when I call xpath() in a camel route?
> What is the XPATH engine used? Is the whole XML parsed into a DOM W3C Document?
>
> Is there any alternate DOM implementation available? I'm thinking of DOM4J for instance.
>
> Any best practice about XML handling in Camel is welcome.
>
> Patrice
>
>
>
>
> *********************************
> This message and any attachments (the "message") are confidential and intended solely
for the addressees.
> Any unauthorised use or dissemination is prohibited.
> Messages are susceptible to alteration.
> France Telecom Group shall not be liable for the message if altered, changed or falsified.
> If you are not the intended addressee of this message, please cancel it immediately and
inform the sender.
> ********************************
>
>

Mime
View raw message