Extensions in Java and null pointers
Hi!
I had to code an extension function in Java. The following is a basic example. Let's say:
myURI:getContent(node) which returns the text content of a node or null if it's an empty node.
In my code, I try the following:
<xsl:variable name="myContent">
<xsl:if test="myURI:getContent(//someNode) = 'US'">true</xsl:if>
</xsl:variable>
And it works.
But the following crashes:
<xsl:variable name="myContent" select="myURI:getContent(//someNode)"/>
The latter throws a NullPointerException.
From what I understand, extensions should never return null values but an empty String. Am I right?
Thanks for your time,
RushMan
__________________
Dijkstra's law on Programming and Inertia:
If you don't know what your program is supposed to do, don't try to write it.
Last edited by rushman; November 3rd, 2009 at 12:20 PM..
|