Author: mrglavas
Date: Fri Mar 25 18:49:35 2011
New Revision: 1085512
URL: http://svn.apache.org/viewvc?rev=1085512&view=rev
Log:
Fixing JIRA Issue #1501: http://issues.apache.org/jira/browse/XERCESJ-1501.
Namespace declarations may have been added by namespace fix-up. If the
"namespace-declarations" parameter has been set to false we need to fetch the
AttributeMap again if it contained no attributes prior to namespace fix-up.
Modified:
xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java
Modified: xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java
URL:
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java?rev=1085512&r1=1085511&r2=1085512&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java Fri Mar 25
18:49:35 2011
@@ -345,13 +345,21 @@ public class DOMNormalizer implements XM
// remove default attributes
namespaceFixUp(elem, attributes);
- if ((fConfiguration.features &
DOMConfigurationImpl.NSDECL) == 0 && attributes != null ) {
- for (int i = 0; i < attributes.getLength(); ++i) {
- Attr att = (Attr)attributes.getItem(i);
- if
(XMLSymbols.PREFIX_XMLNS.equals(att.getPrefix()) ||
- XMLSymbols.PREFIX_XMLNS.equals(att.getName()))
{
- elem.removeAttributeNode(att);
- --i;
+ if ((fConfiguration.features &
DOMConfigurationImpl.NSDECL) == 0) {
+ // Namespace declarations may have been added by
namespace fix-up. Need
+ // to fetch the AttributeMap again if it contained no
attributes prior
+ // to namespace fix-up.
+ if (attributes == null) {
+ attributes = (elem.hasAttributes()) ?
(AttributeMap) elem.getAttributes() : null;
+ }
+ if (attributes != null) {
+ for (int i = 0; i < attributes.getLength(); ++i) {
+ Attr att = (Attr)attributes.getItem(i);
+ if
(XMLSymbols.PREFIX_XMLNS.equals(att.getPrefix()) ||
+
XMLSymbols.PREFIX_XMLNS.equals(att.getName())) {
+ elem.removeAttributeNode(att);
+ --i;
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]