You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Oliver, Steve" <St...@bestwestern.com> on 2002/12/20 00:43:50 UTC

SimpleXPathAPI Input

I'm just getting started with Xalan. I've built the sample programs and am experimenting with them to get started. In the SimpleXPathAPI sample, is there a way to use a memory buffer rather than a file as my input source?

Thanks,

Steve  

Re: SimpleXPathAPI Input

Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.



If you're using Xalan-C, you can use C++ IOStreams.  See the
StreamTransform sample for more information about how you can create an
XSLTInputSource with a std::istream instance.

You could also use the Xerces class MemBufInputSource.

Dave



                                                                                                                                             
                      "Oliver, Steve"                                                                                                        
                      <Steve.Oliver@bestw         To:      <xa...@xml.apache.org>                                                        
                      estern.com>                 cc:      (bcc: David N Bertoni/Cambridge/IBM)                                              
                                                  Subject: SimpleXPathAPI Input                                                              
                      12/19/2002 03:43 PM                                                                                                    
                      Please respond to                                                                                                      
                      xalan-dev                                                                                                              
                                                                                                                                             



I'm just getting started with Xalan. I've built the sample programs and am
experimenting with them to get started. In the SimpleXPathAPI sample, is
there a way to use a memory buffer rather than a file as my input source?

Thanks,

Steve



Re: SimpleXPathAPI Input

Posted by Joseph Kesselman <ke...@us.ibm.com>.
>is there a way to use a memory buffer rather than a file as my input 
source?

Assuming you mean a buffer that containx the XML text to be searched, and 
that you're working with Xalan-J: create a reader that pulls data from 
your buffer, then wrap a StreamSource around that. The sample programs 
that come with Xalan-J demonstrate doiing this for a stylesheet; the same 
solution should work for the XPath API.

(Alternatively, of course, you can parse the text into a DOM tree or SAX 
stream yourself, then pass us a DOMSource or SAXSource.)

______________________________________
Joe Kesselman  / IBM Research