Class QNameUtils
java.lang.Object
org.springframework.xml.namespace.QNameUtils
Helper class for using
QName
.- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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
(@Nullable String text) Validates the given String as a QName.
-
Constructor Details
-
QNameUtils
public QNameUtils()
-
-
Method Details
-
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.
-