+ /**
+ * Create an unqualified {@link QName}, checking that the argument does not
+ * contain a prefix.
+ */
+ public static QName unqualified(String name) {
+ checkNoPrefix(name);
+ return new ContentName(XMLConstants.NULL_NS_URI, name, XMLConstants.DEFAULT_NS_PREFIX);
+
+ }
+
+ /**
+ * The common (fully qualified) representation of this name, as defined in
+ * {@link QName#toString()}. This should be used when a fully qualified
+ * representation is required, as subclasses of {@link QName} may override the
+ * {@link QName#toString()} method.
+ *
+ * @see ContentName#toString()
+ */
+ public static String toFullyQualified(QName name) {
+ if (name.getNamespaceURI().equals(XMLConstants.NULL_NS_URI)) {
+ return name.getLocalPart();
+ } else {
+ return "{" + name.getNamespaceURI() + "}" + name.getLocalPart();
+ }