Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.dom
Class QName

    java.lang.Object
      org.exist.dom.QName

All Implemented Interfaces:
  java.lang.Comparable

public class QName
extends java.lang.Object
implements java.lang.Comparable

Represents a QName, consisting of a local name, a namespace URI and a prefix.

Author:
  Wolfgang

Field Summary
`static QName` | `COMMENT_QNAME`
`static QName` | `DOCTYPE_QNAME`
`static QName` | `DOCUMENT_QNAME`
`static QName` | `EMPTY_QNAME`
`static QName` | `TEXT_QNAME`

Constructor Summary
`QName(QName other)`
`QName(java.lang.String name)`
`QName(java.lang.String localName, java.lang.String namespaceURI)`
`QName(java.lang.String localName, java.lang.String namespaceURI, java.lang.String prefix)` Construct a QName.

Method Summary
`int` | `compareTo(java.lang.Object o)` Compares two QNames by comparing namespace URI and local names.
`boolean` | `equals(java.lang.Object obj)` Checks two QNames for equality.
`boolean` | `equalsSimple(QName other)`
`static java.lang.String` | `extractLocalName(java.lang.String qname)` Extract the local name from a QName string.
`static java.lang.String` | `extractPrefix(java.lang.String qname)` Extract the prefix from a QName string.
`java.lang.String` | `getLocalName()`
`java.lang.String` | `getNamespaceURI()`
`byte` | `getNameType()`
`java.lang.String` | `getPrefix()`
`java.lang.String` | `getStringValue()`
`int` | `hashCode()`
`static boolean` | `isQName(java.lang.String name)`
`boolean` | `needsNamespaceDecl()` Returns true if the QName defines a namespace URI.
`static QName` | `parse(XQueryContext context, java.lang.String qname)` Parses the given string into a QName.
`static QName` | `parse(XQueryContext context, java.lang.String qname, java.lang.String defaultNS)` Parses the given string into a QName.
`void` | `setLocalName(java.lang.String name)`
`void` | `setNamespaceURI(java.lang.String namespaceURI)`
`void` | `setNameType(byte type)`
`void` | `setPrefix(java.lang.String prefix)`
`java.lang.String` | `toString()` Deprecated. : use for debugging purpose only, use getStringValue() for production

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### DOCUMENT_QNAME

    public static final QName DOCUMENT_QNAME

### TEXT_QNAME

    public static final QName TEXT_QNAME

### COMMENT_QNAME

    public static final QName COMMENT_QNAME

### DOCTYPE_QNAME

    public static final QName DOCTYPE_QNAME

### EMPTY_QNAME

    public static final QName EMPTY_QNAME

Constructor Detail

### QName

    public QName(java.lang.String localName,
                 java.lang.String namespaceURI,
                 java.lang.String prefix)

  Construct a QName. The prefix might be null for the default namespace or if no prefix has been defined for the QName. The namespace URI should be set to the empty string, if no namespace URI is defined.

Parameters:
  `localName` -
  `namespaceURI` -
  `prefix` -

### QName

    public QName(java.lang.String localName,
                 java.lang.String namespaceURI)

### QName

    public QName(QName other)

### QName

    public QName(java.lang.String name)

Method Detail

### getLocalName

    public java.lang.String getLocalName()

### setLocalName

    public void setLocalName(java.lang.String name)

### getNamespaceURI

    public java.lang.String getNamespaceURI()

### setNamespaceURI

    public void setNamespaceURI(java.lang.String namespaceURI)

### needsNamespaceDecl

    public boolean needsNamespaceDecl()

  Returns true if the QName defines a namespace URI.

### getPrefix

    public java.lang.String getPrefix()

### setPrefix

    public void setPrefix(java.lang.String prefix)

### setNameType

    public void setNameType(byte type)

### getNameType

    public byte getNameType()

### getStringValue

    public java.lang.String getStringValue()

### toString

    public java.lang.String toString()

  Deprecated. : use for debugging purpose only, use getStringValue() for production

### compareTo

    public int compareTo(java.lang.Object o)

  Compares two QNames by comparing namespace URI and local names. The prefixes are not relevant.

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  See Also:
    `Comparable.compareTo(java.lang.Object)`

### equals

    public boolean equals(java.lang.Object obj)

  Checks two QNames for equality. Two QNames are equal if their namespace URIs, local names and prefixes are equal.

  See Also:
    `Object.equals(java.lang.Object)`

### equalsSimple

    public boolean equalsSimple(QName other)

### hashCode

    public int hashCode()

### extractPrefix

    public static java.lang.String extractPrefix(java.lang.String qname)

  Extract the prefix from a QName string.

  Parameters:
    `qname` -
  Returns:
    the prefix, if found
  Throws:
    `java.lang.IllegalArgumentException` - if the qname starts with a leading :

### extractLocalName

    public static java.lang.String extractLocalName(java.lang.String qname)

  Extract the local name from a QName string.

  Parameters:
    `qname` -
  Throws:
    `java.lang.IllegalArgumentException` - if the qname starts with a leading : or ends with a :

### parse

    public static QName parse(XQueryContext context,
                              java.lang.String qname,
                              java.lang.String defaultNS)
                       throws XPathException

  Parses the given string into a QName. The method uses context to look up a namespace URI for an existing prefix.

  Parameters:
    `context` -
    `qname` -
  Returns:
    defaultNS the default namespace to use if no namespace prefix is present.
  Throws:
    `java.lang.IllegalArgumentException` - if no namespace URI is mapped to the prefix
    `XPathException`

### parse

    public static QName parse(XQueryContext context,
                              java.lang.String qname)
                       throws XPathException

  Parses the given string into a QName. The method uses context to look up a namespace URI for an existing prefix. This method uses the default element namespace for qnames without prefix.

  Parameters:
    `context` -
    `qname` -
  Throws:
    `java.lang.IllegalArgumentException` - if no namespace URI is mapped to the prefix
    `XPathException`

### isQName

    public static final boolean isQName(java.lang.String name)

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.