I want to send an xml document that i have created using jdom api. I send it to the client side in a jsp page by using out as an outputstream.
Here is some part of my code that i wrote in a jsp page –
<%
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(new File("D:\\out.xml"));
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
Format format = outputter.getFormat();
format.setOmitDeclaration(true);
outputter.output(out, doc);
%>
but i am getting an error at client side where i am using following code in a java file –
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(connection.getInputStream());
*here connection is an object of HttpURLConnection class.
error is as–
org.jdom.inpput.JDOMParseException: error on line 22: The processing instruction target matching “[xX][mM][lL]” is not allowed.
Often the cause is a malformed XML file, with a common problem being a blank line accidentally inserted before the required first line of the xml: