X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.api.acr%2Fsrc%2Forg%2Fargeo%2Fapi%2Facr%2FContentName.java;h=113f98da0d6350d07279d261e2a99b443b25541a;hb=54df376a9c2dd458a82eaa09bfbb718fe699dd0d;hp=341a3e29710a7d482c2ac46bde2bf0181bdb1965;hpb=7d2a002f5dcfe8a8c7b29803b70d4b1aff265ed1;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.api.acr/src/org/argeo/api/acr/ContentName.java b/org.argeo.api.acr/src/org/argeo/api/acr/ContentName.java index 341a3e297..113f98da0 100644 --- a/org.argeo.api.acr/src/org/argeo/api/acr/ContentName.java +++ b/org.argeo.api.acr/src/org/argeo/api/acr/ContentName.java @@ -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; @@ -80,7 +84,7 @@ public class ContentName extends QName { @Override public String toString() { - return toPrefixedString(); + return toQNameString(); } @Override