I wrote a simple tool to generate a DBUnit XML dataset using queries that the user enters. I want to include each query entered in the XML as a comment, but the DBUnit API to generate the XML file doesn't support inserting the comment where I would like it (above the data it generates), so I am resorting to putting the comment with ALL queries either at the top or bottom.
So my question: is it valid XML to place it at either location? For example, above the XML Declaration:
<!-- Queries used: ... -->
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
...
</dataset>
Or below the root node:
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
...
</dataset>
<!-- Queries used: ... -->
I plan to initially try above the XML Declaration, but I have doubts on if that is valid XML, despite the claim from wikipedia:
Comments can be placed anywhere in the tree, including in the text if the content of the element is text or #PCDATA.
I plan to post back if this works, but it would be nice to know if it is an official XML standard.
UPDATE: See my response below for the result of my test.