}
public QName getTypeName() throws XQException {
Type type = type_;
if(type instanceof AtomicType) {
QualifiedName qname = ((AtomicType) type).getTypeName();
assert (qname != null);
return QualifiedName.toJavaxQName(qname);
}
if(type instanceof DocumentTest) {
type = ((DocumentTest) type).getNodeType();
}
if(type instanceof NodeType) {
NodeType nodetype = (NodeType) type;
final byte nodekind = nodetype.getNodeKind();
switch(nodekind) {
case NodeKind.ELEMENT:
ElementTest elementTest = (ElementTest) nodetype;
final QualifiedName elemType = elementTest.getTypeName();
if(elemType == null) {
return new QName("http://www.w3.org/2001/XMLSchema", "anyType", "xs");
} else {
return QualifiedName.toJavaxQName(elemType);
}
case NodeKind.ATTRIBUTE:
AttributeTest attrTest = (AttributeTest) nodetype;
final QualifiedName attrType = attrTest.getTypeName();
if(attrType == null) {
return new QName("http://www.w3.org/2001/XMLSchema", "anyType", "xs");
} else {
return QualifiedName.toJavaxQName(attrType);
}