// attributes
setupDefaultAttributes();
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() && (seenSchemaDefault ||
(attr.getNamespaceURI() != null &&
attr.getNamespaceURI() != NamespaceContext.XMLNS_URI &&
attr.getName().indexOf(':') < 0))) {
seenSchemaDefault = true;
attrs.setNamedItemNS(attr);
}
else {
attrs.setNamedItem(attr);
}
attrIndex = ownerDocument.getPrevSibling(attrIndex);
} while (attrIndex != -1);
}