Package org.apache.cxf.aegis.util
Class NamespaceHelper
java.lang.Object
org.apache.cxf.aegis.util.NamespaceHelper
Namespace utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic QNamecreateQName(NamespaceContext nc, String value) static QNamecreateQName(Element e, String value, String defaultNamespace) static Stringstatic voidgetPrefixes(Element element, String namespaceURI, List<String> prefixes) static StringgetUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) Create a unique namespace uri/prefix combination.static StringgetUniquePrefix(XMLStreamWriter writer, String namespaceURI, String preferred, boolean declare) Make a unique prefix.static StringgetUniquePrefix(Element element, String namespaceURI) Create a unique namespace uri/prefix combination.static StringmakeNamespaceFromClassName(String className, String protocol) Generates the name of a XML namespace from a given class name and protocol.static QNamereadQName(XMLStreamReader reader) Reads a QName from the element text.
-
Method Details
-
getUniquePrefix
Create a unique namespace uri/prefix combination.- Parameters:
element-namespaceURI- namespace- Returns:
- The namespace with the specified URI. If one doesn't exist, one is created.
-
getPrefix
-
getPrefixes
-
getUniquePrefix
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException Create a unique namespace uri/prefix combination.- Parameters:
writer- target writer.namespaceURI- namespacedeclare- whether to declare to the stream.- Returns:
- The namespace with the specified URI. If one doesn't exist, one is created.
- Throws:
XMLStreamException
-
getUniquePrefix
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, String preferred, boolean declare) throws XMLStreamException Make a unique prefix.- Parameters:
writer- target writer.namespaceURI- namespacepreferred- if there's a proposed prefix (e.g. xsi), here it is.declare- whether to declare to the stream.- Returns:
- the prefix.
- Throws:
XMLStreamException
-
makeNamespaceFromClassName
Generates the name of a XML namespace from a given class name and protocol. The returned namespace will take the formprotocol://domain, whereprotocolis the given protocol, anddomainthe inversed package name of the given class name. For instance, if the given class name isorg.codehaus.xfire.services.Echo, and the protocol ishttp, the resulting namespace would behttp://services.xfire.codehaus.org.- Parameters:
className- the class nameprotocol- the protocol (eg.http)- Returns:
- the namespace
-
readQName
Reads a QName from the element text. Reader must be positioned at the start tag.- Parameters:
reader-- Returns:
- Throws:
XMLStreamException
-
createQName
-
createQName
-