DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24979>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24979

XPathNSResolver doesn't resolve URI prefix

           Summary: XPathNSResolver doesn't resolve URI prefix
           Product: XalanJ2
           Version: 2.5
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I build a XPathNSResolver exactly like in the javadoc, but it cannot resolve URI
prefix :

String namespace = "http://someuri";;
String prefix = "xyz";
DocumentBuilderFactory docBuilderFactory = new
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document d = docBuilder.newDocument();
Element e = d.createElementNS(namespace, "e");
e.setPrefix(prefix);
System.out.println("e namespace uri is " + e.getNamespaceURI());
System.out.println("e prefix is " + e.getPrefix());
System.out.println("e name is " + e.getNodeName());
d.appendChild(e);
XPathEvaluator evaluator = new XPathEvaluatorImpl(d);
XPathNSResolver nsResolver = evaluator.createNSResolver(e);
System.out.println("via ns resolver uri for prefix " + prefix + " is " +
nsResolver.lookupNamespaceURI(prefix));

produces

e namespace uri is http://someuri
e prefix is xyz
e name is xyz:e
via ns resolver uri for prefix xyz is null

Reply via email to