Loading XML file as an InputStream in BaseX

Thursday, 28 April 2016 · 3 messages · last reply 29 Apr 2016
PF
Pubudu Fernando28 Apr 2016 10:45 #
Hi, I was going through the sample file given at [1]. Here, the XML file is taken from a file. Is there any way of giving the XML as a stream instead? The requirement is to use XPath expressions on an XML payload that comes with an HTTP request (the payload will be available to consume, as an InputStream) to check whether the payload contains some given text/data. I also had a look at [2]. Is this approach valid only for common types like integer, string etc? [1] - https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/local/RunQueries.java [2] - https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/local/BindVariables.java Thanks
-- *Pubudu Fernando* Software Engineer - Intern WSO2 Inc. m: +94 77 888 2543 <https://lk.linkedin.com/in/pubuduf> <http://blog.pubudu.xyz/> <https://github.com/pubudu91> <http://stackoverflow.com/users/4329912/pubudu>
CG
Christian Grün28 Apr 2016 19:41 #
Hi Pubudu, Streaming may be a non-trivial task. Before thinking about pipelining input data, I would first be interested if data transmission will really be a potential bottleneck. Have you already done som profiling? Cheers, Christian
Quoted text · Pubudu Fernando · 29 lines
On Thu, Apr 28, 2016 at 10:45 AM, Pubudu Fernando <pubuduf at wso2.com> wrote: > Hi, > > I was going through the sample file given at [1]. Here, the XML file is > taken from a file. Is there any way of giving the XML as a stream instead? > The requirement is to use XPath expressions on an XML payload that comes > with an HTTP request (the payload will be available to consume, as an > InputStream) to check whether the payload contains some given text/data. > > I also had a look at [2]. Is this approach valid only for common types > like integer, string etc? > > [1] - > https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/local/RunQueries.java > [2] - > https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/local/BindVariables.java > > Thanks > -- > *Pubudu Fernando* > Software Engineer - Intern > WSO2 Inc. > m: +94 77 888 2543 > > <https://lk.linkedin.com/in/pubuduf> <http://blog.pubudu.xyz/> > <https://github.com/pubudu91> > <http://stackoverflow.com/users/4329912/pubudu> > >
CG
Christian Grün29 Apr 2016 10:56 #
Hi Isuru, I have attached a little example to this mail (in which the result will be streamed as well). Hope this helps Christian
Quoted text · Isuru Ranawaka · 67 lines
On Fri, Apr 29, 2016 at 6:23 AM, Isuru Ranawaka <isurur at wso2.com> wrote: > Hi Christian, > > We are in the process of evaluating BaseX as a XPath engine that can be > used inside our products. But samples that we have seen are only for > evaluating XQuery against a XML Document. Do you have any sample or way > that we can evaluate XPath against a InputStream. Because we cannot convert > incoming stream in to a document and read it again it will have huge > overhead. It will be great if you can provide sample code or reference that > can be refer to. > > thanks > > On Thu, Apr 28, 2016 at 11:11 PM, Christian Grün < > christian.gruen at gmail.com> wrote: > >> Hi Pubudu, >> >> Streaming may be a non-trivial task. Before thinking about pipelining >> input data, I would first be interested if data transmission will really be >> a potential bottleneck. Have you already done som profiling? >> >> Cheers, >> Christian >> >> >> >> On Thu, Apr 28, 2016 at 10:45 AM, Pubudu Fernando <pubuduf at wso2.com> >> wrote: >> >>> Hi, >>> >>> I was going through the sample file given at [1]. Here, the XML file is >>> taken from a file. Is there any way of giving the XML as a stream instead? >>> The requirement is to use XPath expressions on an XML payload that comes >>> with an HTTP request (the payload will be available to consume, as an >>> InputStream) to check whether the payload contains some given text/data. >>> >>> I also had a look at [2]. Is this approach valid only for common types >>> like integer, string etc? >>> >>> [1] - >>> https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/local/RunQueries.java >>> [2] - >>> https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/local/BindVariables.java >>> >>> Thanks >>> -- >>> *Pubudu Fernando* >>> Software Engineer - Intern >>> WSO2 Inc. >>> m: +94 77 888 2543 >>> >>> <https://lk.linkedin.com/in/pubuduf> <http://blog.pubudu.xyz/> >>> <https://github.com/pubudu91> >>> <http://stackoverflow.com/users/4329912/pubudu> >>> >>> >> > > > -- > Best Regards > Isuru Ranawaka > M: +94714629880 > Blog : http://isurur.blogspot.com/ >

⚡Generated with XQuery