You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pa...@orange-ftgroup.com on 2010/12/06 15:05:44 UTC

XML performance concerns

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.
********************************


Re: XML performance concerns

Posted by Charles Moulliard <cm...@gmail.com>.
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.
> ********************************
>
>

Re: XML performance concerns

Posted by Illtud Daniel <il...@llgc.org.uk>.
patrice.godard@orange-ftgroup.com wrote:

> I'm handling big XML messages (they may be a few MB big).
> I'm concerned about potential performance issues.

We handle XML files of up to 125MB in size, and we haven't
had any problems from Camel.

> Is there any alternate DOM implementation available? I'm thinking of DOM4J for instance.

We've got a type translator for JDOM, if that's any use to you.
Mail me if you're interested.

-- 
Illtud Daniel                                 illtud.daniel@llgc.org.uk
Prif Swyddog Technegol                          Chief Technical Officer
Llyfrgell Genedlaethol Cymru                  National Library of Wales