[xsl] question regarding Saxon customized extension and NodeInfo

Subject: [xsl] question regarding Saxon customized extension and NodeInfo
From: "Yang, Yue [IT]" <yue.yang@xxxxxxxx>
Date: Thu, 21 Mar 2002 12:26:19 -0500
hi,
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.

While working with Saxon, first of all, I am quite very amazed by its speed,
efficiency and intuitive implementation, kudo and thanks to Mr. Kay!....
anyway, my question, in my code i have:

while(null!=(value=br.readLine()))
{
	builder.startElement(eName, emptyAtts, namespaces, 1);

	builder.characters(value.toCharArray(), 0, value.length());

	builder.endElement(eName);
}

where br is the BufferedReader.  Here I actually process the input twice,
once to read each line from the file and convert it into element in builder,
then once more in the stylesheet which iterates thru the NodeEnumeration.

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.... 

so, if the text reads: "blahblahblahblahblahblah", then it would become
"<line>blahblahblahblahblahblah</line>".  Like in JDOM, you can create an
Element, and in Xalan, you have createTextNode(string)... etc...

hope this is not too confusing... appreciate it if anyone can help.

thanks again!!!


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread