File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes XPathException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XPathException" Watch "XPathException" New topic
Author

XPathException

able lam
Greenhorn

Joined: Feb 13, 2004
Posts: 2
i got the XPathException when passing parameter to Transformer
--- foo.xml ----

---- foo.xsl ----

---- UseStylesheetParam.java ----


I expect "Hello2" will be output, but expection is thrown, how can i solve the problem ??
[ February 13, 2004: Message edited by: able lam ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Could you post the full stack trace of the exception?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
able lam
Greenhorn

Joined: Feb 13, 2004
Posts: 2
i know the problem is the type is not matched,
but i really want to pass '/doc' to $param1

org.apache.xpath.XPathException: Can not convert #STRING to a NodeList!
at org.apache.xpath.objects.XObject.error(XObject.java:740)
at org.apache.xpath.objects.XObject.iter(XObject.java:443)
at org.apache.xpath.Expression.asIterator(Expression.java:288)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(
ElemApplyTemplates.java:245)
at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTempla
tes.java:215)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(
ElemApplyTemplates.java:429)
at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTempla
tes.java:215)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
ansformerImpl.java:2362)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Tran
sformerImpl.java:2228)
at org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme
rImpl.java:1306)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:704)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1222)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1200)
at UseStylesheetParam.main(UseStylesheetParam.java:95)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XPathException