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=15140>. 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=15140 DOMBuilder sets wrong namespace for xmlns:* attributes Summary: DOMBuilder sets wrong namespace for xmlns:* attributes Product: XalanJ2 Version: 2.4 Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: org.apache.xml.utils AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] SAX states that the namespace for an xmlns:* attribute should be "", however DOM states it should be "http://www.w3.org/2000/xmlns/". org.apache.xml.utils.DOMBuilder fails to convert the namespace for these attributes, causing the following program to throw an exception: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces. at org.apache.xml.utils.DOMBuilder.startElement(DOMBuilder.java:351) at org.apache.xalan.transformer.TransformerIdentityImpl.startElement (TransformerIdentityImpl.java:1020) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement (Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement (Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootEle mentHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher .dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument (Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at XalanTest.main(XalanTest.java:29) Exception in thread "main" import javax.xml.parsers.*; import javax.xml.transform.sax.*; import javax.xml.transform.dom.*; import javax.xml.transform.*; import org.xml.sax.*; import java.io.*; public class XalanTest { public static void main(String[] args) throws Exception { String testString = "<doc xmlns:a=\"http://www.test.com\"/>"; SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setFeature("http://xml.org/sax/features/namespaces", true); reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); DOMResult domResult = new DOMResult(); SAXTransformerFactory transformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance(); TransformerHandler handler = transformerFactory.newTransformerHandler(); handler.setResult(domResult); reader.setContentHandler(handler); InputSource input = new InputSource(new StringReader(testString)); reader.parse(input); } }
