Package groovy.xml

# Class QName

java.lang.Object
groovy.xml.QName

All Implemented Interfaces:
  `java.io.Serializable`

    @Deprecated
    public class QName
    extends java.lang.Object
    implements java.io.Serializable

Deprecated.
`QName` class represents the value of a qualified name as specified in XML Schema Part2: Datatypes specification.

The value of a QName contains a namespaceURI, a localPart and a prefix. The localPart provides the local part of the qualified name. The namespaceURI is a URI reference identifying the namespace.

See Also:
  Serialized Form

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `QName​(java.lang.String localPart)` | Deprecated. Constructor for the QName.
  `QName​(java.lang.String namespaceURI, java.lang.String localPart)` | Deprecated. Constructor for the QName.
  `QName​(java.lang.String namespaceURI, java.lang.String localPart, java.lang.String prefix)` | Deprecated. Constructor for the QName.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `boolean` | `equals​(java.lang.Object o)` | Deprecated. Tests this QName for equality with another object.
  `java.lang.String` | `getLocalPart()` | Deprecated. Gets the Local part for this QName
  `java.lang.String` | `getNamespaceURI()` | Deprecated. Gets the Namespace URI for this QName
  `java.lang.String` | `getPrefix()` | Deprecated. Gets the Prefix for this QName
  `java.lang.String` | `getQualifiedName()` | Deprecated. Returns the fully qualified name of this QName
  `int` | `hashCode()` | Deprecated. Returns a hash code value for this QName object.
  `boolean` | `matches​(java.lang.Object o)` | Deprecated. Tests if this QName matches another object.
  `java.lang.String` | `toString()` | Deprecated. Returns a string representation of this QName
  `static QName` | `valueOf​(java.lang.String s)` | Deprecated. Returns a QName holding the value of the specified String.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### QName

    public QName​(java.lang.String localPart)
    Deprecated.
    Constructor for the QName.
    Parameters:
      `localPart` - Local part of the QName

  - ### QName

    public QName​(java.lang.String namespaceURI, java.lang.String localPart)
    Deprecated.
    Constructor for the QName.
    Parameters:
      `namespaceURI` - Namespace URI for the QName
      `localPart` - Local part of the QName.

  - ### QName

    public QName​(java.lang.String namespaceURI, java.lang.String localPart, java.lang.String prefix)
    Deprecated.
    Constructor for the QName.
    Parameters:
      `namespaceURI` - Namespace URI for the QName
      `localPart` - Local part of the QName.
      `prefix` - Prefix of the QName.

- ## Method Details

  - ### getNamespaceURI

    public java.lang.String getNamespaceURI()
    Deprecated.
    Gets the Namespace URI for this QName
    Returns:
      Namespace URI

  - ### getLocalPart

    public java.lang.String getLocalPart()
    Deprecated.
    Gets the Local part for this QName
    Returns:
      Local part

  - ### getPrefix

    public java.lang.String getPrefix()
    Deprecated.
    Gets the Prefix for this QName
    Returns:
      Prefix

  - ### getQualifiedName

    public java.lang.String getQualifiedName()
    Deprecated.
    Returns the fully qualified name of this QName
    Returns:
      a string representation of the QName

  - ### toString

    public java.lang.String toString()
    Deprecated.
    Returns a string representation of this QName
    Overrides:
      `toString` in class `java.lang.Object`
    Returns:
      a string representation of the QName

  - ### equals

    public boolean equals​(java.lang.Object o)
    Deprecated.
    Tests this QName for equality with another object.

    If the given object is not a QName or String equivalent or is null then this method returns `false`.

    For two QNames to be considered equal requires that both localPart and namespaceURI must be equal. This method uses `String.equals` to check equality of localPart and namespaceURI. Any class that extends QName is required to satisfy this equality contract. If the supplied object is a String, then it is split in two on the last colon and the first half is compared against the prefix || namespaceURI and the second half is compared against the localPart i.e. assert new QName("namespace","localPart").equals("namespace:localPart") Intended Usage: for gpath accessors, e.g. root.'urn:mynamespace:node' Warning: this equivalence is not commutative, i.e. qname.equals(string) may be true/false but string.equals(qname) is always false

    This method satisfies the general contract of the `Object.equals` method.

    Overrides:
      `equals` in class `java.lang.Object`
    Parameters:
      `o` - the reference object with which to compare
    Returns:
      `true` if the given object is identical to this QName: `false` otherwise.

  - ### matches

    public boolean matches​(java.lang.Object o)
    Deprecated.
    Tests if this QName matches another object.

    If the given object is not a QName or String equivalent or is null then this method returns `false`.

    For two QNames to be considered matching requires that both localPart and namespaceURI must be equal or one of them is a wildcard. If the supplied object is a String, then it is split in two on the last colon and the first half is matched against the prefix || namespaceURI and the second half is matched against the localPart

    Parameters:
      `o` - the reference object with which to compare
    Returns:
      `true` if the given object matches this QName: `false` otherwise.

  - ### valueOf

    public static QName valueOf​(java.lang.String s)
    Deprecated.
    Returns a QName holding the value of the specified String.

    The string must be in the form returned by the QName.toString() method, i.e. "{namespaceURI}localPart", with the "{namespaceURI}" part being optional.

    This method doesn't do a full validation of the resulting QName. In particular, it doesn't check that the resulting namespace URI is a legal URI (per RFC 2396 and RFC 2732), nor that the resulting local part is a legal NCName per the XML Namespaces specification.

    Parameters:
      `s` - the string to be parsed
    Returns:
      QName corresponding to the given String
    Throws:
      `java.lang.IllegalArgumentException` - If the specified String cannot be parsed as a QName

  - ### hashCode

    public int hashCode()
    Deprecated.
    Returns a hash code value for this QName object. The hash code is based on both the localPart and namespaceURI parts of the QName. This method satisfies the general contract of the `Object.hashCode` method.
    Overrides:
      `hashCode` in class `java.lang.Object`
    Returns:
      a hash code value for this Qname object