ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Veithen <andreas.veit...@gmail.com>
Subject Re: Axiom Reads the whole input stream when applying the xpaths
Date Thu, 06 Sep 2012 08:30:13 GMT
On Wed, Sep 5, 2012 at 8:25 AM, Amila Suriarachchi
<amilasuriarachchi@gmail.com> wrote:
> hi all,
>
> I tested the $subject with the following code. Although we try to execute an
> xpath for a small part it reads all the input stream.
>
> System.out.println("Running Axiom perf test...");
>
>         FileInputStreamWrapper fileInputStream = new
> FileInputStreamWrapper("request_100.xml");
>
>         System.out.println("Number of bytes read ==> " +
> fileInputStream.getNumberOfBytesRead());
>
>         XMLStreamReader xmlStreamReader =
> StAXUtils.createXMLStreamReader(fileInputStream);
>
>         System.out.println("Number of bytes read ==> " +
> fileInputStream.getNumberOfBytesRead());
>
>         StAXOMBuilder stAXOMBuilder = new StAXOMBuilder(xmlStreamReader);
>
>         OMElement omElement = stAXOMBuilder.getDocumentElement();
>
>         AXIOMXPath axiomxPath = new
> AXIOMXPath("//ns1:echo/ns1:param0[1]/ns1:param1");
>         axiomxPath.addNamespace("ns1","http://service.perf.test.com");
>
>         OMElement resultOMElement = (OMElement)
> axiomxPath.selectSingleNode(omElement);
>
>         System.out.println("Result OMElement ==> " +
> resultOMElement.toString());
>
>         System.out.println("Number of bytes read ==> " +
> fileInputStream.getNumberOfBytesRead());
>
> And got the following.
>
> Number of bytes read ==> 0
> Number of bytes read ==> 32
> Result OMElement ==> <ns1:param1
> xmlns:ns1="http://service.perf.test.com">5</ns1:param1>
> Number of bytes read ==> 102511
>
> Is it possible to stop this and have the differed building with the xpath as
> well?

No. Since we use Jaxen as XPath implementation and Jaxen has not been
designed for this, it won't be possible.

> thanks,
> Amila.
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: dev-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


Mime
View raw message