You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2006/07/01 06:12:36 UTC
svn commit: r418434 - in /xerces/java/trunk/src/org/apache/xerces:
dom/DeferredElementNSImpl.java parsers/AbstractDOMParser.java
Author: mrglavas
Date: Fri Jun 30 21:12:35 2006
New Revision: 418434
URL: http://svn.apache.org/viewvc?rev=418434&view=rev
Log:
Fixing an edge case not covered by the fix for XERCESJ-1123.
Modified:
xerces/java/trunk/src/org/apache/xerces/dom/DeferredElementNSImpl.java
xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java
Modified: xerces/java/trunk/src/org/apache/xerces/dom/DeferredElementNSImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/DeferredElementNSImpl.java?rev=418434&r1=418433&r2=418434&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DeferredElementNSImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DeferredElementNSImpl.java Fri Jun 30 21:12:35 2006
@@ -116,14 +116,16 @@
int attrIndex = ownerDocument.getNodeExtra(fNodeIndex);
if (attrIndex != -1) {
NamedNodeMap attrs = getAttributes();
+ boolean seenSchemaDefault = false;
do {
AttrImpl attr = (AttrImpl) ownerDocument.getNodeObject(attrIndex);
// Take special care of schema defaulted attributes. Calling the
// non-namespace aware setAttributeNode() method could overwrite
// another attribute with the same local name.
- if (!attr.getSpecified() &&
- attr.getNamespaceURI() != null &&
- attr.getName().indexOf(':') < 0) {
+ if (!attr.getSpecified() && (seenSchemaDefault ||
+ (attr.getNamespaceURI() != null &&
+ attr.getName().indexOf(':') < 0))) {
+ seenSchemaDefault = true;
attrs.setNamedItemNS(attr);
}
else {
Modified: xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java?rev=418434&r1=418433&r2=418434&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java Fri Jun 30 21:12:35 2006
@@ -911,6 +911,7 @@
}
Element el = createElementNode (element);
int attrCount = attributes.getLength ();
+ boolean seenSchemaDefault = false;
for (int i = 0; i < attrCount; i++) {
attributes.getName (i, fAttrQName);
Attr attr = createAttrNode (fAttrQName);
@@ -927,8 +928,9 @@
// Take special care of schema defaulted attributes. Calling the
// non-namespace aware setAttributeNode() method could overwrite
// another attribute with the same local name.
- if (!specified && fAttrQName.uri != null && fAttrQName.prefix == null) {
+ if (!specified && (seenSchemaDefault || (fAttrQName.uri != null && fAttrQName.prefix == null))) {
el.setAttributeNodeNS(attr);
+ seenSchemaDefault = true;
}
else {
el.setAttributeNode(attr);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org