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=24672>. 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=24672 Possible bug in Node.lookupPrefix(...) Summary: Possible bug in Node.lookupPrefix(...) Product: Xerces2-J Version: 2.5.0 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: DOM AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Node.lookupPrefix(namespaceURI) is supposed to look up the prefix associated to the given namespace URI, starting from this node[1]. However lookupPrefix invoked on newly created element or attribute nodes appears to return null. See the test below Test.java ========= import java.io.ByteArrayInputStream; import org.w3c.dom.*; import javax.xml.parsers.*; public class Test { public void testLookupPrefix() { String data = "<?xml version=\"1.0\"?> " + "<!DOCTYPE root [" + " <!ELEMENT root (#PCDATA)>" + " <!ENTITY ent 'blah'>" + "]>" + "<root>&ent;</root>"; Document doc; Node replaced; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance (); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse(new ByteArrayInputStream(data.getBytes ())); Element elem = doc.createElementNS ("http://www.w3.org/DOM", "dom3:Text"); String prefix = elem.lookupPrefix ("http://www.w3.org/DOM/Test"); System.out.println("EXPECTED OUTPUT: dom3, ACTUAL OUTPUT: " + prefix); Attr attr = doc.createAttributeNS ("http://www.w3.org/DOM/Test", "dom3:parent"); elem.setAttributeNodeNS(attr); prefix = attr.lookupPrefix("http://www.w3.org/DOM/Test"); System.out.println("EXPECTED OUTPUT: dom3, ACTUAL OUTPUT: " + prefix); } catch (Exception e ) { System.err.println ("Exception: " + e.getMessage()); e.printStackTrace(); } } public static void main(String[] args) { Test test = new Test(); test.testLookupPrefix(); } } http://www.w3.org/TR/2003/CR-DOM-Level-3-Core-20031107/core.html#Node3- lookupNamespacePrefix --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
