Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools XML Security Java API Reference 10g Release 3 (10.1.3) B25383-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.security.xmlsec.util
Class QName

`java.lang.Object
oracle.security.xmlsec.util.QName`

public class QName
extends java.lang.Object

Class representing an XML qualified name of the form `[prefix:]localName`, encapsulating a local name, namespace URI, and optional namespace prefix.

QName instances are immutable.

Since:
  2.2

Constructor Summary
`QName(java.lang.String localPart, java.lang.String namespace, java.lang.String prefix)` Creates a new `QName` instance with the given local name, prefix and namespace URI.

Method Summary
`boolean` | `equals(java.lang.Object obj)` Compares this `QName` to the given object.
`static boolean` | `equals(java.lang.String qn1, org.w3c.dom.Node context1, java.lang.String qn2, org.w3c.dom.Node context2)` Compares the two given QName strings.
`static QName` | `getInstance(java.lang.String qnameValue, XMLElement element)` Returns a QName object based on the qnamevalue and the element where the qnamevalue was included.
`java.lang.String` | `getLocalPart()` Returns this QName's local name.
`static java.lang.String` | `getLocalPart(java.lang.String qname)` Returns the local name for the given QName string.
`java.lang.String` | `getNamespace()` Returns this QName's namespace URI.
`java.lang.String` | `getPrefix()` Returns this QName's namespace prefix.
`static java.lang.String` | `getPrefixPart(java.lang.String qname)` Returns the namespace prefix for the given QName string.
`int` | `hashCode()`
`static java.lang.String` | `resolvePrefix(java.lang.String qname, org.w3c.dom.Node context)` Returns the namespace URI that is in scope for the given `QName`'s prefix part, in the context of the given node.
`static void` | `setQNameValue(org.w3c.dom.Node node, QName qname)` Set the QName value on the Node passed as a parameter.
`java.lang.String` | `toString()` Returns a string representation of this `QName` of the form [prefix:]localName.

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

Constructor Detail

### QName

    public QName(java.lang.String localPart,
                 java.lang.String namespace,
                 java.lang.String prefix)

  Creates a new `QName` instance with the given local name, prefix and namespace URI.
Parameters:
  `localPart` - This QName's name string.
  `namespace` - This QName's namespace URI.
  `prefix` - This QName's namespace prefix (optional).

Method Detail

### getLocalPart

    public java.lang.String getLocalPart()

  Returns this QName's local name.
  Returns:
    The local name string.

### getNamespace

    public java.lang.String getNamespace()

  Returns this QName's namespace URI.
  Returns:
    The namespace URI string.

### getPrefix

    public java.lang.String getPrefix()

  Returns this QName's namespace prefix.
  Returns:
    The namespace prefix string.

### equals

    public boolean equals(java.lang.Object obj)

  Compares this `QName` to the given object.
  Parameters:
    `obj` - The object to compare to this `QName`.
  Returns:
    `true` if obj is a `QName` instance with the same local name and namespace URI as this `QName`; otherwise returns `false`. Note: Namespace prefixes are ignored for purposes of determining equality of QNames.

### hashCode

    public int hashCode()

### toString

    public java.lang.String toString()

  Returns a string representation of this `QName` of the form [prefix:]localName.

### equals

    public static boolean equals(java.lang.String qn1,
                                 org.w3c.dom.Node context1,
                                 java.lang.String qn2,
                                 org.w3c.dom.Node context2)

  Compares the two given QName strings.
  Parameters:
    `qn1` - The first QName.
    `context1` - The context node to use for resolving the namespace of qn1.
    `qn2` - The second QName.
    `context2` - The context node to use for resolving the namespace of qn2.
  Returns:
    `true` if the given QNames have the same local names and namespace URIs; otherwise returns `false`. Namespace prefixes are resolved with respect to the given context nodes for the comparison.

### resolvePrefix

    public static java.lang.String resolvePrefix(java.lang.String qname,
                                                 org.w3c.dom.Node context)

  Returns the namespace URI that is in scope for the given `QName`'s prefix part, in the context of the given node.
  Returns:
    A URI string, or `null` if none could be resolved. Returns the default namespace in scope if this `QName` has no prefix part.

### getPrefixPart

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

  Returns the namespace prefix for the given QName string.
  Parameters:
    `qname` - A qualified name string of the form `[prefix:]localName`.
  Returns:
    The namespace prefix for the given QName string, (`""` if none is present).

### getLocalPart

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

  Returns the local name for the given QName string.
  Parameters:
    `qname` - A qualified name string of the form `[prefix:]localName`.
  Returns:
    The local name for the given QName string.

### setQNameValue

    public static void setQNameValue(org.w3c.dom.Node node,
                                     QName qname)

  Set the QName value on the Node passed as a parameter.
  Parameters:
    `node` - The XML Node where the QName has to be included (AttributeNode, ElementNode...).
    `qname` - The QName object containing the value to be added.
  Throws:
    `org.w3c.dom.DOMException` - if the prefix and namespace from the QName object are inconsistent with the node where the QName value should be added

### getInstance

    public static QName getInstance(java.lang.String qnameValue,
                                    XMLElement element)

  Returns a QName object based on the qnamevalue and the element where the qnamevalue was included.
  Parameters:
    `qnameValue` - The QName value to parse.
    `element` - The XML Element where the QName value is extracted from.
  Returns:
    A QName object containing the corresponding namespace for the specific prefix included in the QName value.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools XML Security Java API Reference 10g Release 3 (10.1.3) B25383-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005, 2006 , Oracle. All rights reserved.