Subject: RE: [xsl] question regarding Saxon customized extension and NodeInfo From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Thu, 21 Mar 2002 19:04:36 -0000 |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] question regarding Saxon cust, Yang, Yue [IT] | Thread | [xsl] failure calling extension fun, Leona Slepetis |
Re: [xsl] XML parsers performance, Mike Brown | Date | Re: [xsl] Passing variable number , Oleg Tkachenko |
Month |