//
// Get the content spec node for the element we are working on.
// This will tell us what kind of node it is, which tells us what
// kind of model we will try to create.
//
XMLContentSpec contentSpec = new XMLContentSpec();
getContentSpec(contentSpecIndex, contentSpec);
if ((contentSpec.type & 0x0f ) == XMLContentSpec.CONTENTSPECNODE_ANY ||
(contentSpec.type & 0x0f ) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER ||
(contentSpec.type & 0x0f ) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL) {
// let fall through to build a DFAContentModel
}
else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_LEAF) {
//
// Check that the left value is not -1, since any content model
// with PCDATA should be MIXED, so we should not have gotten here.
//
if (contentSpec.value == null && contentSpec.otherValue == null)
throw new RuntimeException("ImplementationMessages.VAL_NPCD");
//
// Its a single leaf, so its an 'a' type of content model, i.e.
// just one instance of one element. That one is definitely a
// simple content model.
//
fQName.setValues(null, (String)contentSpec.value,
(String)contentSpec.value, (String)contentSpec.otherValue);
return new SimpleContentModel(contentSpec.type, fQName, null);
} else if ((contentSpec.type == XMLContentSpec.CONTENTSPECNODE_CHOICE)
|| (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_SEQ)) {
//
// Lets see if both of the children are leafs. If so, then it
// it has to be a simple content model
//
XMLContentSpec contentSpecLeft = new XMLContentSpec();
XMLContentSpec contentSpecRight = new XMLContentSpec();
getContentSpec( ((int[])contentSpec.value)[0], contentSpecLeft);
getContentSpec( ((int[])contentSpec.otherValue)[0], contentSpecRight);
if ((contentSpecLeft.type == XMLContentSpec.CONTENTSPECNODE_LEAF)
&& (contentSpecRight.type == XMLContentSpec.CONTENTSPECNODE_LEAF)) {
//
// Its a simple choice or sequence, so we can do a simple
// content model for it.
//
fQName.setValues(null, (String)contentSpecLeft.value,
(String)contentSpecLeft.value, (String)contentSpecLeft.otherValue);
fQName2.setValues(null, (String)contentSpecRight.value,
(String)contentSpecRight.value, (String)contentSpecRight.otherValue);
return new SimpleContentModel(contentSpec.type, fQName, fQName2);
}
} else if ((contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE)
|| (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE)
|| (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE)) {
//
// Its a repetition, so see if its one child is a leaf. If so
// its a repetition of a single element, so we can do a simple
// content model for that.
//
XMLContentSpec contentSpecLeft = new XMLContentSpec();
getContentSpec(((int[])contentSpec.value)[0], contentSpecLeft);
if (contentSpecLeft.type == XMLContentSpec.CONTENTSPECNODE_LEAF) {
//
// It is, so we can create a simple content model here that