Class QNameUtils
java.lang.Object
org.springframework.xml.namespace.QNameUtils
Helper class for using
QName.- Since:
- 1.0.0
- Author:
- Arjen Poutsma
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic QNamecreateQName(String namespaceUri, String localPart, String prefix) Deprecated.static StringDeprecated.in favor ofQName.getPrefix()static QNamegetQNameForNode(Node node) Returns the qualified name of the given DOM Node.static QNameparseQNameString(String qNameString) Parse the given qualified name string into aQName.static QNameConvert a namespace URI and DOM or SAX qualified name to aQName.static StringtoQualifiedName(QName qName) Convert aQNameto a qualified name, as used by DOM and SAX.static booleanvalidateQName(String text) Validates the given String as a QName
-
Constructor Details
-
QNameUtils
public QNameUtils()
-
-
Method Details
-
createQName
Deprecated.in favor ofQName(String, String, String)Creates a newQNamewith the given parameters. Sets the prefix if possible, i.e. if theQName(String, String, String)constructor can be found. If this constructor is not available (as is the case on older implementations of JAX-RPC), the prefix is ignored.- Parameters:
namespaceUri- namespace URI of theQNamelocalPart- local part of theQNameprefix- prefix of theQName. May be ignored.- Returns:
- the created
QName - See Also:
-
getPrefix
Deprecated.in favor ofQName.getPrefix()Returns the prefix of the givenQName. Returns the prefix if available, i.e. if theQName.getPrefix()method can be found. If this method is not available (as is the case on older implementations of JAX-RPC), an empty string is returned.- Parameters:
qName- theQNameto return the prefix from- Returns:
- the prefix, if available, or an empty string
- See Also:
-
validateQName
Validates the given String as a QName- Parameters:
text- the qualified name- Returns:
trueif valid,falseotherwise
-
getQNameForNode
Returns the qualified name of the given DOM Node.- Parameters:
node- the node- Returns:
- the qualified name of the node
-
toQualifiedName
Convert aQNameto a qualified name, as used by DOM and SAX. The returned string has a format ofprefix:localNameif the prefix is set, or justlocalNameif not.- Parameters:
qName- theQName- Returns:
- the qualified name
-
toQName
Convert a namespace URI and DOM or SAX qualified name to aQName. The qualified name can have the formprefix:localnameorlocalName.- Parameters:
namespaceUri- the namespace URIqualifiedName- the qualified name- Returns:
- a QName
-
parseQNameString
Parse the given qualified name string into aQName. Expects the syntaxlocalPart,{namespace}localPart, or{namespace}prefix:localPart. This format resembles thetoString()representation ofQNameitself, but allows for prefixes to be specified as well.- Returns:
- a corresponding QName instance
- Throws:
IllegalArgumentException- when the given string isnullor empty.
-
QName(String, String, String)