]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.api.acr/src/org/argeo/api/acr/ContentName.java
Merge tag 'v2.3.18' into testing
[lgpl/argeo-commons.git] / org.argeo.api.acr / src / org / argeo / api / acr / ContentName.java
index 341a3e29710a7d482c2ac46bde2bf0181bdb1965..92cd795ce6191f869c7437c142bc2a7c307ddd17 100644 (file)
@@ -24,7 +24,7 @@ public class ContentName extends QName {
         * The UUID v3 of http://www.w3.org/2000/xmlns/ within the standard DNS
         * namespace, to be used as a base for the namespaces.
         * 
-        * @see https://www.w3.org/TR/xml-names/#ns-decl
+        * @see "https://www.w3.org/TR/xml-names/#ns-decl"
         */
        // uuidgen --md5 --namespace @dns --name http://www.w3.org/2000/xmlns/
        // NOTE : must be declared before default namespaces
@@ -41,6 +41,10 @@ public class ContentName extends QName {
 
 //     private final UUID uuid;
 
+       public ContentName(String namespaceURI, String localPart) {
+               super(namespaceURI, localPart, checkPrefix(RuntimeNamespaceContext.getNamespaceContext(), namespaceURI));
+       }
+
        public ContentName(String namespaceURI, String localPart, NamespaceContext nsContext) {
                super(namespaceURI, localPart, checkPrefix(nsContext, namespaceURI));
        }
@@ -48,7 +52,7 @@ public class ContentName extends QName {
        private static String checkPrefix(NamespaceContext nsContext, String namespaceURI) {
                Objects.requireNonNull(nsContext, "Namespace context cannot be null");
                Objects.requireNonNull(namespaceURI, "Namespace URI cannot be null");
-               String prefix = nsContext.getNamespaceURI(namespaceURI);
+               String prefix = nsContext.getPrefix(namespaceURI);
                if (prefix == null)
                        throw new IllegalStateException("No prefix found for " + namespaceURI + " from context " + nsContext);
                return prefix;
@@ -79,8 +83,8 @@ public class ContentName extends QName {
         */
 
        @Override
-       public String toString() {
-               return toPrefixedString();
+       public final String toString() {
+               return toQNameString();
        }
 
        @Override