I had the above error when I tried to transform a xml in to another xml.
The mistake was, I have pass the xml file as a ByteArrayInputStream instead of InputStream. I was searching every where about the error but no clue with my code.
xsltFile = getInputStream(xslPath);
xmlFile = getInputStream(inputXML);
Source xmlSource = new StreamSource(xmlFile);
Source xsltSource = new StreamSource(xsltFile);
// the factory pattern supports different XSLT processors
TransformerFactory transFact = TransformerFactory.newInstance();
Templates cachedXSLT = transFact.newTemplates(xsltSource);
Transformer trans = cachedXSLT.newTransformer();
writer = new StringWriter();
trans.transform(xmlSource, new StreamResult(writer));
System.out.println(writer.toString());
Try to chenge the input type and it would help for you.
Aalso I saw some info in Wrox site.
http://p2p.wrox.com/xslt/48696-error-content-not-allowed-prolog-sos.html
this could happen due to some other reasons aswell
ReplyDelete-Jerry