private void evaluateAssertionsFromASimpleType(QName element, List assertions, String value, Augmentations augs) throws Exception { XSSimpleTypeDefinition simpleTypeDefn = (XSSimpleTypeDefinition) ((ElementPSVI) augs.getItem(Constants.ELEMENT_PSVI)).getTypeDefinition(); boolean isTypeDerivedFromList = isTypeDerivedFromSTList(simpleTypeDefn); boolean isTypeDerivedFromUnion = isTypeDerivedFromSTUnion(simpleTypeDefn); Vector assertList = (Vector) assertions; for (int assertIdx = 0; assertIdx < assertList.size(); assertIdx++) { XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(assertIdx); String xPathDefaultNamespace = assertImpl.getXPathDefaultNamespace(); if (xPathDefaultNamespace != null) { fXpath2DynamicContext.add_namespace(null, xPathDefaultNamespace); } evaluateOneAssertionFromSimpleType(element, value, augs, simpleTypeDefn, isTypeDerivedFromList, isTypeDerivedFromUnion, assertImpl, false, null); } // evaluate assertions on itemType of xs:list if (isTypeDerivedFromList && simpleTypeDefn.getItemType() != null) { evaluateAssertsFromItemTypeOfSTList(element, simpleTypeDefn.getItemType(), value); } } // evaluateAssertionsFromASimpleType
private void evaluateAssertsFromAttributes(QName element, XMLAttributes attributes) throws Exception { for (int attrIdx = 0; attrIdx < attributes.getLength(); attrIdx++) { QName attrQname = new QName(); attributes.getName(attrIdx, attrQname); String attrValue = attributes.getValue(attrIdx); Augmentations attrAugs = attributes.getAugmentations(attrIdx); AttributePSVImpl attrPsvi = (AttributePSVImpl)attrAugs.getItem(Constants.ATTRIBUTE_PSVI); XSSimpleTypeDefinition attrSimpleType = (XSSimpleTypeDefinition) attrPsvi.getTypeDefinition(); if (attrSimpleType != null) { List attrAssertList = fXmlSchemaValidator.getAssertionValidator().getAssertsFromSimpleType(attrSimpleType); if (attrAssertList != null) { boolean isTypeDerivedFromList = isTypeDerivedFromSTList(attrSimpleType); boolean isTypeDerivedFromUnion = isTypeDerivedFromSTUnion(attrSimpleType); for (int assertIdx = 0; assertIdx < attrAssertList.size(); assertIdx++) { XSAssertImpl assertImpl = (XSAssertImpl)attrAssertList.get(assertIdx); assertImpl.setAttrName(attrQname.localpart); evaluateOneAssertionFromSimpleType(element, attrValue, attrAugs, attrSimpleType, isTypeDerivedFromList, isTypeDerivedFromUnion, assertImpl, true, attrQname); // evaluate assertions on itemType of xs:list XSSimpleTypeDefinition attrItemType = attrSimpleType.getItemType(); if (isTypeDerivedFromList && attrItemType != null) { evaluateAssertsFromItemTypeOfSTList(element, attrItemType, attrValue); } } } } } } // evaluateAssertsFromAttributes
boolean isTypeDerivedFromUnion = isTypeDerivedFromSTUnion(simpleTypeDefn); restorePsviInfoForXPathContext(elemPsvi); evaluateOneAssertionFromSimpleType(element, value, augs, simpleTypeDefn, isTypeDerivedFromList, isTypeDerivedFromUnion, assertImpl, false, null); savePsviInfoWithUntypingOfAssertRoot(elemPsvi, true);