// add assertion facets, from "complexType -> simpleContent -> restriction"
XSSimpleTypeDefinition simpleTypeDef = complexTypeDef.getSimpleType();
if (simpleTypeDef != null) {
XSObjectList complexTypeFacets = simpleTypeDef.getMultiValueFacets();
for (int i = 0; i < complexTypeFacets.getLength(); i++) {
XSMultiValueFacet facet = (XSMultiValueFacet) complexTypeFacets.item(i);
if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
Vector simpleContentAsserts = facet.getAsserts();
for (int simpleAssertIdx = 0; simpleAssertIdx <
simpleContentAsserts.size(); simpleAssertIdx++) {
XSAssert simpleContentAssert = (XSAssert)
simpleContentAsserts.get(simpleAssertIdx);
assertions.addXSObject(simpleContentAssert);
}
}
}
}
// there could be assertions, to be evaluated on attributes. add these
// assertions to the list of assertions to be processed.
for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
Augmentations attrAugs = attributes.getAugmentations(attrIndx);
AttributePSVImpl attrPSVI = (AttributePSVImpl)attrAugs.getItem
(Constants.ATTRIBUTE_PSVI);
XSSimpleTypeDefinition attrType = (XSSimpleTypeDefinition)attrPSVI.
getTypeDefinition();
if (attrType != null) {
XSObjectList facets = attrType.getMultiValueFacets();
for (int i = 0; i < facets.getLength(); i++) {
XSMultiValueFacet facet = (XSMultiValueFacet) facets.item(i);
if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
Vector attrAsserts = facet.getAsserts();
for (int j = 0; j < attrAsserts.size(); j++) {
XSAssertImpl attrAssert = (XSAssertImpl) attrAsserts.elementAt(j);
attrAssert.setAttrName(attributes.getLocalName(attrIndx));
attrAssert.setAttrValue(attributes.getValue(attrIndx));
assertions.addXSObject(attrAssert);
}
break;
}
}
}
}
if (assertions.size() > 0) {
assertObject = assertions;
// instantiate the assertions processor
if (fAssertionProcessor == null) {
// construct parameter values for the assertion processor
Map assertProcessorParams = new HashMap();
assertProcessorParams.put("XPATH2_NS_CONTEXT",
((XSAssertImpl)assertions.get(0)).
getXPath2NamespaceContext());
// initialize the assertions processor
initializeAssertProcessor(assertProcessorParams);
}
}
}
else if (typeDef.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// if element's governing type is a "simple type"
XSSimpleTypeDefinition simpleTypeDef = (XSSimpleTypeDefinition) typeDef;
XSObjectList facets = simpleTypeDef.getMultiValueFacets();
for (int i = 0; i < facets.getLength(); i++) {
XSMultiValueFacet facet = (XSMultiValueFacet) facets.item(i);
if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
assertObject = facet.getAsserts();
// instantiate the assertions processor
if (fAssertionProcessor == null) {
// construct parameter values for the assertion processor
Map assertProcessorParams = new HashMap();
assertProcessorParams.put("XPATH2_NS_CONTEXT",
((XSAssertImpl)facet.getAsserts().get(0)).
getXPath2NamespaceContext());
// initialize the assertions processor
initializeAssertProcessor(assertProcessorParams);
}
break;