dont add whitespace to XHTML output

This commit is contained in:
zzz
2014-10-24 14:11:40 +00:00
parent 7955b8ae71
commit eae277fb77

View File

@ -146,8 +146,7 @@ public class XMLParser extends JaxpParser {
return; return;
} }
String indentString = node.getIndentLevelString(indentLevel); buf.append('<').append(name);
buf.append(indentString).append('<').append(name);
int nAttributes = node.getNAttributes(); int nAttributes = node.getNAttributes();
for (int n = 0; n < nAttributes; n++) { for (int n = 0; n < nAttributes; n++) {
Attribute attr = node.getAttribute(n); Attribute attr = node.getAttribute(n);
@ -157,18 +156,20 @@ public class XMLParser extends JaxpParser {
// As in Node, output either the nodes or the value. // As in Node, output either the nodes or the value.
// If mixed values and nodes, the values must be text nodes. See parser above. // If mixed values and nodes, the values must be text nodes. See parser above.
if (node.hasNodes()) { if (node.hasNodes()) {
buf.append(">\n"); buf.append('>');
int nChildNodes = node.getNNodes(); int nChildNodes = node.getNNodes();
for (int n = 0; n < nChildNodes; n++) { for (int n = 0; n < nChildNodes; n++) {
Node cnode = node.getNode(n); Node cnode = node.getNode(n);
output(buf, cnode, indentLevel + 1); output(buf, cnode, indentLevel + 1);
} }
buf.append(indentString).append("</").append(name).append(">\n"); buf.append("</").append(name).append('>');
} else { } else {
if (value == null || value.length() == 0) if (value == null || value.length() == 0) {
buf.append("/>"); // space for <br />
else buf.append(" />");
} else {
buf.append('>').append(value).append("</").append(name).append('>'); buf.append('>').append(value).append("</").append(name).append('>');
}
} }
} }
} }