public QName getAttributeName(int index) {
checkConditionForAttribute();
final XQNode node = currentEvent_.getNode();
final QualifiedName attname;
if(node instanceof DTMElement) {
final DTMAttribute att = ((DTMElement) node).attribute(index);
if(att == null) {
throw new IndexOutOfBoundsException(); // REVIEWME what's needed by the spec ?
}
attname = att.nodeName();
} else if(node instanceof DMElement) {
AttrNodeSequence<DMAttribute> attributes = ((DMElement) node).attribute();
final int attrSize = attributes.size();
if(index >= attrSize) {
throw new IndexOutOfBoundsException(); // REVIEWME what's needed by the spec ?
}
DMAttribute att = attributes.getItem(index);
attname = att.nodeName();
} else {
throw new IllegalStateException("Unexpected node class: " + node.getClass().getName());
}
assert (attname != null);
return QualifiedName.toJavaxQName(attname);