[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: question regarding Saxon customized extension and

Subject: RE: question regarding Saxon customized extension and NodeInfo
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 21 Mar 2002 19:04:36 -0000
saxon extension iterator
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.