if (it instanceof DocumentNodeTest) {
it = ((DocumentNodeTest)it).getElementTest();
}
if ((it.getNodeKindMask() &
(1<<Type.DOCUMENT | 1<<Type.TEXT | 1<<Type.COMMENT | 1<<Type.PROCESSING_INSTRUCTION | 1<<Type.NAMESPACE)) != 0) {
throw new XQException("Wrong node kind for getBaseType()");
}
SchemaType contentType = it.getContentType();
if (contentType.isAtomicType()) {
AtomicType at = (AtomicType)contentType;
while (!at.isBuiltInType()) {
at = (AtomicType)at.getBaseType();
}
return SaxonXQDataFactory.mapSaxonTypeToXQJ(at.getFingerprint());
} else if (contentType.isSimpleType()) {
if (((SimpleType)contentType).isListType()) {
int fp = contentType.getFingerprint();
if (fp == StandardNames.XS_NMTOKENS) {
return XQBASETYPE_NMTOKENS;
} else if (fp == StandardNames.XS_ENTITIES) {
return XQBASETYPE_ENTITIES;
} else if (fp == StandardNames.XS_IDREFS) {
return XQBASETYPE_IDREFS;
}
}
return XQBASETYPE_ANYSIMPLETYPE;
} else if (contentType == Untyped.getInstance()) {
return XQBASETYPE_UNTYPED;
} else {
return XQBASETYPE_ANYTYPE;
}
} else {
throw new XQException("Wrong item type for getBaseType()");
}
}