Re: saxon-help Digest, Vol 26, Issue 18

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: saxon-help Digest, Vol 26, Issue 18

by Sylvain Hallé-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks.  However, I noticed in the documentation that this streaming facility
is available for an expression that must start with doc() (i.e. it must read a
file).  If I set my document context to another source (e.g. a character
stream produced by another part of my code) using the bindDocument() method,
is there a way to achieve the same result?

Sylvain


 > > -----Original Message-----
 > Date: Thu, 10 Jul 2008 21:24:49 +0100
 > From: "Michael Kay" <mike@...>
 > Subject: Re: [saxon] Partial results from a query?
 > To: "'Mailing list for the SAXON XSLT and XQuery processor'"
 > <saxon-help@...>
 > Message-ID: <FAD5BE0E47FF48ACA1B9AC24BF18CEF6@Sealion>
 > Content-Type: text/plain; charset="iso-8859-1"
 >
 >
 > You can do this using the streaming facility which is new (as far as XQuery
 > is concerned) in Saxon-SA 9.1.
 >
 > You would have to write this as
 >
 > (#saxon:stream#) {doc('in.xml')/a/*}
 >
 > to invoke the streaming mode of execution. Further details:
 >
 > http://www.saxonica.com/documentation/sourcedocs/serial.html
 >
 > (I'm not sure if you can write "for $x in doc('in.xml')/a/* return $x".
 > Saxon will always rewrite "for $x in E return $x" as simply "E", but it may
 > make decisions on streamability before this rewrite is done - I would have
 > to check).
 >
 > Michael Kay
 > http://www.saxonica.com/
 > > -----Original Message-----
 > > From: saxon-help-bounces@...
 > > [mailto:saxon-help-bounces@...] On Behalf
 > > Of Sylvain Hall?
 > > Sent: 10 July 2008 17:36
 > > To: saxon-help@...
 > > Subject: [saxon] Partial results from a query?
 > >
 > > Is it possible for Saxon to output partial results from a
 > > query in XQuery as soon as possible, while the input is being read?
 > >
 > > For example, a query like "for $x in /a/* return $x" would
 > > send each element "a" to the output as soon as its closing
 > > tag is encountered by the SAX parser.
 > >   I would like to watch the output stream and capture these
 > > results as soon as they come out.
 > >
 > > By tracing the execution in my custom XMLReader, I noticed
 > > that the whole input file is read before the first element
 > > from the result is sent to the output stream.
 > >
 > > Thanks,
 > >
 > > --
 > > Sylvain Hall?, finissant du doctorat / Ph.D. Candidate
 > >
 > > D?partement d'informatique
 > > Universit? du Qu?bec ? Montr?al
 > > C.P. 8888, Succ. Centre-ville
 > > Montr?al (Qu?bec)
 > > CANADA H3C 3P8
 > >
 > > E-mail: shalle@...
 > > Web:    www.leduotang.com/sylvain
 > > Tel:    +1 (514) 987-4186
 > > Fax:    +1 (514) 987-8477
--
Sylvain Hallé, finissant du doctorat / Ph.D. Candidate

Département d'informatique
Université du Québec à Montréal
C.P. 8888, Succ. Centre-ville
Montréal (Québec)
CANADA H3C 3P8

E-mail: shalle@...
Web:    www.leduotang.com/sylvain
Tel:    +1 (514) 987-4186
Fax:    +1 (514) 987-8477

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: saxon-help Digest, Vol 26, Issue 18

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Thanks.  However, I noticed in the documentation that this
> streaming facility is available for an expression that must
> start with doc() (i.e. it must read a file).  If I set my
> document context to another source (e.g. a character stream
> produced by another part of my code) using the bindDocument()
> method, is there a way to achieve the same result?

You can write a URIResolver that intercepts the call on doc() and returns a
StreamSource. But I don't think it can be made to work with the XQJ
bindDocument() method.

Michael Kay
http://www.saxonica.com/


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help