A method for encoding data documents includes reading at least a portion
of a data node from a markup-language document and determining a node
type of the data node. The method further includes determining a start
delimiter for the data node based on the node type and determining, based
on the node type, whether an end delimiter is associated with the data
node. Additionally, the method includes generating an encoded node, in
response to determining that an end delimiter is associated with the data
node. The encoded node includes the start delimiter, data from the data
node, and an end delimiter associated with the data node.The method also
includes generating an encoded node, in response to determining that an
end delimiter is not associated with the data node. In this case, the
encoded node includes the start delimiter and data from the data node,
but does not include an end delimiter. Moreover, the method further
includes writing the encoded node to an output document.