hi friends,
i am doing xml-html transformation , the code for which is as mentioned below .
when i try reading the output
string from the outputstream
the first line of the transformed stream is ALWAYS
"<?xml version="1.0" encoding="UTF-8"?>"
I've removed this line from both the xml & xsl files being used ..still i get this line in the transformed stream .
I need this line removed ...
Can ayone please suggest me the cause or the solution for this .
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xmldata)));
URL url = getClass().getResource(xslFile);
java.io.InputStream in = url.openStream();
javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.dom.DOMSource xmlSource =
new javax.xml.transform.dom.DOMSource(document);
javax.xml.transform.Source xslSource = new javax.xml.transform.stream.StreamSource(in);
javax.xml.transform.Transformer transformer = tFactory.newTransformer(xslSource);
javax.xml.transform.stream.StreamResult streamresult =
new javax.xml.transform.stream.StreamResult(new StringWriter());
transformer.transform(xmlSource, streamresult);
thx,
Shilpa