Re: Stacktrace when trying to use XPath

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Thursday, September 3, 2009, 6:04:21 PM, Newman, John W wrote:

> Ok, I reluctantly added jaxen 1.1.1 to the classpath and also
> turned on NodeModel.useJaxenXPathSupport() and it is working nicely now.  =)
>  
> I first tried changing the xalan version to 2.7.1 but still no
> luck.  If anyone knows why this is happening and can advise so I can
> get rid of jaxen it would be great.

Out of curiosity, got any problem with Jaxen so you want get rid of
it?

> If not it’s no big deal, I’m just curious as to why it won’t work.
>
> Thanks,
> John
>  
> From: Newman, John W [mailto:[email protected]] 
> Sent: Thursday, September 03, 2009 10:13 AM
> To: FreeMarker-user
> Subject: [FreeMarker-user] Stacktrace when trying to use XPath
>  
> Hello,
>  
> We have instances of org.w3c.dom.Element in the data model.  I can
> use simple expressions like element.Child or element.@ID etc and all
> is working fine.  But if I try to use xpath, i.e.
> element[“count(.//Child[./@flag=1])”] .. I get this stack trace everytime:
>  
> java.lang.RuntimeException: Could not resolve the node to a handle
>   at
> org.apache.xml.dtm.ref.DTMManagerDefault.getDTMHandleFromNode(DTMManagerDefault.java:556)
>   at
> org.apache.xpath.XPathContext.getDTMHandleFromNode(XPathContext.java:154)
>   at
> freemarker.ext.dom.XalanXPathSupport.executeQuery(XalanXPathSupport.java:108)
>   at freemarker.ext.dom.NodeModel.get(NodeModel.java:279) 
>   at freemarker.ext.dom.ElementModel.get(ElementModel.java:130) 
>   at
> freemarker.core.DynamicKeyName.dealWithStringKey(DynamicKeyName.java:136)
>  
> Looking around a bit I’ve seen one other person with this error
> message (not using freemarker), and it was due to the com.sun xalan
> being used.  You can see by the trace that we are using the real
> apache xalan, xalan-2.6.0.jar is on the classpath.  Is that the
> wrong version?  Any ideas what’s happening and how I can fix this so we can use xpath?
>  
> Thanks,
> John
> …

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.