Subject: RE: [xsl] question regarding Saxon customized extension and NodeI nfo From: "Yang, Yue [IT]" <yue.yang@xxxxxxxx> Date: Thu, 21 Mar 2002 16:14:03 -0500 |
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: [xsl] 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Capitalizing only the fir, Dimitre Novatchev | Thread | RE: [xsl] question regarding Saxon , Michael Kay |
[xsl] Re: Capitalizing only the fir, Dimitre Novatchev | Date | RE: [xsl] question regarding Saxon , Michael Kay |
Month |