You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Jason Harrop <ja...@xn.com.au> on 2001/05/28 19:30:23 UTC
Extensions: getAttributeNode fails
Hi
I'm passing a NodeList to an extension like this:
<xsl:variable name="notesNode" select="Notes"/>
<xsl:value-of select="java:X_RenderNotesInBrowser.get($notesNode)"/>
The signature of the method in my extension is this:
public static String get( NodeList nList )
And I know it is receiving the nodelist, because i can do
nList.item(0).getNodeName()
However, there seems to be something wrong with the nodes I'm getting
because an error is thrown from
org.apache.xml.utils.UnImplNode.getAttributeNode when i cast them to
Element and try getAttributeNode(). PLs see stacktrace below.
Any ideas what might be wrong? I get the same behaviour in Xalan 2.1 and
earlier 2.x.
thanks
Jason
----------------
java.lang.RuntimeException: Function not supported!
at org.apache.xml.utils.UnImplNode.error(UnImplNode.java:87)
at org.apache.xml.utils.UnImplNode.getAttributeNode(UnImplNode.java:378)
at com.us.NoteImpl.<init>(NoteImpl.java:57)
at com.us.Notes.<init>(Notes.java:44)
at X_RenderNotesInBrowser.get(X_RenderNotesInBrowser.java:23)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:334)
at
org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:253)
at
org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:141)
at org.apache.xpath.XPath.execute(XPath.java:260)
at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:251)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2251)
at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:166)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2251)
at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:637)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2251)
at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:637)
Re: Extensions: getAttributeNode fails
Posted by Gary L Peskin <ga...@firstech.com>.
Plus, stree is going away with the new DTM implementation so it's
probably not worth the work.
Gary
Jason Harrop wrote:
>
> Yes, thanks Gary, you are quite right, my Java code is receiving stree's
> ElemImpl. I ended up doing what i needed to do with vanilla XSL -
> although its not as neat. Going through my classes and converting
> everything to the subset of DOM calls which stree supports doesn't
> thrill me at all! cheers, Jason
>
> Gary L Peskin wrote:
>
> > It sounds like the DOM implementation that you're using (probably stree)
> > just does not support the getAttributeNode(..) call. The stree DOM
> > implementation was designed to support XSLT and was not intended as a
> > full DOM implementation so it does not support all of the DOM calls.
> >
> > It does support getAttribute(...) which might get you what you need.
> >
> > Have a look at the class of nList.item(0) to see what DOM implementation
> > you're using.
> >
> > HTH,
> > Gary
Re: Extensions: getAttributeNode fails
Posted by Jason Harrop <ja...@xn.com.au>.
Yes, thanks Gary, you are quite right, my Java code is receiving stree's
ElemImpl. I ended up doing what i needed to do with vanilla XSL -
although its not as neat. Going through my classes and converting
everything to the subset of DOM calls which stree supports doesn't
thrill me at all! cheers, Jason
Gary L Peskin wrote:
> It sounds like the DOM implementation that you're using (probably stree)
> just does not support the getAttributeNode(..) call. The stree DOM
> implementation was designed to support XSLT and was not intended as a
> full DOM implementation so it does not support all of the DOM calls.
>
> It does support getAttribute(...) which might get you what you need.
>
> Have a look at the class of nList.item(0) to see what DOM implementation
> you're using.
>
> HTH,
> Gary
Re: Extensions: getAttributeNode fails
Posted by Gary L Peskin <ga...@firstech.com>.
It sounds like the DOM implementation that you're using (probably stree)
just does not support the getAttributeNode(..) call. The stree DOM
implementation was designed to support XSLT and was not intended as a
full DOM implementation so it does not support all of the DOM calls.
It does support getAttribute(...) which might get you what you need.
Have a look at the class of nList.item(0) to see what DOM implementation
you're using.
HTH,
Gary
Jason Harrop wrote:
>
> Hi
>
> I'm passing a NodeList to an extension like this:
>
> <xsl:variable name="notesNode" select="Notes"/>
> <xsl:value-of select="java:X_RenderNotesInBrowser.get($notesNode)"/>
>
> The signature of the method in my extension is this:
>
> public static String get( NodeList nList )
>
> And I know it is receiving the nodelist, because i can do
> nList.item(0).getNodeName()
>
> However, there seems to be something wrong with the nodes I'm getting
> because an error is thrown from
> org.apache.xml.utils.UnImplNode.getAttributeNode when i cast them to
> Element and try getAttributeNode(). PLs see stacktrace below.
>
> Any ideas what might be wrong? I get the same behaviour in Xalan 2.1 and
> earlier 2.x.
>
> thanks
>
> Jason
>
> ----------------
>
> java.lang.RuntimeException: Function not supported!
> at org.apache.xml.utils.UnImplNode.error(UnImplNode.java:87)
> at org.apache.xml.utils.UnImplNode.getAttributeNode(UnImplNode.java:378)
> at com.us.NoteImpl.<init>(NoteImpl.java:57)
> at com.us.Notes.<init>(Notes.java:44)
> at X_RenderNotesInBrowser.get(X_RenderNotesInBrowser.java:23)
> at java.lang.reflect.Method.invoke(Native Method)
> at
> org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:334)
> at
> org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:253)
> at
> org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:141)
> at org.apache.xpath.XPath.execute(XPath.java:260)
> at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:251)
> at
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2251)
> at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:166)
> at
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2251)
> at
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:637)
> at
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2251)
> at
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:637)