PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL BE LOST SOMEWHERE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3327 *** shadow/3327 Tue Aug 28 19:30:09 2001 --- shadow/3327.tmp.19958 Tue Aug 28 19:30:09 2001 *************** *** 0 **** --- 1,64 ---- + +============================================================================+ + | SerializerToXML should handle startPrefixMapping event | + +----------------------------------------------------------------------------+ + | Bug #: 3327 Product: XalanJ2 | + | Status: NEW Version: 2.1.0 | + | Resolution: Platform: All | + | Severity: Normal OS/Version: All | + | Priority: Other Component: org.apache.xalan.serial | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + Admittedly similar to case# 1187, I attempt to raise this issue. + + It would be better to make SerializerToXML be sensitive to + startPrefixMapping event thereby inserting namespace declaration + attribute during serialization. + + There are a lot of programs which emit SAX event in the default + mode in which http://xml.org/sax/features/namespace-prefixes is + false. So supporting startPrefixMapping is just wise. + + The following is the proposed change. + + startPrefixMapping method should look like: + + public void startPrefixMapping(String prefix, String uri) + throws org.xml.sax.SAXException + { + if (prefixMappings == null) + prefixMappings = new Hashtable(); + + prefixMappings.put(prefix, uri); + } + + + Then in startElement method before attributes are processed: + + // start additional code here. + if (prefixMappings != null && prefixMappings.size() > 0) + { + int i; + Object[] prefixSet = prefixMappings.keySet().toArray(); + for (i = 0 ; i < prefixSet.length; i++) + { + String prefix = (String)prefixSet[i]; + String declName = "xmlns:" + prefix; + if (atts.getValue(declName) == null) + processAttribute(declName, (String)prefixMappings.get(prefix)); + } + + prefixMappings.clear(); + } + // end additional code here. + + for (int i = 0; i < nAttrs; i++) + { + processAttribute(atts.getQName(i), atts.getValue(i)); + } + + -taki
