|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: question regarding Saxon customized extension and
thanks Michael for the info, actually I got it to work... you are right, now I am creating a document for each line as I go along... yes, it is a bit inefficient... but it is better than having to read the file once then process it once again... especially for extremely large file. Now my program works beautifully... thanks lots > ---------- > From: Michael Kay[SMTP:michael.h.kay@xxxxxxxxxxxx] > Reply To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Sent: Thursday, March 21, 2002 2:04 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: question regarding Saxon customized extension and > NodeInfo > > > I am trying to write a customized Saxon java extension which > > reads a file, > > convert each line into a Node and put into a NodeSet, then > > have stylesheet process the NodeSet. > > > > > What I wanted is to process it just once... so I created a > > customized class > > that implements NodeEnumeration interface... so each call to > > nextElement() > > actually calls the BuffereReader.readLine() until readLine() > > returns null... > > I have everything in place, except I couldn't figure out how > > to create an > > NodeInfo (which is required by > > NodeEnumeration.nextElement()). Basically I > > want to get the one line of text from the file, and somehow > > convert it into > > a NodeInfo.... > > > This question is very Saxon-specific, so it probably should have been > asked > on the Saxon list at http://saxon.sf.net/. > > NodeInfo is an interface, so to create instances of it you will have to > either define an implementation class or choose an existing implementation > class. The existing implementations (tree.NodeImpl, tinytree.NodeImpl, > etc) > all have constructors that assume you are building a tree. In fact, you > almost inevitably need to build a tree in order to support all the axes. > So > I think it's hard to improve on the way you are currently doing it. > > Of course with XPath 2.0 / Saxon 7.0 you don't need to represent this > structure as a tree, you can represent it as a sequence of strings. This > makes it a great deal easier to implement your own iterator class which > returns the lines of the file on demand, because there is now no need to > support all the complexities of the XPath tree model. > > Michael Kay > Software AG > home: Michael.H.Kay@xxxxxxxxxxxx > work: Michael.Kay@xxxxxxxxxxxxxx > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








