Subject: Re: Moving from LotusXSL to XT
From: keshlam@xxxxxxxxxx
Date: Thu, 16 Dec 1999 09:11:39 -0500
|
Quoth "Philip Puccio" <Philip.Puccio@xxxxxxxx>:
> 2) I use extension functions to call some of my Java code. In one case,
I
> pass a node-set as an argument to a Java method. Within Java (when using
> XT),
> that node-set is an instance of SingleNodeIterator. I send the iterator
> next() to get a Node (actually, an instance of
> XSLProcessorImpl$ElementNodeImpl). Now the challenge: I need to get a
> string
> representation of that Node's XML, tags and all. Using LotusXSL, I was
> getting an org.w3c.dom.NodeList, getting its only Node (an ElementImpl),
> casting it to a TXElement, then sending the TXElement the message
> toXMLString(Writer), implemented by com.ibm.xml.parser.Child.
That's the problem with relying something other than standardized APIs...
The TX DOM is an artifact of the XML4J parser, and is _not_ a portable API.
The approach you've been using may not work reliably with LotusXSL either,
if you run it with a different parser or different DOM class; I believe it
will fail with the version contributed to xml.apache.org's Xalan project,
for example.
The standard DOM does not yet include a mechanism for writing out a
subtree's contents in XML syntax. DOM Level 3 is expected to add such a
function.
Meanwhile, the portable solution is to use a routine which accepts a DOM
node as input and walks the DOM tree, generating XML syntax as it goes.
XML4J comes with an example of this, the DOMWriter sample class; I believe
you could simply borrow that code and invoke the appropriate method as a
subroutine.
______________________________________
Joe Kesselman / IBM Research
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|