return null;
int chunk = elementDeclIndex >> CHUNK_SHIFT;
int index = elementDeclIndex & CHUNK_MASK;
XMLContentModel contentModel = fElementDeclContentModelValidator[chunk][index];
// If we have one, just return that. Otherwise, gotta create one
if (contentModel != null)
return contentModel;
int contentType = fElementDeclType[chunk][index];
if (contentType == XMLElementDecl.TYPE_SIMPLE) {
return null;
}
// Get the type of content this element has
int contentSpecIndex = convertContentSpecTree(fElementDeclContentSpecIndex[chunk][index]);
/***
if ( contentSpecIndex == -1 )
return null;
/***/
XMLContentSpec contentSpec = new XMLContentSpec();
getContentSpec( contentSpecIndex, contentSpec );
// And create the content model according to the spec type
if ( contentType == XMLElementDecl.TYPE_MIXED_SIMPLE ) {
//
// just create a mixed content model object. This type of
// content model is optimized for simple mixed content validation.
//
Vector vQName = new Vector();
try {
ChildrenList children = new ChildrenList();
contentSpecTree(contentSpecIndex, contentSpec, children);
contentModel = new MixedContentModel(children.qname,
children.type,
0, children.length, false, isDTD());
}catch( CMException ex ){
ex.printStackTrace();
}
}
else if (contentType == XMLElementDecl.TYPE_MIXED_COMPLEX) {
//
// For Schema, we need a more complex model. Create a child model as
// per the element-only case, unless there are actually no children in
// the model. If that's the case, we can use the Mixed Content Model for
// DTDs.
try {
contentModel = createChildModel(contentSpecIndex, true);
}
catch (CMException ex) {
ex.printStackTrace();
}
}
else if (contentType == XMLElementDecl.TYPE_CHILDREN) {
// This method will create an optimal model for the complexity
// of the element's defined model. If it's simple, it will create
// a SimpleContentModel object. If it's a simple list, it will
// create a SimpleListContentModel object. If it's complex, it
// will create a DFAContentModel object.
//
try {
contentModel = createChildModel(contentSpecIndex, false);
}catch( CMException ex ) {
ex.printStackTrace();
}
} else {
throw new CMException(ImplementationMessages.VAL_CST);
}
// Add the new model to the content model for this element
fElementDeclContentModelValidator[chunk][index] = contentModel;
//build it ..... in XMLValidator
if (contentModel != null)
contentModel.setSubstitutionGroupComparator(comparator);
return contentModel;
}