Project

Profile

Help

convert xml to Java AbstractNode

Added by Anonymous over 19 years ago

Legacy ID: #2936505 Legacy Poster: pete2f1 (peteot)

Hi, I am trying to upgrade to Saxon 8.2. However, I have come across the following problem: Using saxon 7.5, when performing a xslt transformation I have been able to send part of the xml tree to an external java function where it is interpreted as an AbstractNode. java method: public static String fix(AbstractNode xmlContext){ ........ xslt: <xsl:template match="test"> <xsl:value-of disable-output-escaping="yes" select="sld:fix(.)"/> </xsl:template> However, when using saxon 8.2 I get the following error: Exception in thread "main" java.lang.StackOverflowError at net.sf.saxon.expr.UnaryExpression.<init>(UnaryExpression.java:21) at net.sf.saxon.expr.Atomizer.<init>(Atomizer.java:29) at net.sf.saxon.value.SequenceValue.convertToJava(SequenceValue.java:386) at net.sf.saxon.value.AtomicValue.convertToJava(AtomicValue.java:259) Any help would be greatly appreciated. Thanks, Pete.


Replies (2)

RE: convert xml to Java AbstractNode - Added by Anonymous over 19 years ago

Legacy ID: #2939187 Legacy Poster: Michael Kay (mhkay)

There seems to be a loop here where the code that tries to convert a node to the required Java class doesn't recognize AbstractNode as a permitted class for the required type, so it atomizes the node, and the code for handling atomic values then sees that a node is wanted, and shoves it back to the code for handling nodes. I think if you declare the argument as NodeInfo it should work. This is a much better choice anyway since not all Saxon nodes belong to the class AbstractNode (and the class is not part of the Saxon API, so it's subject to change, and as it happens it will disappear in the next release.) Michael Kay Saxonica Limited

RE: convert xml to Java AbstractNode - Added by Anonymous over 19 years ago

Legacy ID: #2939624 Legacy Poster: pete2f1 (peteot)

Thanks Michael, If I use NodeInfo instead everything works well. I can get what I need by then simply casting NodeInfo to Node. Cheers for the quick reply, Pete.

    (1-2/2)

    Please register to reply