Class QNm

All Implemented Interfaces:
Iterable<Item>

public final class QNm extends Item
QName item (xs:QName).
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • EMPTY

      public static final QNm EMPTY
      QName: empty.
    • XML_BASE

      public static final QNm XML_BASE
      QName: xml:base.
    • REST_ERROR

      public static final QNm REST_ERROR
      QName: rest:error.
    • EQNAME

      public static final Pattern EQNAME
      URL pattern (matching Clark and EQName notation).
  • Constructor Details

    • QNm

      public QNm(byte[] name)
      Constructor.
      Parameters:
      name - name
    • QNm

      public QNm(String name)
      Constructor.
      Parameters:
      name - name
    • QNm

      public QNm(byte[] name, byte[] uri)
      Constructor.
      Parameters:
      name - name
      uri - namespace URI
    • QNm

      public QNm(String name, byte[] uri)
      Constructor.
      Parameters:
      name - name
      uri - namespace URI
    • QNm

      public QNm(String name, String uri)
      Constructor.
      Parameters:
      name - name
      uri - namespace URI
    • QNm

      public QNm(byte[] name, StaticContext sc)
      Constructor, binding a statically known namespace. If no namespace is found, the namespace uri is set to null.
      Parameters:
      name - name
      sc - static context
    • QNm

      public QNm(QName name)
      Constructor for converting a Java QName.
      Parameters:
      name - qname
    • QNm

      public QNm(byte[] prefix, String local, byte[] uri)
      Constructor.
      Parameters:
      prefix - prefix
      local - local name
      uri - namespace uri
    • QNm

      public QNm(byte[] prefix, byte[] local, byte[] uri)
      Constructor.
      Parameters:
      prefix - prefix
      local - local name
      uri - namespace uri
  • Method Details

    • resolve

      public static QNm resolve(byte[] name, StaticContext sc) throws QueryException
      Resolves a QName string.
      Parameters:
      name - name to resolve
      sc - static context (can be null)
      Returns:
      string
      Throws:
      QueryException - query exception
    • resolve

      public static QNm resolve(byte[] name, byte[] def, StaticContext sc, InputInfo ii) throws QueryException
      Resolves a QName string.
      Parameters:
      name - name to resolve
      def - default namespace (can be null)
      sc - static context (can be null)
      ii - input info
      Returns:
      string
      Throws:
      QueryException - query exception
    • uri

      public void uri(byte[] u)
      Sets the URI of this QName.
      Parameters:
      u - the uri to be set (can be null, or an empty or non-empty string)
    • uri

      public byte[] uri()
      Returns the URI of this QName.
      Returns:
      uri
    • hasURI

      public boolean hasURI()
      Checks if the URI of this QName has been explicitly set.
      Returns:
      result of check
    • string

      public byte[] string(InputInfo ii)
      Description copied from class: Item
      Returns a string representation of the value.
      Specified by:
      string in class Item
      Parameters:
      ii - input info (can be null)
      Returns:
      string value
    • string

      public byte[] string()
      Returns the string value.
      Returns:
      string value
    • eq

      public boolean eq(Item item, Collation coll, StaticContext sc, InputInfo ii) throws QueryException
      Description copied from class: Item
      Compares the items for equality.
      Specified by:
      eq in class Item
      Parameters:
      item - item to be compared
      coll - collation (can be null)
      sc - static context; required for comparing items of type xs:QName (can be null)
      ii - input info (can be null)
      Returns:
      result of check
      Throws:
      QueryException - query exception
    • eq

      public boolean eq(QNm qnm)
      Compares the specified name.
      Parameters:
      qnm - name to be compared
      Returns:
      result of check
    • diff

      public int diff(Item item, Collation coll, InputInfo ii) throws QueryException
      Description copied from class: Item
      Returns the difference between the current and the specified item. This function is overwritten by the corresponding implementations.
      Overrides:
      diff in class Item
      Parameters:
      item - item to be compared
      coll - collation (can be null)
      ii - input info (can be null)
      Returns:
      difference
      Throws:
      QueryException - query exception
    • hasPrefix

      public boolean hasPrefix()
      Checks if the name contains a prefix.
      Returns:
      result of check
    • prefix

      public byte[] prefix()
      Returns the prefix.
      Returns:
      prefix
    • local

      public byte[] local()
      Returns the local name.
      Returns:
      local name
    • id

      public byte[] id()
      Returns a unique representation of the QName.
      • If a URI exists, the EQName notation is used.
      • Otherwise, if a prefix exists, the prefix and local name is returned.
      • Otherwise, the local name is returned.
      Returns:
      QName as token
    • eqName

      public byte[] eqName()
      Returns an EQName representation.
      Returns:
      QName as token
    • prefixId

      public byte[] prefixId()
      Returns a unique representation of the QName.
      Returns:
      QName as token
    • prefixId

      public byte[] prefixId(byte[] ns)
      Returns a unique representation of the QName.
      • Skips the prefix if the namespace of the QName equals the specified one.
      • Returns a prefixed name if the namespace URI is statically known.
      • Otherwise, id() is called.
      Parameters:
      ns - default uri (can be null)
      Returns:
      QName as token
    • prefixString

      public byte[] prefixString()
      Returns the QName string if it has a prefix, or prefixId() otherwise.
      Returns:
      QName as token
    • toJava

      public QName toJava()
      Description copied from class: Value
      Returns a Java representation of the value.
      Specified by:
      toJava in class Value
      Returns:
      Java object
    • hash

      public int hash(InputInfo ii)
      Description copied from class: Value
      Returns a hash code for this value.
      Overrides:
      hash in class Item
      Parameters:
      ii - input info
      Returns:
      hash code
    • xdmInfo

      public byte[] xdmInfo()
      Description copied from class: Item
      Returns data model info. Overwritten by QNm, DBNode, FTxt and FDoc.
      Overrides:
      xdmInfo in class Item
      Returns:
      type string
    • equals

      public boolean equals(Object obj)
      Description copied from class: Expr
      This function is e.g. called by:
      Specified by:
      equals in class Expr
    • plan

      public void plan(QueryString qs)
      Description copied from class: ExprInfo
      Creates a query string.
      Specified by:
      plan in class ExprInfo
      Parameters:
      qs - query string builder
    • eqName

      public static byte[] eqName(byte[] uri, byte[] local)
      Returns an EQName representation.
      Parameters:
      uri - URI
      local - local name
      Returns:
      QName as token
    • eqName

      public static String eqName(String uri, String local)
      Returns an EQName representation.
      Parameters:
      uri - URI
      local - local name
      Returns:
      QName as token