String attrValue = attributes.getValue(i);
// REVISIT: consider moving this code to the XML Schema validator.
// When PSVI and XML Schema component interfaces are finalized
// remove dependancy on *Impl class.
AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);
if (fStorePSVI && attrPSVI != null) {
((PSVIAttrNSImpl)attr).setPSVI(attrPSVI);
}
if (fNormalizeData) {
// If validation is not attempted, the SchemaNormalizedValue will be null.
// We shouldn't take the normalized value in this case.
if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
attrValue = attrPSVI.getSchemaNormalizedValue();
}
}
attr.setValue(attrValue);
el.setAttributeNode(attr);
// NOTE: The specified value MUST be set after you set
// the node value because that turns the "specified"
// flag to "true" which may overwrite a "false"
// value from the attribute list. -Ac
if (fDocumentImpl != null) {
AttrImpl attrImpl = (AttrImpl)attr;
boolean specified = attributes.isSpecified(i);
attrImpl.setSpecified(specified);
// Identifier registration
// REVISIT: try to retrieve XML Schema attribute declaration
// we should try to modify psvi API to allows to
// check if id type
XSAttributeDeclaration xsDecl = (XSAttributeDeclaration)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
if (attributes.getType(i).equals("ID") ||
(xsDecl !=null && ((XSSimpleType)xsDecl.getTypeDefinition()).isIDType())) {
((ElementImpl) el).setIdAttributeNode(attr);
}
}
// REVISIT: Handle entities in attribute value.
}
setCharacterData(false);
// filter nodes
if (fDOMFilter != null) {
short code = fDOMFilter.startElement(el);
switch (code) {
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of the document was interrupted.");
}
case DOMBuilderFilter.FILTER_REJECT:{
fFilterReject = true;
fRejectedElement.setValues(element);
return;
}
case DOMBuilderFilter.FILTER_SKIP: {
fSkippedElemStack.push(element);
return;
}
default: {
}
}
}
fCurrentNode.appendChild(el);
fCurrentNode = el;
}
else {
int el =
fDeferredDocumentImpl.createDeferredElement(fNamespaceAware ?
element.uri : null,
element.rawname);
int attrCount = attributes.getLength();
for (int i = 0; i < attrCount; i++) {
String attrValue = attributes.getValue(i);
// REVISIT: consider moving this code to the XML Schema validator.
// When PSVI and XML Schema component interfaces are finalized
// remove dependancy on *Impl class.
AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);
if (fNormalizeData) {
// If validation is not attempted, the SchemaNormalizedValue will be null.
// We shouldn't take the normalized value in this case.
if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
attrValue = attrPSVI.getSchemaNormalizedValue();
}
}
int attr = fDeferredDocumentImpl.setDeferredAttribute(el,
attributes.getQName(i),
attributes.getURI(i),
attrValue,
attributes.isSpecified(i));
// identifier registration
// REVISIT: try to retrieve XML Schema attribute declaration
// we should try to modify psvi API to allows to
// check if id type
XSAttributeDeclaration xsDecl = (XSAttributeDeclaration)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
if (attributes.getType(i).equals("ID") ||
(xsDecl !=null && ((XSSimpleType)xsDecl.getTypeDefinition()).isIDType())) {
fDeferredDocumentImpl.setIdAttributeNode(el, attr);
}