Name

QName

Synopsis

A QName represents an XML “qualified name,” such as an XML element name that has both a local name and a namespace. getLocalPart( ) returns the unqualified local part of the name. getNamespaceURI( ) returns the canonical URI that formally identifies the namespace. getPrefix( ) returns the locally declared namespace prefix. Note that a QName does not always have a prefix and that the prefix, if it exists, is ignored for the purposes of the equals( ), hashCode( ), and toString( ) methods. The static valueOf( ) method parses a QName from a string in the format of toString( ):

{namespaceURI}localPart
               
javax.xml.namespace.QName

Figure 20-3. javax.xml.namespace.QName

public class QName implements Serializable {
// Public Constructors
     public QName(String localPart);  
     public QName(String namespaceURI, String localPart);  
     public QName(String namespaceURI, String localPart, String prefix);  
// Public Class Methods
     public static QName valueOf(String qNameAsString);  
// Public Instance Methods
     public String getLocalPart( );  
     public String getNamespaceURI( );  
     public String getPrefix( );  
// Public Methods Overriding Object
     public final boolean equals(Object objectToTest);  
     public final int hashCode( );  
     public String toString( );  
}

Passed To

javax.xml.xpath.XPath.evaluate( ), javax.xml.xpath.XPathExpression.evaluate( ), javax.xml.xpath.XPathFunctionResolver.resolveFunction( ), javax.xml.xpath.XPathVariableResolver.resolveVariable( ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.