本文整理汇总了Java中com.sun.org.apache.xerces.internal.xs.XSObjectList.item方法的典型用法代码示例。如果您正苦于以下问题:Java XSObjectList.item方法的具体用法?Java XSObjectList.item怎么用?Java XSObjectList.item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xerces.internal.xs.XSObjectList
的用法示例。
在下文中一共展示了XSObjectList.item方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isDerivedByUnion
import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
/**
* Checks if a type is derived from another by union. See:
* http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
*
* @param ancestorNS
* The namspace of the ancestor type declaration
* @param ancestorName
* The name of the ancestor type declaration
* @param type
* The reference type definition
*
* @return boolean True if the type is derived by union for the reference type
*/
private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) {
// If the variety is union
if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) {
// get member types
XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes();
for (int i = 0; i < memberTypes.getLength(); i++) {
// One of the {member type definitions} is T2.
if (memberTypes.item(i) != null) {
// T2 is derived from the other type definition by DERIVATION_RESTRICTION
if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) {
return true;
}
}
}
}
return false;
}
示例2: checkSimpleDerivation
import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
/**
* Note: this will be a private method, and it assumes that derived is not
* anySimpleType, and base is not anyType. Another method will be
* introduced for public use, which will call this method.
*/
private static boolean checkSimpleDerivation(XSSimpleType derived, XSSimpleType base, short block) {
// 1 They are the same type definition.
if (derived == base)
return true;
// 2 All of the following must be true:
// 2.1 restriction is not in the subset, or in the {final} of its own {base type definition};
if ((block & XSConstants.DERIVATION_RESTRICTION) != 0 ||
(derived.getBaseType().getFinal() & XSConstants.DERIVATION_RESTRICTION) != 0) {
return false;
}
// 2.2 One of the following must be true:
// 2.2.1 D's base type definition is B.
XSSimpleType directBase = (XSSimpleType)derived.getBaseType();
if (directBase == base)
return true;
// 2.2.2 D's base type definition is not the simple ur-type definition and is validly derived from B given the subset, as defined by this constraint.
if (directBase != SchemaGrammar.fAnySimpleType &&
checkSimpleDerivation(directBase, base, block)) {
return true;
}
// 2.2.3 D's {variety} is list or union and B is the simple ur-type definition.
if ((derived.getVariety() == XSSimpleType.VARIETY_LIST ||
derived.getVariety() == XSSimpleType.VARIETY_UNION) &&
base == SchemaGrammar.fAnySimpleType) {
return true;
}
// 2.2.4 B's {variety} is union and D is validly derived from a type definition in B's {member type definitions} given the subset, as defined by this constraint.
if (base.getVariety() == XSSimpleType.VARIETY_UNION) {
XSObjectList subUnionMemberDV = base.getMemberTypes();
int subUnionSize = subUnionMemberDV.getLength();
for (int i=0; i<subUnionSize; i++) {
base = (XSSimpleType)subUnionMemberDV.item(i);
if (checkSimpleDerivation(derived, base, block))
return true;
}
}
return false;
}
示例3: addDefaultAttributes
import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
void addDefaultAttributes(
QName element,
XMLAttributes attributes,
XSAttributeGroupDecl attrGrp) {
// Check after all specified attrs are scanned
// (1) report error for REQUIRED attrs that are missing (V_TAGc)
// REVISIT: should we check prohibited attributes?
// (2) report error for PROHIBITED attrs that are present (V_TAGc)
// (3) add default attrs (FIXED and NOT_FIXED)
//
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;
// Element Locally Valid (Complex Type)
// 4 The {attribute declaration} of each attribute use in the {attribute uses} whose
// {required} is true matches one of the attribute information items in the element
// 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
}