// simple content model.
//
fQName1.setValues(null, (String)contentSpec.value,
(String)contentSpec.value, (String)contentSpec.otherValue);
return new SimpleContentModel(contentSpec.type, fQName1, null, isDTD());
} 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.
//
fQName1.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, fQName1, fQName2, isDTD());
}
} 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
// will check for this repetition. We pass -1 for the unused
// right node.
//
fQName1.setValues(null, (String)contentSpecLeft.value,
(String)contentSpecLeft.value, (String)contentSpecLeft.otherValue);
return new SimpleContentModel(contentSpec.type, fQName1, null, isDTD());
}
} else {
throw new RuntimeException("ImplementationMessages.VAL_CST");
}