com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo

Here are the examples of the java api class com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo taken from open source projects.

1. XMLSchemaValidator#addDefaultAttributes()

Project: openjdk
File: XMLSchemaValidator.java
void addDefaultAttributes(QName element, XMLAttributes attributes, XSAttributeGroupDecl attrGrp) {
    //
    if (DEBUG) {
        System.out.println("==>addDefaultAttributes: " + element);
    }
    XSObjectList attrUses = attrGrp.getAttributeUses();
    int useCount = attrUses.getLength();
    XSAttributeUseImpl currUse;
    XSAttributeDecl currDecl;
    short constType;
    ValidatedInfo defaultValue;
    boolean isSpecified;
    QName attName;
    // for each attribute use
    for (int i = 0; i < useCount; i++) {
        currUse = (XSAttributeUseImpl) attrUses.item(i);
        currDecl = currUse.fAttrDecl;
        // get value constraint
        constType = currUse.fConstraintType;
        defaultValue = currUse.fDefault;
        if (constType == XSConstants.VC_NONE) {
            constType = currDecl.getConstraintType();
            defaultValue = currDecl.fDefault;
        }
        // whether this attribute is specified
        isSpecified = attributes.getValue(currDecl.fTargetNamespace, currDecl.fName) != null;
        // information item's [attributes] as per clause 3.1 above.
        if (currUse.fUse == SchemaSymbols.USE_REQUIRED) {
            if (!isSpecified)
                reportSchemaError("cvc-complex-type.4", new Object[] { element.rawname, currDecl.fName });
        }
        // if the attribute is not specified, then apply the value constraint
        if (!isSpecified && constType != XSConstants.VC_NONE) {
            attName = new QName(null, currDecl.fName, currDecl.fName, currDecl.fTargetNamespace);
            String normalized = (defaultValue != null) ? defaultValue.stringValue() : "";
            int attrIndex;
            if (attributes instanceof XMLAttributesImpl) {
                XMLAttributesImpl attrs = (XMLAttributesImpl) attributes;
                attrIndex = attrs.getLength();
                attrs.addAttributeNS(attName, "CDATA", normalized);
            } else {
                attrIndex = attributes.addAttribute(attName, "CDATA", normalized);
            }
            if (fAugPSVI) {
                // PSVI: attribute is "schema" specified
                Augmentations augs = attributes.getAugmentations(attrIndex);
                AttributePSVImpl attrPSVI = new AttributePSVImpl();
                augs.putItem(Constants.ATTRIBUTE_PSVI, attrPSVI);
                attrPSVI.fDeclaration = currDecl;
                attrPSVI.fTypeDecl = currDecl.fType;
                attrPSVI.fValue.copyFrom(defaultValue);
                attrPSVI.fValidationContext = fValidationRoot;
                attrPSVI.fValidity = AttributePSVI.VALIDITY_VALID;
                attrPSVI.fValidationAttempted = AttributePSVI.VALIDATION_FULL;
                attrPSVI.fSpecified = true;
            }
        }
    }
// for
}