[ http://issues.apache.org/jira/browse/XALANJ-1965?page=all ]
Brian Minchau updated XALANJ-1965:
----------------------------------
Fix Version: 2.7
> NullPointerException when using XPath Expression
> ------------------------------------------------
>
> Key: XALANJ-1965
> URL: http://issues.apache.org/jira/browse/XALANJ-1965
> Project: XalanJ2
> Type: Bug
> Components: XPath-API
> Versions: CurrentCVS
> Environment: Windows 2000. JRE 131. Xalan Java 2.6.0
> Reporter: Yash Talwar
> Fix For: 2.7
>
> The following execption occurs when I run java class:
> -------------------------------------------------------
> java.lang.NullPointerException
> at org.apache.xpath.compiler.OpMap.getStepLocalName(OpMap.java:446)
> at
> org.apache.xpath.axes.WalkerFactory.createDefaultWalker(WalkerFactory.java:1282)
> at org.apache.xpath.axes.WalkerFactory.loadWalkers(WalkerFactory.java:111)
> at org.apache.xpath.axes.WalkingIterator.<init>(WalkingIterator.java:61)
> at
> org.apache.xpath.axes.WalkingIteratorSorted.<init>(WalkingIteratorSorted.java:70)
> at org.apache.xpath.axes.WalkerFactory.newDTMIterator(WalkerFactory.java:281)
> at org.apache.xpath.compiler.Compiler.locationPath(Compiler.java:635)
> at org.apache.xpath.compiler.Compiler.compile(Compiler.java:175)
> at org.apache.xpath.compiler.Compiler.compile(Compiler.java:121)
> at org.apache.xpath.XPath.<init>(XPath.java:170)
> at org.apache.xpath.XPath.<init>(XPath.java:199)
> at TestClass.main(TestClass.java:22)
> Exception in thread "main"
> -------------------------------------------------------
> Java main class:
> -------------------------------------------------------
> import javax.xml.transform.TransformerException;
> import org.apache.xerces.dom.CoreDocumentImpl;
> import org.apache.xerces.dom.DOMInputImpl;
> import org.apache.xerces.parsers.DOMParserImpl;
> import org.apache.xerces.parsers.XML11Configuration;
> import org.apache.xml.utils.PrefixResolver;
> import org.apache.xpath.XPath;
> import org.w3c.dom.Document;
> import org.w3c.dom.ls.LSParser;
> import org.w3c.dom.xpath.XPathEvaluator;
> import org.w3c.dom.xpath.XPathNSResolver;
> public class TestClass
> {
> public static void main(String[] args)
> {
> LSParser parser = new DOMParserImpl(new XML11Configuration());
> Document doc = parser.parse(new DOMInputImpl(null, "input.xml", null));
> XPathEvaluator eval = (XPathEvaluator) ((CoreDocumentImpl)
> doc).getFeature("+XPath", "3.0");
> XPathNSResolver resolver = eval.createNSResolver(doc);
> try
> {
> XPath xpath = new XPath("/namespace::title",null,(PrefixResolver)
> resolver, XPath.SELECT);
> }
> catch (TransformerException e)
> {
> e.printStackTrace();
> }
> }
> }
> -------------------------------------------------------
> input.xml
> -------------------------------------------------------
> <?xml version="1.0"?>
> <book xmlns:pre="http:exmple.com">
> <title xmlns:pre1="hi">Amazing Book</title>
> <author>Good Person</author>
> </book>
> -------------------------------------------------------
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]