org.codehaus.xfire.util
Class NamespaceHelper

java.lang.Object
  extended byorg.codehaus.xfire.util.NamespaceHelper

public class NamespaceHelper
extends java.lang.Object

Namespace utilities.

Author:
Dan Diephouse, Arjen Poutsma

Constructor Summary
NamespaceHelper()
           
 
Method Summary
static javax.xml.namespace.QName createQName(org.jdom.Element e, java.lang.String value, java.lang.String defaultNamespace)
           
static java.lang.String getPrefix(org.jdom.Element element, java.lang.String namespaceURI)
           
static void getPrefixes(org.jdom.Element element, java.lang.String namespaceURI, java.util.List prefixes)
           
static java.lang.String getUniquePrefix(org.jdom.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.
static javax.xml.namespace.QName readQName(javax.xml.stream.XMLStreamReader reader)
          Reads a QName from the element text.
 
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.jdom.Element element,
                                               java.lang.String namespaceURI)
Create a unique namespace uri/prefix combination.

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

getPrefix

public static java.lang.String getPrefix(org.jdom.Element element,
                                         java.lang.String namespaceURI)

getPrefixes

public static void getPrefixes(org.jdom.Element element,
                               java.lang.String namespaceURI,
                               java.util.List prefixes)

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.

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

readQName

public static javax.xml.namespace.QName readQName(javax.xml.stream.XMLStreamReader reader)
                                           throws javax.xml.stream.XMLStreamException
Reads a QName from the element text. Reader must be positioned at the start tag.

Parameters:
reader -
Returns:
Throws:
javax.xml.stream.XMLStreamException

createQName

public static javax.xml.namespace.QName createQName(org.jdom.Element e,
                                                    java.lang.String value,
                                                    java.lang.String defaultNamespace)


Copyright © 2004-2006 null. All Rights Reserved.