public QName getTypeName() throws XQException {
ItemType type = itemType;
if (type instanceof AtomicType) {
int fp = ((AtomicType)type).getFingerprint();
NamePool pool = config.getNamePool();
String uri = pool.getURI(fp);
String local = pool.getLocalName(fp);
return new QName(uri, local);
}
if (type instanceof DocumentNodeTest) {
type = ((DocumentNodeTest)type).getElementTest();
}
if (type instanceof NodeTest) {
if ((((NodeTest)type).getNodeKindMask() &
(1<<Type.DOCUMENT | 1<<Type.TEXT | 1<<Type.COMMENT | 1<<Type.PROCESSING_INSTRUCTION | 1<<Type.NAMESPACE)) != 0) {
throw new XQException("getTypeName() failed: itemType is not a document, element, or attribute test");
}
SchemaType t = ((NodeTest)type).getContentType();
if (t != null) {
int fp = ((NodeTest)type).getContentType().getFingerprint();
NamePool pool = config.getNamePool();
String uri = pool.getURI(fp);
String local = pool.getLocalName(fp);
return new QName(uri, local);
}
}
throw new XQException("getTypeName() failed: itemType is not a document, element, or attribute test");
}