#748 - close XML tag explicitly for empty tags with configuration.

This commit is contained in:
rudrajyoti biswas
2023-10-25 23:23:00 +05:30
parent 1a2108efa2
commit c6ec2f0e4c
4 changed files with 70 additions and 8 deletions

View File

@@ -877,12 +877,25 @@ public class XML {
}
}
} else if ("".equals(value)) {
sb.append(indent(indent));
sb.append('<');
sb.append(key);
sb.append("/>");
if(indentFactor > 0){
sb.append("\n");
if (config.isCloseEmptyTag()){
sb.append(indent(indent));
sb.append('<');
sb.append(key);
sb.append(">");
sb.append("</");
sb.append(key);
sb.append(">");
if (indentFactor > 0) {
sb.append("\n");
}
}else {
sb.append(indent(indent));
sb.append('<');
sb.append(key);
sb.append("/>");
if (indentFactor > 0) {
sb.append("\n");
}
}
// Emit a new tag <k>