Skip to content

Commit

Permalink
[bugfix] When looking at QName#toString() output, e.g. when debugging…
Browse files Browse the repository at this point in the history
…, make sure to show the namespace when there is no prefix
  • Loading branch information
adamretter committed Sep 10, 2023
1 parent da6ae57 commit c074a66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion exist-core/src/main/java/org/exist/dom/QName.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class QName implements Comparable<QName> {

public static final String WILDCARD = "*";
private static final char COLON = ':';
private static final char LEFT_BRACE = '{';
private static final char RIGHT_BRACE = '}';

public static final QName EMPTY_QNAME = new QName("", XMLConstants.NULL_NS_URI);
public static final QName DOCUMENT_QNAME = EMPTY_QNAME;
Expand Down Expand Up @@ -125,8 +127,10 @@ public byte getNameType() {
}

public String getStringValue() {
if (prefix != null && prefix.length() > 0) {
if (prefix != null && !prefix.isEmpty()) {
return prefix + COLON + localPart;
} else if (namespaceURI != null && !XMLConstants.NULL_NS_URI.equals(namespaceURI)) {
return LEFT_BRACE + namespaceURI + RIGHT_BRACE + localPart;
}
return localPart;
}
Expand Down

0 comments on commit c074a66

Please sign in to comment.