[ https://issues.apache.org/jira/browse/XALANJ-2361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470637 ]
Brian Minchau commented on XALANJ-2361: --------------------------------------- I Santiago pointed out prefixes starting with "xml" should not be used, however that is not the same as "must not" and it looks to me like the serializer code in NamespaceMappings is too heavy handed on this. Per the discussion at the Xalan-J triage on February 5, 2007 this is considered a legitimate defect and I will be taking this one. Due to this code being run on every prefix it needs to perform well, so rather than just taking Guillaume's suggestion I'll have to consider other potential fixes that are uglier and faster. Also there may be other spots in the code that are related. - Brian > DOM to stream conversion fails on prefix beginning like "xmlConfiguration" > -------------------------------------------------------------------------- > > Key: XALANJ-2361 > URL: https://issues.apache.org/jira/browse/XALANJ-2361 > Project: XalanJ2 > Issue Type: Bug > Components: Serialization > Affects Versions: 2.7 > Reporter: Guillaume Nodet > Assigned To: Brian Minchau > Priority: Critical > Attachments: XALANJ-2361.patch > > > Here is a simple test case to reproduce the problem: > {{code}} > DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); > dbf.setNamespaceAware(true); > TransformerFactory tf = TransformerFactory.newInstance(); > > String src = "<root><xmlConfiguration:xmlConfiguration > xmlns:xmlConfiguration=\"urn:configuration\" /></root>"; > Document doc = dbf.newDocumentBuilder().parse(new > ByteArrayInputStream(src.getBytes())); > ByteArrayOutputStream res = new ByteArrayOutputStream(); > tf.newTransformer().transform(new DOMSource(doc), new > StreamResult(res)); > System.out.println(res); > dbf.newDocumentBuilder().parse(new > ByteArrayInputStream(res.toByteArray())); > {{code}} > The last line throws an exception, because the xmlns:xmlConfiguration > attribute has been lost. > While debugging, I found that the problem comes from > http://svn.apache.org/repos/asf/xalan/java/trunk/src/org/apache/xml/serializer/NamespaceMappings.java, > line 228: > {{code}} > // Prefixes "xml" and "xmlns" cannot be redefined > if (prefix.startsWith(XML_PREFIX)) > { > return false; > } > {{code}} > It seems this test is wrong, and it should be > {{code}} > // Prefixes "xml" and "xmlns" cannot be redefined > if (prefix.equals("xml") || prefix.equals("xmlns") > { > return false; > } > {{code}} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]