public final class NamespaceHelper extends Object
Modifier and Type | Method and Description |
---|---|
static QName |
createQName(Element e,
String value,
String defaultNamespace) |
static QName |
createQName(NamespaceContext nc,
String value) |
static String |
getPrefix(Element element,
String namespaceURI) |
static void |
getPrefixes(Element element,
String namespaceURI,
List<String> prefixes) |
static String |
getUniquePrefix(Element element,
String namespaceURI)
Create a unique namespace uri/prefix combination.
|
static String |
getUniquePrefix(XMLStreamWriter writer,
String namespaceURI,
boolean declare)
Create a unique namespace uri/prefix combination.
|
static String |
getUniquePrefix(XMLStreamWriter writer,
String namespaceURI,
String preferred,
boolean declare)
Make a unique prefix.
|
static String |
makeNamespaceFromClassName(String className,
String protocol)
Generates the name of a XML namespace from a given class name and
protocol.
|
static String |
makePackageName(String namespace)
Method makePackageName
|
static QName |
readQName(XMLStreamReader reader)
Reads a QName from the element text.
|
public static String getUniquePrefix(Element element, String namespaceURI)
nsUri
- public static void getPrefixes(Element element, String namespaceURI, List<String> prefixes)
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException
nsUri
- XMLStreamException
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, String preferred, boolean declare) throws XMLStreamException
writer
- target writer.namespaceURI
- namespacepreferred
- if there's a proposed prefix (e.g. xsi), here it is.declare
- whether to declare to the stream.XMLStreamException
public static String makeNamespaceFromClassName(String className, String protocol)
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
.className
- the class nameprotocol
- the protocol (eg. http
)public static String makePackageName(String namespace)
namespace
- public static QName readQName(XMLStreamReader reader) throws XMLStreamException
reader
- XMLStreamException
public static QName createQName(NamespaceContext nc, String value)
Apache CXF