xsattributegroupdecl.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 400 行 · 第 1/2 页

JAVA
400
字号
                    	                     attrUse.fUse == SchemaSymbols.USE_OPTIONAL ? SchemaSymbols.ATTVAL_OPTIONAL : SchemaSymbols.ATTVAL_PROHIBITED,                                             "derivation-ok-restriction.2.1.1"};                    return errorArgs;                }                // if this attribute is prohibited in the derived type, don't                // need to check any of the following constraints.                if (attrUse.fUse == SchemaSymbols.USE_PROHIBITED) {                    continue;                }                baseAttrDecl = baseAttrUse.fAttrDecl;                //                // derivation-ok-restriction.  Constraint 2.1.1                //                if (! XSConstraints.checkSimpleDerivationOk(attrDecl.fType,                                                            baseAttrDecl.fType,                                                            baseAttrDecl.fType.getFinal()) ) {					errorArgs = new Object[]{typeName, attrDecl.fName, attrDecl.fType.getName(),						                     baseAttrDecl.fType.getName(), "derivation-ok-restriction.2.1.2"};					return errorArgs;                }                //                // derivation-ok-restriction.  Constraint 2.1.3                //                int baseConsType=baseAttrUse.fConstraintType!=XSConstants.VC_NONE?                                 baseAttrUse.fConstraintType:baseAttrDecl.getConstraintType();                int thisConstType = attrUse.fConstraintType!=XSConstants.VC_NONE?                                    attrUse.fConstraintType:attrDecl.getConstraintType();                if (baseConsType == XSConstants.VC_FIXED) {                    if (thisConstType != XSConstants.VC_FIXED) {						errorArgs = new Object[]{typeName, attrDecl.fName,												 "derivation-ok-restriction.2.1.3.a"};						return errorArgs;                    } else {                        // check the values are the same.                        ValidatedInfo baseFixedValue=(baseAttrUse.fDefault!=null ?                                                      baseAttrUse.fDefault: baseAttrDecl.fDefault);                        ValidatedInfo thisFixedValue=(attrUse.fDefault!=null ?                                                      attrUse.fDefault: attrDecl.fDefault);                        if (!baseFixedValue.actualValue.equals(thisFixedValue.actualValue)) {							errorArgs = new Object[]{typeName, attrDecl.fName, thisFixedValue.stringValue(),													 baseFixedValue.stringValue(), "derivation-ok-restriction.2.1.3.b"};							return errorArgs;                        }                    }                }            } else {                // No matching attribute in base - there should be a matching wildcard                //                // derivation-ok-restriction.  Constraint 2.2                //                if (baseGroup.fAttributeWC == null) {					errorArgs = new Object[]{typeName, attrDecl.fName,											 "derivation-ok-restriction.2.2.a"};					return errorArgs;                }                else if (!baseGroup.fAttributeWC.allowNamespace(attrDecl.fTargetNamespace)) {					errorArgs = new Object[]{typeName, attrDecl.fName,                                             attrDecl.fTargetNamespace==null?"":attrDecl.fTargetNamespace,											 "derivation-ok-restriction.2.2.b"};					return errorArgs;                }            }        }        //        // Check that any REQUIRED attributes in the base have matching attributes        // in this group        // derivation-ok-restriction.  Constraint 3        //        for (int i=0; i<baseGroup.fAttrUseNum; i++) {            baseAttrUse = baseGroup.fAttributeUses[i];            if (baseAttrUse.fUse == SchemaSymbols.USE_REQUIRED) {                baseAttrDecl = baseAttrUse.fAttrDecl;                // Look for a match in this group                if (getAttributeUse(baseAttrDecl.fTargetNamespace,baseAttrDecl.fName) == null) {					errorArgs = new Object[]{typeName, baseAttrUse.fAttrDecl.fName,											 "derivation-ok-restriction.3"};					return errorArgs;                }            }        }        // Now, check wildcards        //        // derivation-ok-restriction.  Constraint 4        //        if (fAttributeWC != null) {            if (baseGroup.fAttributeWC == null) {				errorArgs = new Object[]{typeName, "derivation-ok-restriction.4.1"};				return errorArgs;            }            if (! fAttributeWC.isSubsetOf(baseGroup.fAttributeWC)) {				errorArgs = new Object[]{typeName, "derivation-ok-restriction.4.2"};				return errorArgs;            }            if (fAttributeWC.weakerProcessContents(baseGroup.fAttributeWC)) {				errorArgs = new Object[]{typeName,										 fAttributeWC.getProcessContentsAsString(),										 baseGroup.fAttributeWC.getProcessContentsAsString(),										 "derivation-ok-restriction.4.3"};				return errorArgs;            }        }        return null;    }    static final XSAttributeUseImpl[] resize(XSAttributeUseImpl[] oldArray, int newSize) {        XSAttributeUseImpl[] newArray = new XSAttributeUseImpl[newSize];        System.arraycopy(oldArray, 0, newArray, 0, Math.min(oldArray.length, newSize));        return newArray;    }    // reset the attribute group declaration    public void reset(){        fName = null;        fTargetNamespace = null;        // reset attribute uses        for (int i=0;i<fAttrUseNum;i++) {            fAttributeUses[i] = null;        }         fAttrUseNum = 0;        fAttributeWC = null;        fAnnotation = null;        fIDAttrName = null;    }    /**     * Get the type of the object, i.e ELEMENT_DECLARATION.     */    public short getType() {        return XSConstants.ATTRIBUTE_GROUP;    }    /**     * The <code>name</code> of this <code>XSObject</code> depending on the     * <code>XSObject</code> type.     */    public String getName() {        return fName;    }    /**     * The namespace URI of this node, or <code>null</code> if it is     * unspecified.  defines how a namespace URI is attached to schema     * components.     */    public String getNamespace() {        return fTargetNamespace;    }    /**     * {attribute uses} A set of attribute uses.     */    public XSObjectList getAttributeUses() {        if (fAttrUses == null){            fAttrUses = new XSObjectListImpl(fAttributeUses, fAttrUseNum);        }        return fAttrUses;    }    /**     * {attribute wildcard} Optional. A wildcard.     */    public XSWildcard getAttributeWildcard() {        return fAttributeWC;    }    /**     * Optional. Annotation.     */    public XSAnnotation getAnnotation() {        return fAnnotation;    }    	/**	 * @see com.sun.org.apache.xerces.internal.xs.XSObject#getNamespaceItem()	 */	public XSNamespaceItem getNamespaceItem() {        //REVISIT: implement		return null;	}} // class XSAttributeGroupDecl

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?