org.codehaus.xfire.util
Class NamespaceHelper

java.lang.Object
  extended by org.codehaus.xfire.util.NamespaceHelper

public class NamespaceHelper
extends java.lang.Object

Namespace utilities.

Author:
Dan Diephouse, Arjen Poutsma

Constructor Summary
NamespaceHelper()
           
 
Method Summary
static java.lang.String getUniquePrefix(org.codehaus.yom.Element element, java.lang.String namespaceURI)
          Create a unique namespace uri/prefix combination.
static java.lang.String getUniquePrefix(javax.xml.stream.XMLStreamWriter writer)
           
static java.lang.String getUniquePrefix(javax.xml.stream.XMLStreamWriter writer, java.lang.String namespaceURI, boolean declare)
          Create a unique namespace uri/prefix combination.
static java.lang.String makeNamespaceFromClassName(java.lang.String className, java.lang.String protocol)
          Generates the name of a XML namespace from a given class name and protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespaceHelper

public NamespaceHelper()
Method Detail

getUniquePrefix

public static java.lang.String getUniquePrefix(org.codehaus.yom.Element element,
                                               java.lang.String namespaceURI)
Create a unique namespace uri/prefix combination.

Parameters:
nsUri -
Returns:
The namespace with the specified URI. If one doesn't exist, one is created.

getUniquePrefix

public static java.lang.String getUniquePrefix(javax.xml.stream.XMLStreamWriter writer,
                                               java.lang.String namespaceURI,
                                               boolean declare)
                                        throws javax.xml.stream.XMLStreamException
Create a unique namespace uri/prefix combination.

Parameters:
nsUri -
Returns:
The namespace with the specified URI. If one doesn't exist, one is created.
Throws:
javax.xml.stream.XMLStreamException

getUniquePrefix

public static java.lang.String getUniquePrefix(javax.xml.stream.XMLStreamWriter writer)

makeNamespaceFromClassName

public static java.lang.String makeNamespaceFromClassName(java.lang.String className,
                                                          java.lang.String protocol)
Generates the name of a XML namespace from a given class name and protocol. The returned namespace will take the form protocol://domain, where protocol is the given protocol, and domain the inversed package name of the given class name.

For instance, if the given class name is org.codehaus.xfire.services.Echo, and the protocol is http, the resulting namespace would be http://services.xfire.codehaus.org.

Parameters:
className - the class name
protocol - the protocol (eg. http)
Returns:
the namespace