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
-
Method Summary
Modifier and TypeMethodDescriptionstatic QName
createQName
(String namespaceUri, String localPart, String prefix) Deprecated.static String
Deprecated.in favor ofQName.getPrefix()
static QName
getQNameForNode
(Node node) Returns the qualified name of the given DOM Node.static QName
parseQNameString
(String qNameString) Parse the given qualified name string into aQName
.static QName
Convert a namespace URI and DOM or SAX qualified name to aQName
.static String
toQualifiedName
(QName qName) Convert aQName
to a qualified name, as used by DOM and SAX.static boolean
validateQName
(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 newQName
with 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 theQName
localPart
- local part of theQName
prefix
- 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
- theQName
to 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:
true
if valid,false
otherwise
-
getQNameForNode
Returns the qualified name of the given DOM Node.- Parameters:
node
- the node- Returns:
- the qualified name of the node
-
toQualifiedName
Convert aQName
to a qualified name, as used by DOM and SAX. The returned string has a format ofprefix:localName
if the prefix is set, or justlocalName
if 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:localname
orlocalName
.- 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 ofQName
itself, but allows for prefixes to be specified as well.- Returns:
- a corresponding QName instance
- Throws:
IllegalArgumentException
- when the given string isnull
or empty.
-
QName(String, String, String)