Skip to content

Commit

Permalink
emit XML decl, BOM, only for first serialized result node
Browse files Browse the repository at this point in the history
  • Loading branch information
Conal-Tuohy committed Jul 25, 2019
1 parent b757e0a commit 40b70f1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/com/conaltuohy/xprocz/XProcZServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,15 @@ private void respond(Processor processor, HttpServletResponse resp, XdmNode outp
} else {
serializer.setOutputProperty(Serializer.Property.METHOD, "text");
}
// Serialize the nodes
XdmSequenceIterator content = bodyElement.axisIterator(Axis.CHILD);
while (content.hasNext()) {
XdmNode contentNode = (XdmNode) content.next();
serializer.serializeNode(contentNode);
// NB since there may be multiple child items (e.g. comments, white space, pi, etc)
// we refrain from emitting these markers after the first child has been serialized
serializer.setOutputProperty(Serializer.Property.BYTE_ORDER_MARK, "no");
serializer.setOutputProperty(Serializer.Property.OMIT_XML_DECLARATION, "yes");
}
serializer.close();
}
Expand Down

0 comments on commit 40b70f1

Please sign in to comment.