I am working on the data communication between two applications. I am using an XML file that is generated dynamically in one application and sending it to the other through RMI.

Software Framework

Print out the xml data where you are getting
the SAX exception. Make sure it is still
well formed. 

If the document looks like this:

then I don't think it is well formed.
It should look like:

(Obviously, You can use any name you like
for 'root', 'element1' and 'element2'.)
It is also possible that the dom parser you
are using accepts the first case and adds
a dummy root element for you or ignores
the <element2/> text.