org.odftoolkit.odfdom.pkg
Class OdfName

java.lang.Object
  extended by org.odftoolkit.odfdom.pkg.OdfName
All Implemented Interfaces:
Comparable<OdfName>

public class OdfName
extends Object
implements Comparable<OdfName>

The class provides a simplified interface for XML names. The class defines a name for an XML node. It embraces XML NamespaceURI, XML prefix and XML localname.


Method Summary
 int compareTo(OdfName o)
          Compares the by parameter given OdfName with this OdfName
 boolean equals(Object obj)
           
 boolean equals(String namespaceUri, String name)
           
 String getLocalName()
           
 String getPrefix()
           
 String getQName()
           
 String getUri()
           
 int hashCode()
           
static OdfName newName(NamespaceName namespaceNamed, String name)
          Returns the OdfName for the given namespace and name.
static OdfName newName(OdfNamespace odfNamespace, String name)
          Returns the OdfName for the given namespace and name.
static OdfName newName(String name)
          Returns the OdfName for the given namespace and name.
static OdfName newName(String uri, String qname)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

newName

public static OdfName newName(String name)
Returns the OdfName for the given namespace and name. Creates a new one, if the OdfName was not asked before.

Parameters:
name - of the XML node
Returns:
the OdfName for the given OdfNamesapce and name.

newName

public static OdfName newName(OdfNamespace odfNamespace,
                              String name)
Returns the OdfName for the given namespace and name. Creates a new one, if the OdfName was not asked before.

Parameters:
odfNamespace - the namespace of the name to be created
name - of the XML node. Can be both local or qualified name.
Returns:
the OdfName for the given OdfNamesapce and name.

newName

public static OdfName newName(NamespaceName namespaceNamed,
                              String name)
Returns the OdfName for the given namespace and name. Creates a new one, if the OdfName was not asked before.

Parameters:
namespaceNamed - represents a W3C Namespace Name. The interface NamespaceName is often implemented by an enum.
name - of the XML node. Can be both local or qualified name.
Returns:
the OdfName for the given OdfNamesapce and name.

newName

public static OdfName newName(String uri,
                              String qname)

getUri

public String getUri()
Returns:
the XML Namespace URI, for it would be urn:oasis:names:tc:opendocument:xmlns:text:1.0

getLocalName

public String getLocalName()
Returns:
the XML localname, for it would be p.

getPrefix

public String getPrefix()
Returns:
the XML prefix, for it would be text.

getQName

public String getQName()
Returns:
the XML QName, the qualified name e.g. for it is text:p.

toString

public String toString()
Overrides:
toString in class Object
Returns:
the OdfName as String, represented by a concatenation of XML Namespace URI (within brackets) and local name, as for it would be {urn:oasis:names:tc:opendocument:xmlns:text:1.0}p

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

equals

public boolean equals(String namespaceUri,
                      String name)
Parameters:
namespaceUri - of the XML node to be compared.
name - of the XML node to be compared. Can be qualifed name or localname.
Returns:
true if the given OdfName has the same namespaceURI and localname.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(OdfName o)
Compares the by parameter given OdfName with this OdfName

Specified by:
compareTo in interface Comparable<OdfName>


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.