final NamedNodeMap attrMap = currentElement.getAttributes();
final int oldLength = attrMap.getLength();
// If it's a Xerces DOM store type information for attributes, set idness, etc..
if (fDocumentImpl != null) {
AttrImpl attr;
for (int i = 0; i < oldLength; ++i) {
attr = (AttrImpl) attrMap.item(i);
// write type information to this attribute
AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI);
if (attrPSVI != null) {
if (processAttributePSVI(attr, attrPSVI)) {
((ElementImpl) currentElement).setIdAttributeNode (attr, true);
}
}
}
}
final int newLength = attributes.getLength();
// Add default/fixed attributes
if (newLength > oldLength) {
if (fDocumentImpl == null) {
for (int i = oldLength; i < newLength; ++i) {
attributes.getName(i, fAttributeQName);
currentElement.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i));
}
}
// If it's a Xerces DOM store type information for attributes, set idness, etc..
else {
for (int i = oldLength; i < newLength; ++i) {
attributes.getName(i, fAttributeQName);
AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri,
fAttributeQName.rawname, fAttributeQName.localpart);
attr.setValue(attributes.getValue(i));
// write type information to this attribute
AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI);
if (attrPSVI != null) {
if (processAttributePSVI(attr, attrPSVI)) {
((ElementImpl) currentElement).setIdAttributeNode (attr, true);
}
}
attr.setSpecified(false);
currentElement.setAttributeNodeNS(attr);
}
}
}
}