I'm making a java application that checks if a XML file is already Canonical or not using XOM.
In my tests I have the following file which is already Canonical.
<doc xmlns="http://example.com/default" xmlns:x="http://example.com/x">
<a a1="1" a2="2">123</a>
<b xmlns:y="http://example.com/y" a3=""3"" y:a1="1" y:a2="2"></b>
</doc>
Here it is the code when I load it again with XOM.
<?xml version="1.0"?>
<doc xmlns="http://example.com/default" xmlns:x="http://example.com/x">
<a a1="1" a2="2">123</a>
<b xmlns:y="http://example.com/y" a3=""3"" y:a1="1" y:a2="2" />
</doc>
As you can see it adds again xml tag and delete the closing tag </b>
because the value of tag b is empty.
I haven't got any problem with xml version tag but I don't know what to do to keep the closing tag </b>
when I load the canonical document from file.