Java源码示例:com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType
示例1
private void setNumeric(){
if(fVariety == VARIETY_ATOMIC){
this.fNumeric = fBase.fNumeric;
}
else if(fVariety == VARIETY_LIST){
this.fNumeric = false;
}
else if(fVariety == VARIETY_UNION){
XSSimpleType[] memberTypes = fMemberTypes;
for(int i = 0 ; i < memberTypes.length ; i++){
if(!memberTypes[i].getNumeric() ){
this.fNumeric = false;
return;
}
}
this.fNumeric = true;
}
}
示例2
/**
* check whether simple type derived is valid derived from base,
* given a subset of {restriction, extension}.
*/
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
// if derived is anySimpleType, then it's valid only if the base
// is ur-type
if (derived == SchemaGrammar.fAnySimpleType) {
return (base == SchemaGrammar.fAnyType ||
base == SchemaGrammar.fAnySimpleType);
}
// if base is complex type
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
if (base == SchemaGrammar.fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
}
return checkSimpleDerivation((XSSimpleType)derived,
(XSSimpleType)base, block);
}
示例3
/** Returns whether the given attribute is an ID type. **/
private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) {
if (fStorePSVI) {
((PSVIAttrNSImpl) attr).setPSVI (attrPSVI);
}
Object type = attrPSVI.getMemberTypeDefinition ();
if (type == null) {
type = attrPSVI.getTypeDefinition ();
if (type != null) {
attr.setType(type);
return ((XSSimpleType) type).isIDType();
}
}
else {
attr.setType(type);
return ((XSSimpleType) type).isIDType();
}
return false;
}
示例4
private boolean containsQName(XSSimpleType type) {
if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
short primitive = type.getPrimitiveKind();
return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
primitive == XSSimpleType.PRIMITIVE_NOTATION);
}
else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
return containsQName((XSSimpleType)type.getItemType());
}
else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
XSObjectList members = type.getMemberTypes();
for (int i = 0; i < members.getLength(); i++) {
if (containsQName((XSSimpleType)members.item(i)))
return true;
}
}
return false;
}
示例5
private boolean containsQName(XSSimpleType type) {
if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
short primitive = type.getPrimitiveKind();
return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
primitive == XSSimpleType.PRIMITIVE_NOTATION);
}
else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
return containsQName((XSSimpleType)type.getItemType());
}
else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
XSObjectList members = type.getMemberTypes();
for (int i = 0; i < members.getLength(); i++) {
if (containsQName((XSSimpleType)members.item(i)))
return true;
}
}
return false;
}
示例6
public void setValues(String name, String targetNamespace,
XSTypeDefinition baseType, short derivedBy, short schemaFinal,
short block, short contentType,
boolean isAbstract, XSAttributeGroupDecl attrGrp,
XSSimpleType simpleType, XSParticleDecl particle,
XSObjectListImpl annotations) {
fTargetNamespace = targetNamespace;
fBaseType = baseType;
fDerivedBy = derivedBy;
fFinal = schemaFinal;
fBlock = block;
fContentType = contentType;
if(isAbstract)
fMiscFlags |= CT_IS_ABSTRACT;
fAttrGrp = attrGrp;
fXSSimpleType = simpleType;
fParticle = particle;
fAnnotations = annotations;
}
示例7
static void createBuiltInTypes() {
final String ANYATOMICTYPE = "anyAtomicType";
final String DURATION = "duration";
final String YEARMONTHDURATION = "yearMonthDuration";
final String DAYTIMEDURATION = "dayTimeDuration";
createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType);
// add anyAtomicType
fBuiltInTypes.put(ANYATOMICTYPE, XSSimpleTypeDecl.fAnyAtomicType);
// add 2 duration types
XSSimpleTypeDecl durationDV = (XSSimpleTypeDecl)fBuiltInTypes.get(DURATION);
fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(durationDV, YEARMONTHDURATION, XSSimpleTypeDecl.DV_YEARMONTHDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.YEARMONTHDURATION_DT));
fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationDV, DAYTIMEDURATION, XSSimpleTypeDecl.DV_DAYTIMEDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.DAYTIMEDURATION_DT));
}
示例8
private boolean containsQName(XSSimpleType type) {
if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
short primitive = type.getPrimitiveKind();
return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
primitive == XSSimpleType.PRIMITIVE_NOTATION);
}
else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
return containsQName((XSSimpleType)type.getItemType());
}
else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
XSObjectList members = type.getMemberTypes();
for (int i = 0; i < members.getLength(); i++) {
if (containsQName((XSSimpleType)members.item(i)))
return true;
}
}
return false;
}
示例9
private void contentRestore() {
fAnnotations = (XSAnnotationImpl [])fGlobalStore[--fGlobalStorePos];
fXSSimpleType = (XSSimpleType)fGlobalStore[--fGlobalStorePos];
fParticle = (XSParticleDecl)fGlobalStore[--fGlobalStorePos];
fAttrGrp = (XSAttributeGroupDecl)fGlobalStore[--fGlobalStorePos];
fBaseType = (XSTypeDefinition)fGlobalStore[--fGlobalStorePos];
int i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
fBlock = (short)(i >> 16);
fContentType = (short)i;
i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
fDerivedBy = (short)(i >> 16);
fFinal = (short)i;
fTargetNamespace = (String)fGlobalStore[--fGlobalStorePos];
fName = (String)fGlobalStore[--fGlobalStorePos];
fIsAbstract = ((Boolean)fGlobalStore[--fGlobalStorePos]).booleanValue();
fComplexTypeDecl = (XSComplexTypeDecl)fGlobalStore[--fGlobalStorePos];
}
示例10
public void setValues(String name, String targetNamespace,
XSTypeDefinition baseType, short derivedBy, short schemaFinal,
short block, short contentType,
boolean isAbstract, XSAttributeGroupDecl attrGrp,
XSSimpleType simpleType, XSParticleDecl particle,
XSObjectListImpl annotations) {
fTargetNamespace = targetNamespace;
fBaseType = baseType;
fDerivedBy = derivedBy;
fFinal = schemaFinal;
fBlock = block;
fContentType = contentType;
if(isAbstract)
fMiscFlags |= CT_IS_ABSTRACT;
fAttrGrp = attrGrp;
fXSSimpleType = simpleType;
fParticle = particle;
fAnnotations = annotations;
}
示例11
/** Returns whether the given attribute is an ID type. **/
private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) {
if (fStorePSVI) {
((PSVIAttrNSImpl) attr).setPSVI (attrPSVI);
}
Object type = attrPSVI.getMemberTypeDefinition ();
if (type == null) {
type = attrPSVI.getTypeDefinition ();
if (type != null) {
attr.setType(type);
return ((XSSimpleType) type).isIDType();
}
}
else {
attr.setType(type);
return ((XSSimpleType) type).isIDType();
}
return false;
}
示例12
static void createBuiltInTypes() {
final String ANYATOMICTYPE = "anyAtomicType";
final String DURATION = "duration";
final String YEARMONTHDURATION = "yearMonthDuration";
final String DAYTIMEDURATION = "dayTimeDuration";
createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType);
// add anyAtomicType
fBuiltInTypes.put(ANYATOMICTYPE, XSSimpleTypeDecl.fAnyAtomicType);
// add 2 duration types
XSSimpleTypeDecl durationDV = (XSSimpleTypeDecl)fBuiltInTypes.get(DURATION);
fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(durationDV, YEARMONTHDURATION, XSSimpleTypeDecl.DV_YEARMONTHDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.YEARMONTHDURATION_DT));
fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationDV, DAYTIMEDURATION, XSSimpleTypeDecl.DV_DAYTIMEDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.DAYTIMEDURATION_DT));
}
示例13
private boolean containsQName(XSSimpleType type) {
if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
short primitive = type.getPrimitiveKind();
return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
primitive == XSSimpleType.PRIMITIVE_NOTATION);
}
else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
return containsQName((XSSimpleType)type.getItemType());
}
else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
XSObjectList members = type.getMemberTypes();
for (int i = 0; i < members.getLength(); i++) {
if (containsQName((XSSimpleType)members.item(i)))
return true;
}
}
return false;
}
示例14
static void createBuiltInTypes() {
final String ANYATOMICTYPE = "anyAtomicType";
final String DURATION = "duration";
final String YEARMONTHDURATION = "yearMonthDuration";
final String DAYTIMEDURATION = "dayTimeDuration";
createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType);
// add anyAtomicType
fBuiltInTypes.put(ANYATOMICTYPE, XSSimpleTypeDecl.fAnyAtomicType);
// add 2 duration types
XSSimpleTypeDecl durationDV = (XSSimpleTypeDecl)fBuiltInTypes.get(DURATION);
fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(durationDV, YEARMONTHDURATION, XSSimpleTypeDecl.DV_YEARMONTHDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.YEARMONTHDURATION_DT));
fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationDV, DAYTIMEDURATION, XSSimpleTypeDecl.DV_DAYTIMEDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.DAYTIMEDURATION_DT));
}
示例15
private void setNumeric(){
if(fVariety == VARIETY_ATOMIC){
this.fNumeric = fBase.fNumeric;
}
else if(fVariety == VARIETY_LIST){
this.fNumeric = false;
}
else if(fVariety == VARIETY_UNION){
XSSimpleType[] memberTypes = fMemberTypes;
for(int i = 0 ; i < memberTypes.length ; i++){
if(!memberTypes[i].getNumeric() ){
this.fNumeric = false;
return;
}
}
this.fNumeric = true;
}
}
示例16
private void contentRestore() {
fAnnotations = (XSAnnotationImpl [])fGlobalStore[--fGlobalStorePos];
fXSSimpleType = (XSSimpleType)fGlobalStore[--fGlobalStorePos];
fParticle = (XSParticleDecl)fGlobalStore[--fGlobalStorePos];
fAttrGrp = (XSAttributeGroupDecl)fGlobalStore[--fGlobalStorePos];
fBaseType = (XSTypeDefinition)fGlobalStore[--fGlobalStorePos];
int i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
fBlock = (short)(i >> 16);
fContentType = (short)i;
i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
fDerivedBy = (short)(i >> 16);
fFinal = (short)i;
fTargetNamespace = (String)fGlobalStore[--fGlobalStorePos];
fName = (String)fGlobalStore[--fGlobalStorePos];
fIsAbstract = ((Boolean)fGlobalStore[--fGlobalStorePos]).booleanValue();
fComplexTypeDecl = (XSComplexTypeDecl)fGlobalStore[--fGlobalStorePos];
}
示例17
/**
* check whether simple type derived is valid derived from base,
* given a subset of {restriction, extension}.
*/
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
// if derived is anySimpleType, then it's valid only if the base
// is ur-type
if (derived == SchemaGrammar.fAnySimpleType) {
return (base == SchemaGrammar.fAnyType ||
base == SchemaGrammar.fAnySimpleType);
}
// if base is complex type
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
if (base == SchemaGrammar.fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
}
return checkSimpleDerivation((XSSimpleType)derived,
(XSSimpleType)base, block);
}
示例18
/**
* Returns the schema-determined-ID.
*
*
* @param attributes
* @param index
* @return A String containing the schema-determined ID.
* @throws XNIException
*/
public String getSchemaDeterminedID(XMLAttributes attributes, int index)
throws XNIException {
Augmentations augs = attributes.getAugmentations(index);
AttributePSVI attrPSVI = (AttributePSVI) augs
.getItem(Constants.ATTRIBUTE_PSVI);
if (attrPSVI != null) {
// An element or attribute information item is a schema-determined
// ID if and only if one of the following is true:]
// 1. It has a [member type definition] or [type definition] property
// whose value in turn has [name] equal to ID and [target namespace]
// equal to http://www.w3.org/2001/XMLSchema;
// 2. It has a [base type definition] whose value has that [name] and [target namespace];
// 3. It has a [base type definition] whose value has a [base type definition]
// whose value has that [name] and [target namespace], and so on following
// the [base type definition] property recursively;
XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition();
if (typeDef != null) {
typeDef = attrPSVI.getTypeDefinition();
}
//
if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) {
return attrPSVI.getSchemaValue().getNormalizedValue();
}
// 4 & 5 NA
}
return null;
}
示例19
public void setValues(String name, String targetNamespace,
XSSimpleType simpleType, short constraintType, short scope,
ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
XSObjectList annotations) {
fName = name;
fTargetNamespace = targetNamespace;
fType = simpleType;
fConstraintType = constraintType;
fScope = scope;
fDefault = valInfo;
fEnclosingCT = enclosingCT;
fAnnotations = annotations;
}
示例20
XSSimpleType traverseLocal(Element elmNode,
XSDocumentInfo schemaDoc,
SchemaGrammar grammar) {
// General Attribute Checking
Object[] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc);
String name = genAnonTypeName(elmNode);
XSSimpleType type = getSimpleType (name, elmNode, attrValues, schemaDoc, grammar);
if (type instanceof XSSimpleTypeDecl) {
((XSSimpleTypeDecl)type).setAnonymous(true);
}
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return type;
}
示例21
/**
* Create a new simple type which is derived by union from a list of other
* simple types.
*
* @param name name of the new type, could be null
* @param targetNamespace target namespace of the new type, could be null
* @param finalSet value of "final"
* @param memberTypes member types of the union type
* @param annotations set of annotations
* @return the newly created simple type
*/
public XSSimpleType createTypeUnion(String name, String targetNamespace,
short finalSet, XSSimpleType[] memberTypes,
XSObjectList annotations) {
int typeNum = memberTypes.length;
XSSimpleTypeDecl[] mtypes = new XSSimpleTypeDecl[typeNum];
System.arraycopy(memberTypes, 0, mtypes, 0, typeNum);
if (fDeclPool != null) {
XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
return st.setUnionValues(name, targetNamespace, finalSet, mtypes, annotations);
}
return new XSSimpleTypeDecl(name, targetNamespace, finalSet, mtypes, annotations);
}
示例22
public void setValues(String name, String targetNamespace,
XSSimpleType simpleType, short constraintType, short scope,
ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
XSObjectList annotations) {
fName = name;
fTargetNamespace = targetNamespace;
fType = simpleType;
fConstraintType = constraintType;
fScope = scope;
fDefault = valInfo;
fEnclosingCT = enclosingCT;
fAnnotations = annotations;
}
示例23
XMLString handleCharacters(XMLString text) {
if (fSkipValidationDepth >= 0)
return text;
fSawText = fSawText || text.length > 0;
// Note: data in EntityRef and CDATA is normalized as well
// if whitespace == -1 skip normalization, because it is a complexType
// or a union type.
if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) {
// normalize data
normalizeWhitespace(text, fWhiteSpace == XSSimpleType.WS_COLLAPSE);
text = fNormalizedStr;
}
if (fAppendBuffer)
fBuffer.append(text.ch, text.offset, text.length);
// When it's a complex type with element-only content, we need to
// find out whether the content contains any non-whitespace character.
fSawOnlyWhitespaceInElementContent = false;
if (fCurrentType != null
&& fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
// data outside of element content
for (int i = text.offset; i < text.offset + text.length; i++) {
if (!XMLChar.isSpace(text.ch[i])) {
fSawCharacters = true;
break;
}
fSawOnlyWhitespaceInElementContent = !fSawCharacters;
}
}
}
return text;
}
示例24
/**
* register one global simple type
*/
public void addGlobalSimpleTypeDecl(XSSimpleType decl) {
fGlobalTypeDecls.put(decl.getName(), decl);
if (decl instanceof XSSimpleTypeDecl) {
((XSSimpleTypeDecl) decl).setNamespaceItem(this);
}
}
示例25
/**
* Create a new simple type which is derived by union from a list of other
* simple types.
*
* @param name name of the new type, could be null
* @param targetNamespace target namespace of the new type, could be null
* @param finalSet value of "final"
* @param memberTypes member types of the union type
* @param annotations set of annotations
* @return the newly created simple type
*/
public XSSimpleType createTypeUnion(String name, String targetNamespace,
short finalSet, XSSimpleType[] memberTypes,
XSObjectList annotations) {
int typeNum = memberTypes.length;
XSSimpleTypeDecl[] mtypes = new XSSimpleTypeDecl[typeNum];
System.arraycopy(memberTypes, 0, mtypes, 0, typeNum);
if (fDeclPool != null) {
XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
return st.setUnionValues(name, targetNamespace, finalSet, mtypes, annotations);
}
return new XSSimpleTypeDecl(name, targetNamespace, finalSet, mtypes, annotations);
}
示例26
private boolean isListDatatype(XSSimpleType validator) {
if (validator.getVariety() == XSSimpleType.VARIETY_LIST)
return true;
if (validator.getVariety() == XSSimpleType.VARIETY_UNION) {
XSObjectList temp = validator.getMemberTypes();
for (int i = 0; i < temp.getLength(); i++) {
if (((XSSimpleType)temp.item(i)).getVariety() == XSSimpleType.VARIETY_LIST) {
return true;
}
}
}
return false;
}
示例27
/**
* check whether derived is valid derived from base, given a subset
* of {restriction, extension}.B
*/
public static boolean checkTypeDerivationOk(XSTypeDefinition derived, XSTypeDefinition base, short block) {
// if derived is anyType, then it's valid only if base is anyType too
if (derived == SchemaGrammar.fAnyType)
return derived == base;
// if derived is anySimpleType, then it's valid only if the base
// is ur-type
if (derived == SchemaGrammar.fAnySimpleType) {
return (base == SchemaGrammar.fAnyType ||
base == SchemaGrammar.fAnySimpleType);
}
// if derived is simple type
if (derived.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// if base is complex type
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
if (base == SchemaGrammar.fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
}
return checkSimpleDerivation((XSSimpleType)derived,
(XSSimpleType)base, block);
}
else {
return checkComplexDerivation((XSComplexTypeDecl)derived, base, block);
}
}
示例28
Object elementLocallyValidType(QName element, Object textContent) {
if (fCurrentType == null)
return null;
Object retValue = null;
// Element Locally Valid (Type)
// 3 The appropriate case among the following must be true:
// 3.1 If the type definition is a simple type definition, then all of the following must be true:
if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// 3.1.2 The element information item must have no element information item [children].
if (fSubElement)
reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
// 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
if (!fNil) {
XSSimpleType dv = (XSSimpleType) fCurrentType;
try {
if (!fNormalizeData || fUnionType) {
fValidationState.setNormalizationRequired(true);
}
retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
} catch (InvalidDatatypeValueException e) {
reportSchemaError(e.getKey(), e.getArgs());
reportSchemaError(
"cvc-type.3.1.3",
new Object[] { element.rawname, textContent });
}
}
} else {
// 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
retValue = elementLocallyValidComplexType(element, textContent);
}
return retValue;
}
示例29
/**
* Element/Attribute traversers call this method to check whether
* the type is NOTATION without enumeration facet
*/
void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) {
if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE &&
((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC &&
((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) {
if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) {
reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem);
}
}
}
示例30
Object elementLocallyValidType(QName element, Object textContent) {
if (fCurrentType == null)
return null;
Object retValue = null;
// Element Locally Valid (Type)
// 3 The appropriate case among the following must be true:
// 3.1 If the type definition is a simple type definition, then all of the following must be true:
if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// 3.1.2 The element information item must have no element information item [children].
if (fSubElement)
reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
// 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
if (!fNil) {
XSSimpleType dv = (XSSimpleType) fCurrentType;
try {
if (!fNormalizeData || fUnionType) {
fValidationState.setNormalizationRequired(true);
}
retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
} catch (InvalidDatatypeValueException e) {
reportSchemaError(e.getKey(), e.getArgs());
reportSchemaError(
"cvc-type.3.1.3",
new Object[] { element.rawname, textContent });
}
}
} else {
// 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
retValue = elementLocallyValidComplexType(element, textContent);
}
return retValue;
}