@Override
  public XPathType getDeclaredType() {
    final QName qName = getXPathContext().getQName(this);
    final XPath2Type type;
    if (qName != null) {
      type = XPath2Type.fromName(qName);
    } else {
      final PrefixedName qn = getQName();
      if (qn != null) {
        final String prefix = qn.getPrefix();
        if (prefix != null && prefix.equals("xs")) {
          type = XPath2Type.fromName(new QName(XPath2Type.XMLSCHEMA_NS, qn.getLocalName()));
        } else {
          type = null;
        }
      } else {
        type = null;
      }
    }
    return type != null ? type : XPathType.UNKNOWN;
  }
@Override
  public XPathType getDeclaredType()