mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 03:55:28 -04:00
XMLSerializer speedup.
This commit is contained in:
parent
7fad4d5cd8
commit
caef9b6a9e
14
common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java
Executable file → Normal file
14
common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java
Executable file → Normal file
@ -389,9 +389,10 @@ public class XMLSerializer {
|
|||||||
private void writeDocument(final PrintWriter pOut, final Node pNode, final SerializationContext pContext) {
|
private void writeDocument(final PrintWriter pOut, final Node pNode, final SerializationContext pContext) {
|
||||||
// Document fragments might not have child nodes...
|
// Document fragments might not have child nodes...
|
||||||
if (pNode.hasChildNodes()) {
|
if (pNode.hasChildNodes()) {
|
||||||
NodeList nodes = pNode.getChildNodes();
|
Node child = pNode.getFirstChild();
|
||||||
for (int i = 0; i < nodes.getLength(); i++) {
|
while (child != null) {
|
||||||
writeNodeRecursive(pOut, nodes.item(i), pContext);
|
writeNodeRecursive(pOut, child, pContext);
|
||||||
|
child = child.getNextSibling();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,9 +449,10 @@ public class XMLSerializer {
|
|||||||
pOut.println();
|
pOut.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeList children = pNode.getChildNodes();
|
Node child = pNode.getFirstChild();
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
while (child != null) {
|
||||||
writeNodeRecursive(pOut, children.item(i), pContext.push());
|
writeNodeRecursive(pOut, child, pContext.push());
|
||||||
|
child = child.getNextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pContext.preserveSpace) {
|
if (!pContext.preserveSpace) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user