Org.xml.sax error content not allowed in prolog

Hi,
I am running Jetty 6.x on SUSE and there is a webapp called pyjasper i am trying to run on it. the context maps fine and it displays the content however, when i use the applet in the webapp to create a report (.jasper) it gives me a org.xml.sax Parse exception: content not allowed in prolog.
A little part of the error is pasted below:
generating report /tmp/pyJasper/compiled-reports/6390c37d0ea810c7fae3e647c2f86817.jasper
Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1039)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.commons.digester.Digester.parse(Digester.java:1647)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:168)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:152)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
2010-03-04 09:15:59.073::WARN: /pyJasper/jasper.py
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:168)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:152)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
I am guessing this is some sort of an error in xml parsing. I found couple of solutions on sun java forums but none of them worked for me. Right now I am trying to figure out whether this is being caused by the applet or the java itself.
Apparently other people who use this applet do not have a problem and they have the exact same files as me. So I am not sure what exactly is causing tihs problem. Bit of a noob.
Any help would be greatly appreciated.
THANK YOU VERY MUCH!!!! :)

Hi thanks you very much for the reply.
In my message I forgot to mention that I edited my prologs to "<?xml version = "1.0" encoding = "UTF-8"?>" and the jetty.xml that has the server configuration has:
<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
I apologize for the clarity of my message. I meant to say that I was wondering whether the problem is with the xm files that java has, or the xml files that are in the pyjasper package that I downloaded?
I also checked for byte order mark using hex editor to see if those six characters were in front of my xml files. None of the files in the pyjasper package had the BOM so that solution did not work.
Is there something wrong with the above xml prolog?
I have been reading tons of different posts and stuf trying to figure this out for the past month but juts cannot seem to get it to work.
Thanks.

Similar Messages

  • Org.xml.sax.SAXParseException: Content is not allowed in prolog Error

    Hello,
    this is pratap.<br>
    i was trying rules using decision tables with 'call charges' example<br>.
    after filling the text fields i am getting an error org.xml.sax.SAXParseException: Content is not allowed in prolog<br>.
    Can any one please tell me what are the reasons for this error and how to correct it<br>.
    thank you.

    Problem solved.There was some problem in xml file i corrected it and it worked.Sorry for asking silly question.

  • Org.xml.sax.SAXParseException: Content is not allowed in prolog.

    Hi All,
    Currently i m doing some practice on JSTL and following few examples from this link http://java.sun.com/developer/technicalArticles/javaserverpages/faster/
    while doing xml-ex1.jsp
    This is xml-ex1.jsp code
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    <html>
    <head>
    <title>JSTL Support for XML</title>
    </head>
    <body bgcolor="#FFFFCC">
    <h3>Books Info:</h3>
    <c:set var="xmltext">
    <books>
    <book>
    <title>Book Title A</title>
    <author>A. B. C.</author>
    <price>17.95</price>
    </book>
    <book>
    <title>Book Title B</title>
    <author>X. Y. Z.</author>
    <price>24.99</price>
    </book>
    </books>
    </c:set>
    <x:parse xml="${xmltext}" var="output"/>
    <b>The title of the first book is</b>:
    <x:out select="$output/books/book[1]/title"/>
    <br>
    <b>The price of the second book</b>:
    <x:out select="$output/books/book[2]/price"/>
    </body>
    </html>
    While running jsp page i m getting follwing error
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSource(ParseSupport.java:227)
         at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSourceWithFilter(ParseSupport.java:193)
         at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseReaderWithFilter(ParseSupport.java:199)
         at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseStringWithFilter(ParseSupport.java:206)
         at org.apache.taglibs.standard.tag.common.xml.ParseSupport.doEndTag(ParseSupport.java:138)
         at org.apache.jsp.jsp.xml_002dex1_jsp._jspx_meth_x_parse_0(org.apache.jsp.jsp.xml_002dex1_jsp:152)
         at org.apache.jsp.jsp.xml_002dex1_jsp._jspService(org.apache.jsp.jsp.xml_002dex1_jsp:70)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at
    NOTE :- I m using Tomcat 5.5.14 .
    Please help me out how to resolve this problem
    Thanks & Regards
    Rupesh Kumar

    From what I understand, it has nothing to do with your JSP and all to do with the XML it's supposed to parse. It sounds malformed. Check the first tag.

  • How to resolve Content not allowed in prolog with PDF files

    We are using PI 7.1 to read a file and using ASMA get the file name and pass it to a target mapping and call a web service with the file name.
    We have a scenario that reads a PDF file as Binary form a folder.  Our mapper uses ASMA to get the file name and folder of the
    file to map to the target.
    Testing in mapper works fine except for the ASMA does not function (known issue).
    At runtime we drop a file and it is picked up as expected BUT from SXMB_MONI we see the following:
    Runtime exception occurred during application mapping com/sap/xi/tf/_MM_FileNotification_; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Content is not allowed in prolog.
    This error does not happen all the time either.  When it appears it is typically only the first time a file is mapped and on subsequent retries it processes normally.  In dev we have shown that PI seems to get stuck on a few initial files u2013 process properly on the first retry and then at some point has no issues and will process files very fast.
    u201CContent not allowed in prologu201D at least from an XML perspective is related to characters appearing before the xml file declaration:
    <?xml version="1.0".encoding="UTF-8"?>
    If chars appear before this you get this error in Java parsers.  This could be related but we do not have control over how PI parsed the file content and puts into XML messages inside the mapper as we do nothing with the file content.
    The same file will go through randomly with this exception on multiple drops.  Sometimes it gets processed properly and sometime it doesnu2019t u2013 but in dev it u201Calwaysu201D gets processed properly on the automatic retry.  It does not seem to matter what PDF we drop in there either.
    Our tyoes look something like this:
    Source:
    DT_FILE - xsd:hexBinary
    Target:
    FilePath - xsd:String
    I have tried with DT_FILE as xsd:base64Binary with the same results...
    We use a UDF to get the file name from ASMA as follows:
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    String ourSourceFileName = conf.get(key1);
    String ourSourceDirName = conf.get(key2);
    //conf.put(key1, ourSourceDirName + "/" + ourSourceFileName);
    return ourSourceDirName + "
    ToProcess
    " + ourSourceFileName;
    Edited by: Carey Bingham on May 26, 2010 12:24 AM

    > Is using a custom adapter module the standard way to handle files when we do not want the content? 
    I would rather say this is a feasible solution
    > If so does anyone have generic code that we can use for the purposes of simply monitoring a file and passing the file name/folder out implemented as modules already?
    The questio is. What do you want to do with this information?
    Here is a sample code written for a specific purpose, you can adapt this to your needs:
    http://wiki.sdn.sap.com/wiki/display/XI/AdapterModulePI7.0SetAttachmentName
    > Is this a known workaround to get around the "content not allowed in prolog" issue?
    At least it is known by me

  • Problem with Exception - "Content not allowed in Prolog"

    I was using org.w3c.dom package to handle all my XML data in JDK 1.4.1 environment. Recently, I have upgraded my Java version to JDK 1.5. When I run my code, while parsing the XML data, it is throwing an Exception - "Content not allowed in Prolog". I know that this Exception is because the XML data does not contain xml declaration in prolog.
    But, I have the code that queries the database and builds the records in XML format. The sample XML is as follows.
    <list>
    <row>
    <fld1>Val1</fld1>
    <fld2>Val2</fld2>
    </row>
    <row>
    <fld1>Val3</fld1>
    <fld2>Val4</fld2>
    </row>
    </list>
    I want to know why the JVM is validating for XML declaration? Why can't it continue parsing the XML in case it is well formed? Is there any way so that I can skip this validation?
    Please reply. I am in a big trouble because, in case some changes are required, I need to implement in many places of my API.

    The isELIgnored flag just fixes this page.
    If you want to use EL on your pages a better solution is to update your web.xml file:
    EL Expressions in JSP2.0 containers:
    In order to evaluate EL expressions, your web.xml file must be up to date.
    If web.xml states that it is version 2.3 or less, then EL evaluation is disabled by default for backwards compatibility.
    So if your web.xml starts with this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>Replace it with this
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    Cheers,
    evnafets

  • "Content not allowed in Prolog" XML error while using RemoteSession API

    Hi,
    I am trying to create a view by using a RemoteSession object CREATED on the RPC URL of Sun Identity Manager. Here is the code I am trying out.
    try
    URL url = new URL ("http","localhost",8080,"/idm/servlet/rpcrouter2");
    System.out.println (url.toString());
    RemoteSession _remoteSession = new RemoteSession   
    (url,Constants.CONFIGURATOR, new EncryptedData
    ("configurator"));
    System.out.println ("Remote session is "+_remoteSession);
    GenericObject view = _remoteSession.createView ("Role",null);
    System.out.println ("View is "+view);
    catch (MalformedURLException male){
         male.printStackTrace ();
    catch (WavesetException wes){
         wes.printStackTrace ();
    catch (Exception e){
         e.printStackTrace ();
    When this line is called,
    GenericObject view = _remoteSession.createView ("Role",null);
    The code throws the following exception.
    [java] http://localhost:8080/idm/servlet/rpcrouter2
    [java] Remote session is com.waveset.session.RemoteSession@1cbda0a
    [java] com.waveset.util.XmlParseException: XML Error: 1:1: Content is not a
    llowed in prolog.
    [java] at com.waveset.util.XmlParser.wrapException(XmlParser.java:886)
    [java] at com.waveset.util.XmlParser.parseString(XmlParser.java:519)
    [java] at com.waveset.util.XmlUtil.parseString(XmlUtil.java:440)
    [java] at com.waveset.session.RemoteSession.getResultObject(RemoteSessi
    on.java:1028)
    [java] at com.waveset.session.RemoteSession.rpc(RemoteSession.java:995)
    [java] at com.waveset.session.RemoteSession.callx(RemoteSession.java:92
    3)
    [java] at com.waveset.session.RemoteSession.call(RemoteSession.java:907
    [java] at com.waveset.session.RemoteSession.call(RemoteSession.java:893
    [java] at com.waveset.session.RemoteSession.call(RemoteSession.java:880
    [java] at com.waveset.session.RemoteSession.call(RemoteSession.java:869
    [java] at com.waveset.session.RemoteSession.createView(RemoteSession.ja
    va:753)
    [java] at com.sun.idm.idmx.myspefiles.MyRemoteApiUsage.createAndProvisi
    onUser3(MyRemoteApiUsage.java:496)
    [java] at com.sun.idm.idmx.myspefiles.MyRemoteApiUsage.demoBasicProvisi
    oning(MyRemoteApiUsage.java:475)
    [java] at com.sun.idm.idmx.myspefiles.MyRemoteApiUsage.runDemo(MyRemote
    ApiUsage.java:656)
    [java] at com.sun.idm.idmx.myspefiles.MyRemoteApiUsage.main(MyRemoteApi
    Usage.java:670)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
    sorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
    Is this a known issue in the SDK ? If I construct my own XML and populate a GenericObject, _remoteSession.checkinView (view) does not have any problem in checking in the view. The exception is thrown irrespective of the view id I use , i.e. IDMXUser, User, Role etc.
    Thanks,
    Srinivas

    Hi Srini,
    Have you solved this problem. If yes then can you help me with the solution?
    Thanks!

  • [Fatal Error] :1:1: Content is not allowed in prolog. ..XML READ ERROR

    Hi I am developing an application where it will read xml elements from the http site (http://www.w3schools.com/Xml/note.xml) and display in my program using DOM. while executing its giving CONTENT IS NOT ALLOWED IN PROGRAM below error. but when i am use coded xml in program itself as comment as shown in program its giving correct value. I need to read from http not from coded xml in the program. its immediate please help me out.
    [Fatal Error] :1:1: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at SimpleXML1.main(SimpleXML1.java:34)
    import javax.xml.parsers.*;
    import org.xml.sax.InputSource;
    import org.w3c.dom.*;
    import java.io.*;
    public class SimpleXML1 {
    public static void main(String arg[]) {
    String xmlRecords = "http://www.w3schools.com/Xml/note.xml";
    /* String xmlRecords =
    " <note>" +
    " <to>John</to>" +
    " <from>Manager</from>" +
    " <heading>XML Program</heading>" +
    " <body>Simple XML</body>" +
    "</note>";*/
    try {
    DocumentBuilderFactory dbf =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource is = new InputSource();
    is.setCharacterStream(new StringReader(xmlRecords));
    Document doc = db.parse(is);
    NodeList nodes = doc.getElementsByTagName("note");
    for (int i = 0; i < nodes.getLength(); i++) {
    Element element = (Element) nodes.item(i);
    NodeList from = element.getElementsByTagName("from");
    Element line = (Element) from.item(0);
    Node child1 = line.getFirstChild();
    CharacterData cd = (CharacterData) child1;
    System.out.println(cd.getData());
    catch (Exception e) {
    e.printStackTrace();
    }

    chrisacess wrote:String xmlRecords = "http://www.w3schools.com/Xml/note.xml";
    /* snip */
    is.setCharacterStream(new StringReader(xmlRecords));
    Is that really how you're trying to read the online XML document? Because I don't see anything that makes a connection to the site. All you're doing is trying to parse the string "http://www.w3schools.com/Xml/note.xml" is if it were XML.
    ps, That "Content not allowed in prolog" error message is worse than useless IMO. They might as well say "It didn't work" for all the good does.

  • Trying to create a pdf with jasper - Content is not allowed in prolog

    hi all,
    Im trying to create a pdf file with jasper reports but i get this error message:
    29/11/2007 16:52:03 org.apache.commons.digester.Digester fatalError
    SEVERE: Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
         at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
         at org.apache.commons.digester.Digester.parse(Digester.java:1666)
         at net.sf.jasperreports.engine.xml.JRPrintXmlLoader.loadXML(JRPrintXmlLoader.java:151)
         at net.sf.jasperreports.engine.xml.JRPrintXmlLoader.load(JRPrintXmlLoader.java:103)
         at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1376)
         at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:243)
         at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:214)
         at net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:140)
         at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:397)
         at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:328)
         at br.com.abril.contratos.Gerar.geraRelatorio(Gerar.java:38)
         at br.com.abril.contratos.Gerar.main(Gerar.java:47)

    cause of the error:
    After some extensive research on the web, it is found that that you are using an UTF-8 encoded file with byte-order mark (BOM). Java doesn't handle BOMs on UTF-8 files properly, making the three header bytes appear as being part of the document. UTF-8 files with BOMs are commonly generated by tools such as Window's Notepad. This is a known bug in Java, but it still needs fixing after almost 8 years...
    There are some hexadecimal character at the begining of the file, which is giving error"content not allowed in prolog". No solution is provided for this till now.
    Example: suppose your file start with <?xml version="1.0" encoding="utf-8"?>. you will see this in a editor. But if you open this file with any hexadecimal editor you will find some junk character in the start of the file.that is causing the problem
    solution:
    1) convert your file into a string and then read the file from the forst character that in my case the first character will be "<".so the junk character will not be there in the string and then again convert it into a file.
    2) some people are able to solve this problem by changing the "utf-8" to "utf-16". remember only in some case. some times this problem also exits in "utf-16" file.
    3) some are able to solve this problem by changing the LANG to US.en.
    4) If the first three bytes of the file have hexadecimal values EF BB BF then the file contains a BOM.so you can also handle by your own.
    5)Download a hexadecimal editor and remove the BOM.
    6) In case you are not able to think furthe then please to more research in internet may be you find some other solution to this problem. But These solution are some type of hack not exactly a solution.

  • [Fatal Error] :1:1: Content is not allowed in prolog.

    I'm trying to compare an XML file to an XSLT generated file from that XML file, and when I run the the class as a JUnit Test, I get the following:
    [Fatal Error] :1:1: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:352)
         at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:339)
         at org.custommonkey.xmlunit.XMLUnit.buildControlDocument(XMLUnit.java:283)
         at org.custommonkey.xmlunit.Diff.<init>(Diff.java:116)
         at org.custommonkey.xmlunit.examples.MyXMLTestCase.testXSLTransformation(MyXMLTestCase.java:70)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at junit.framework.TestCase.runTest(TestCase.java:164)
         at junit.framework.TestCase.runBare(TestCase.java:130)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:120)
         at junit.framework.TestSuite.runTest(TestSuite.java:230)
         at junit.framework.TestSuite.run(TestSuite.java:225)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Any ideas?

    In my experience, "Content is not allowed in prolog" usually means your XML file is stored in the UTF-8 encoding with a BOM. Java's UTF-8 Charset doesn't recognize the UTF-8 BOM; it decodes it and passes it along like any other character, then the XML parser chokes on it.
    To get rid of the BOM you can open the XML file in a text editor and (depending on the editor) either (1) save the file as UTF-8 without BOM, or (2) switch to hexadecimal and delete the first three bytes (EF, BB, BF).

  • [Fatal Error] :1:2: Content is not allowed in prolog.

    I am trying to parse input stream i amgetting this error please help me
    [Fatal Error] :1:2: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
         at it.Test.DomParserExample.parseXmlFile(DomParserExample.java:90)
         at it.Test.DomParserExample.getParsedXml(DomParserExample.java:50)
         at it.sella.dbu.helper.DaoHelper.parseClobData(DaoHelper.java:28)
         at it.Test.ClobTest.getRequestView(ClobTest.java:122)
         at it.Test.ClobTest.main(ClobTest.java:30)
    Exception in thread "main" java.lang.NullPointerException
         at it.Test.DomParserExample.parseDocument(DomParserExample.java:104)
         at it.Test.DomParserExample.getParsedXml(DomParserExample.java:52)
         at it.sella.dbu.helper.DaoHelper.parseClobData(DaoHelper.java:28)
         at it.Test.ClobTest.getRequestView(ClobTest.java:122)
         at it.Test.ClobTest.main(ClobTest.java:30)
    Message was edited by:
    raj25amigo

    Thanks buddy ..it was a malformed XML i missed out a tag

  • Could not parse deployment descriptor: org.xml.sax.SAXParseException

    I am using Taglib in JSP file .
    I am calling the AbcTagLib from my jsp Login.jsp file.
    The entries for the taglib is there in web.xml file.
    Please see the attachments.
    I am getting the following errors while running my JSP file:
    Parsing of JSP File '/jsp/Login.jsp' failed:
    /jsp/Login.jsp: Could not parse deployment descriptor: org.xml.sax.SAXParseException:
    Could not parse: taglib starting at line 1
    probably occurred due to an error in /jsp/Login.jsp:
    <%@ taglib uri="AbcTagLib" prefix="abc" %>
    Please look in to it and suggest some solution.
    The files are :
    AbcTagLib.tld
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc. //DTD JSP Tag Library 1.1//EN"
    "web-jsptaglib_1_1.dtd">
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>TagLib</shortname>
         <tag>
         <name>label</name>
         <tagclass>com.abc.internet.common.taglib.LiteralTag</tagclass>
         <bodycontent>empty</bodycontent>
         <info>This is a simple tag for ABC</info>
              <attribute>
                   <name>name</name>
                   <required>false</required>
                   <rtexpvalue>false</rtexpvalue>
              </attribute>
         </tag>
         <tag>
         <name>linkAccess</name>
         <tagclass>com.abc.internet.common.taglib.LinkAccessTag</tagclass>
         <bodycontent>JSP</bodycontent>
         <info>this is the tag class for showing the button</info>
         <attribute>
         <name>linkId</name>
         <required>true</required>
         <rtexpvalue>false</rtexpvalue>
         </attribute>
         <attribute>
         <name>flag</name>
         <required>true</required>
         <rtexpvalue>false</rtexpvalue>
         </attribute>
         </tag>
    </taglib>
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN'
    'file:///D:/bea/wlserver6.0sp1/web-app_2_2.dtd'>
    <web-app>
    <taglib>
    <taglib-uri>AbcTagLib</taglib-uri>
    <taglib-location>/WEB-INF/AmsTagLib.tld</taglib-location>
    </taglib>
    </web-app>
    Login.jsp
    <%@ page language="Java" errorPage="/jsp/AbcJspError.jsp" import="java.util.Vector,com.abc.internet.common.util.UtilFunctions,com.abc.internet.welcome.form.LoginForm,com.abc.internet.common.util.*"%>
    <%@ taglib uri="AbcTagLib" prefix="abc" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <HTML>
    <HEAD>
         <TITLE>LOGIN SCREEN</TITLE>
         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </HEAD>
    <BODY class="imgSpacerTan" onUnload="javascript:funcCloseErrorWindow();">
    <html:form action="/struts/Login" name="LoginForm" type="com.abc.internet.welcome.form.LoginForm"
    onsubmit="onLogin()">
         <table align="center" cellpadding=0 cellspacing=0 border=0 class="imgSpacerTan">
              <tr>
                   <td align="left">
                        <img border="0" src="../images/logo.gif">
                   </td>
              </tr>
         </table>
         <table align="center" cellpadding=0 cellspacing=0 border=0 class="imgSpacerTan">
              <tr> <td ALIGN="center" class="header" height=30px><font class="fontBlue" >Welcome
    to the</font></td></tr>
              <tr> <td ALIGN="center" class="header" height=30px><font class="fontBlue" >ABC
    System</font></td></tr>
              <tr> <td ALIGN="center" class="header" height=20>  </td></tr>
         </table>
         <table cellpadding=0 cellspacing=0 border=5 bordercolor="#293163" class="deadlineHistoryTablebgcolor"
    align="center">
              <tr class="deadlineHistoryTablebgcolor">
                   <td class="deadlineHistoryTablebgcolor">
                        <table cellpadding=10 cellspacing=10 border=0 width="400" class="deadlineHistoryTablebgcolor"
    align="center">
                             <tr>
                                  <td>
                                       <script language="javascript">
                                            if(navigator.appName.indexOf("Netscape") != -1)
                                                      document.write('<table cellpadding=0 cellspacing=0 border=1 width="400"
    bordercolor="#293163" class="deadlineHistoryTablebgcolor" align="center">');
                                            else
                                                      document.write('<table cellpadding=0 cellspacing=0 border=1 width="400"
    bordercolorlight="#293163" class="deadlineHistoryTablebgcolor" align="center">');
                                       </script>
                                            <tr>
                                                 <td>
                                                      <table cellpadding=7 cellspacing=7 border=0 width="400" bordercolor="#293163"
    class="deadlineHistoryTablebgcolor" align="center">
                                                           <tr>
                                                                <td>
                                                                     <font class="fontBlue">   USER ID       &nbsp:  </font><input
    type="text" name="iv-user">
                                                                </td>
                                                           </tr>
                                                      </table>
                                                 </td>
                                            </tr>
                                       </table>     
                                  </td>
                             </tr>
                             <tr>
                                  <td>
                                       <table cellpadding=0 cellspacing=0 border=1 width="400" class="borderBlue"
    class="deadlineHistoryTablebgcolor" align="center">
                                            <tr>
                                                 <td>
                                                      <table cellpadding=7 cellspacing=7 border=0 width="400" class="borderBlue"
    class="deadlineHistoryTablebgcolor" align="center">
                                                           <tr>
                                                                <td align="center" ><input type="submit" value="Submit" onclick="return
    (onLogin())" ></td>
                                                           </tr>
                                                      </table>
                                                 </td>
                                            </tr>
                                       </table>
                                  </td>
                             </tr>
                        </table>
                   </td>
              </tr>
         </table>
    </html:form>     
    </body>
    </html>
    Thanks

    I am using Taglib in JSP file .
    I am calling the AbcTagLib from my jsp Login.jsp file.
    The entries for the taglib is there in web.xml file.
    Please see the attachments.
    I am getting the following errors while running my JSP file:
    Parsing of JSP File '/jsp/Login.jsp' failed:
    /jsp/Login.jsp: Could not parse deployment descriptor: org.xml.sax.SAXParseException:
    Could not parse: taglib starting at line 1
    probably occurred due to an error in /jsp/Login.jsp:
    <%@ taglib uri="AbcTagLib" prefix="abc" %>
    Please look in to it and suggest some solution.
    The files are :
    AbcTagLib.tld
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc. //DTD JSP Tag Library 1.1//EN"
    "web-jsptaglib_1_1.dtd">
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>TagLib</shortname>
         <tag>
         <name>label</name>
         <tagclass>com.abc.internet.common.taglib.LiteralTag</tagclass>
         <bodycontent>empty</bodycontent>
         <info>This is a simple tag for ABC</info>
              <attribute>
                   <name>name</name>
                   <required>false</required>
                   <rtexpvalue>false</rtexpvalue>
              </attribute>
         </tag>
         <tag>
         <name>linkAccess</name>
         <tagclass>com.abc.internet.common.taglib.LinkAccessTag</tagclass>
         <bodycontent>JSP</bodycontent>
         <info>this is the tag class for showing the button</info>
         <attribute>
         <name>linkId</name>
         <required>true</required>
         <rtexpvalue>false</rtexpvalue>
         </attribute>
         <attribute>
         <name>flag</name>
         <required>true</required>
         <rtexpvalue>false</rtexpvalue>
         </attribute>
         </tag>
    </taglib>
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN'
    'file:///D:/bea/wlserver6.0sp1/web-app_2_2.dtd'>
    <web-app>
    <taglib>
    <taglib-uri>AbcTagLib</taglib-uri>
    <taglib-location>/WEB-INF/AmsTagLib.tld</taglib-location>
    </taglib>
    </web-app>
    Login.jsp
    <%@ page language="Java" errorPage="/jsp/AbcJspError.jsp" import="java.util.Vector,com.abc.internet.common.util.UtilFunctions,com.abc.internet.welcome.form.LoginForm,com.abc.internet.common.util.*"%>
    <%@ taglib uri="AbcTagLib" prefix="abc" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <HTML>
    <HEAD>
         <TITLE>LOGIN SCREEN</TITLE>
         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </HEAD>
    <BODY class="imgSpacerTan" onUnload="javascript:funcCloseErrorWindow();">
    <html:form action="/struts/Login" name="LoginForm" type="com.abc.internet.welcome.form.LoginForm"
    onsubmit="onLogin()">
         <table align="center" cellpadding=0 cellspacing=0 border=0 class="imgSpacerTan">
              <tr>
                   <td align="left">
                        <img border="0" src="../images/logo.gif">
                   </td>
              </tr>
         </table>
         <table align="center" cellpadding=0 cellspacing=0 border=0 class="imgSpacerTan">
              <tr> <td ALIGN="center" class="header" height=30px><font class="fontBlue" >Welcome
    to the</font></td></tr>
              <tr> <td ALIGN="center" class="header" height=30px><font class="fontBlue" >ABC
    System</font></td></tr>
              <tr> <td ALIGN="center" class="header" height=20>  </td></tr>
         </table>
         <table cellpadding=0 cellspacing=0 border=5 bordercolor="#293163" class="deadlineHistoryTablebgcolor"
    align="center">
              <tr class="deadlineHistoryTablebgcolor">
                   <td class="deadlineHistoryTablebgcolor">
                        <table cellpadding=10 cellspacing=10 border=0 width="400" class="deadlineHistoryTablebgcolor"
    align="center">
                             <tr>
                                  <td>
                                       <script language="javascript">
                                            if(navigator.appName.indexOf("Netscape") != -1)
                                                      document.write('<table cellpadding=0 cellspacing=0 border=1 width="400"
    bordercolor="#293163" class="deadlineHistoryTablebgcolor" align="center">');
                                            else
                                                      document.write('<table cellpadding=0 cellspacing=0 border=1 width="400"
    bordercolorlight="#293163" class="deadlineHistoryTablebgcolor" align="center">');
                                       </script>
                                            <tr>
                                                 <td>
                                                      <table cellpadding=7 cellspacing=7 border=0 width="400" bordercolor="#293163"
    class="deadlineHistoryTablebgcolor" align="center">
                                                           <tr>
                                                                <td>
                                                                     <font class="fontBlue">   USER ID       &nbsp:  </font><input
    type="text" name="iv-user">
                                                                </td>
                                                           </tr>
                                                      </table>
                                                 </td>
                                            </tr>
                                       </table>     
                                  </td>
                             </tr>
                             <tr>
                                  <td>
                                       <table cellpadding=0 cellspacing=0 border=1 width="400" class="borderBlue"
    class="deadlineHistoryTablebgcolor" align="center">
                                            <tr>
                                                 <td>
                                                      <table cellpadding=7 cellspacing=7 border=0 width="400" class="borderBlue"
    class="deadlineHistoryTablebgcolor" align="center">
                                                           <tr>
                                                                <td align="center" ><input type="submit" value="Submit" onclick="return
    (onLogin())" ></td>
                                                           </tr>
                                                      </table>
                                                 </td>
                                            </tr>
                                       </table>
                                  </td>
                             </tr>
                        </table>
                   </td>
              </tr>
         </table>
    </html:form>     
    </body>
    </html>
    Thanks

  • Content not allowed in prologue

    Anyone ever have this problem? WebLogic 8.1. Tried using latest xalan/xerces.
    Also Saxon. Seems like the xml reader is broken.
    The files I'm using for xml/xsl are trivial, and work in both xmlspy and saxon.
    None of the fixes work so far(check for whitespace or extraneous characters
    etc).
    Here's the exceptions, followed by the test case. Thanks in advance.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.jav
    a:349)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:630)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXPar
    ser.java:1189)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:138)
    at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.jav
    a:349)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:630)
    Here is a sample xml.xslt, followed by the java code to invoke it:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:param name="someparam">futureParameter</xsl:param>
    <xsl:template match="/wermdoc">
    <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="reqlines">
    <table width="100%" border="1" cellspacing="0" cellpadding="0">
    <tr bgcolor="#44FF44">
    <td>Type</td>
    <td>Status</td>
    <td>Dept ID</td>
    <td>Acct</td>
    <td>Name</td>
    <td>Item ID</td>
    <td>Description</td>
    <td>Qty</td>
    <td>UOM</td>
    <td>Price</td>
    <td>Ext. Net Price</td>
    <td>Due Date</td>
    </tr>
    <xsl:apply-templates/>
    </table>
    </xsl:template>
    <xsl:template match="reqline">
    <tr>
    <xsl:apply-templates/>
    </tr>
    </xsl:template>
    <xsl:template match="text()">
    <td>
    <xsl:value-of select="." />
    </td>
    </xsl:template>
    </xsl:stylesheet>
    <?xml version="1.0" encoding="UTF-8"?>
    <wermdoc>
    <reqlines>
    <reqline>
    <h_req_type>PO</h_req_type>
    <req_status>C</req_status>
    <deptid>003072</deptid>
    <account>50221</account>
    <name1>A A OFFICE EQUIPMENT CO INC</name1>
    <h_itm_id_inv_id>1</h_itm_id_inv_id>
    <itm_descr>1</itm_descr>
    <qty_req>1</qty_req>
    <unit_of_measure>EA</unit_of_measure>
    <price_req>1</price_req>
    <extended_net_price>1</extended_net_price>
    <due_dt>2003-08-26 00:00:00.0</due_dt>
    </reqline>
    </reqlines>
    </wermdoc>
    String stylesheet = request.getParameter("XS");
    String requestDoc = request.getParameter("DOC");
    String resultDoc = "NO INPUT";
    if ( stylesheet != null && requestDoc != null ) {
    try {
    // System.setProperty("javax.xml.transform.TransformerFactory",
    // "com.icl.saxon.TransformerFactoryImpl");
    // System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
    // "com.icl.saxon.om.DocumentBuilderFactoryImpl");
    StringWriter swriter = new StringWriter();
    Transformer trans;
    TransformerFactory factory = TransformerFactory.newInstance();
    DocumentBuilderFactory dfactory =
    DocumentBuilderFactory.newInstance();
    dfactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
    Document doc = docBuilder.parse(new File(stylesheet));
    trans =
    factory.newTransformer(new StreamSource(new File(stylesheet)));
    trans.transform(
    new StreamSource(new StringReader(requestDoc)),
    new StreamResult(swriter));
    resultDoc = swriter.toString();
    } catch (Exception e) {
    e.printStackTrace(System.out);
    end of message.

    Thanks Bruce! Saved the code to a project.
    Put another way the problem was this:
    "trans.transform(new StreamSource(new StringReader(requestDoc))"
    Should've been simply "trans.transform(new StreamSource(requestDoc)".
    My confusion was introduced through cut-n-paste and of course StringReader
    doesn't care if what it reads is simply a filename rather than the contents
    of the file. That wouldn't have happened with your code...
    Bruce Stephens <[email protected]> wrote:
    >
    Hi Rich,
    It seems to me that encoding has always been java's Achilles heel :-)
    Try the attached code and see if it works for you.
    Thanks,
    Bruce
    Rich Kucera wrote:
    Anyone ever have this problem? WebLogic 8.1. Tried using latestxalan/xerces.
    Also Saxon. Seems like the xml reader is broken.
    The files I'm using for xml/xsl are trivial, and work in both xmlspyand saxon.
    None of the fixes work so far(check for whitespace or extraneouscharacters
    etc).
    Here's the exceptions, followed by the test case. Thanks in advance.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.jav
    a:349)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:630)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXPar
    ser.java:1189)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:138)
    at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.jav
    a:349)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:630)
    Here is a sample xml.xslt, followed by the java code to invoke it:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:param name="someparam">futureParameter</xsl:param>
    <xsl:template match="/wermdoc">
    <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="reqlines">
    <table width="100%" border="1" cellspacing="0" cellpadding="0">
    <tr bgcolor="#44FF44">
    <td>Type</td>
    <td>Status</td>
    <td>Dept ID</td>
    <td>Acct</td>
    <td>Name</td>
    <td>Item ID</td>
    <td>Description</td>
    <td>Qty</td>
    <td>UOM</td>
    <td>Price</td>
    <td>Ext. Net Price</td>
    <td>Due Date</td>
    </tr>
    <xsl:apply-templates/>
    </table>
    >> </xsl:template>
    <xsl:template match="reqline">
    <tr>
    <xsl:apply-templates/>
    </tr>
    </xsl:template>
    <xsl:template match="text()">
    <td>
    <xsl:value-of select="." />
    </td>
    </xsl:template>
    </xsl:stylesheet>
    <?xml version="1.0" encoding="UTF-8"?>
    <wermdoc>
    <reqlines>
    <reqline>
    <h_req_type>PO</h_req_type>
    <req_status>C</req_status>
    <deptid>003072</deptid>
    <account>50221</account>
    <name1>A A OFFICE EQUIPMENT CO INC</name1>
    <h_itm_id_inv_id>1</h_itm_id_inv_id>
    <itm_descr>1</itm_descr>
    <qty_req>1</qty_req>
    <unit_of_measure>EA</unit_of_measure>
    <price_req>1</price_req>
    <extended_net_price>1</extended_net_price>
    <due_dt>2003-08-26 00:00:00.0</due_dt>
    </reqline>
    </reqlines>
    </wermdoc>
    String stylesheet = request.getParameter("XS");
    String requestDoc = request.getParameter("DOC");
    String resultDoc = "NO INPUT";
    if ( stylesheet != null && requestDoc != null ) {
    try {
    // System.setProperty("javax.xml.transform.TransformerFactory",
    // "com.icl.saxon.TransformerFactoryImpl");
    // System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
    // "com.icl.saxon.om.DocumentBuilderFactoryImpl");
    StringWriter swriter = new StringWriter();
    Transformer trans;
    TransformerFactory factory = TransformerFactory.newInstance();
    DocumentBuilderFactory dfactory =
    DocumentBuilderFactory.newInstance();
    dfactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
    Document doc = docBuilder.parse(new File(stylesheet));
    trans =
    factory.newTransformer(new StreamSource(new File(stylesheet)));
    trans.transform(
    new StreamSource(new StringReader(requestDoc)),
    new StreamResult(swriter));
    resultDoc = swriter.toString();
    } catch (Exception e) {
    e.printStackTrace(System.out);
    end of message.import java.io.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    public class testcode {
    public static void main(String[] args) throws Exception {
    try {
    FileInputStream fis = new FileInputStream( "theData.xml" );
    InputStreamReader ir = new InputStreamReader(fis , "UTF-8");
    BufferedReader br = new BufferedReader(ir);
    Source source = new javax.xml.transform.stream.StreamSource( br );
    StringWriter swriter = new StringWriter();
    Transformer trans;
    TransformerFactory factory = TransformerFactory.newInstance();
    trans = factory.newTransformer(new StreamSource(new File("stylesheet.xslt")));
    trans.transform( source, new StreamResult(swriter));
    String resultDoc = swriter.toString();
    System.out.println("OK: " + resultDoc);
    } catch (Exception e) {
    e.printStackTrace(System.out);

  • Import org.xml.sax is deprecated

    Hi All, Please help ... I am a beginner of using SAX with Java. I think I don't have the org.xml.sax.* classes in my java class. So, I downloaded "saxjava-1.0" from www.megginson.com (I hope I downloaded the correct one). I unzipped the file and put it in my Java folder. However, it doesn't work when I run my Java code. I think I might missed out something ... like didn't import the file to Java classes? If so, how can I do that? My java code is trying to read an XML file and print out how many books in the xml file. After compiled, it has the following message:
    "package com.jclark.xml.sax does not exists"
    and 2 compiler warnings:
    C:\XML\BookCounter.java:12:warning:org.xml.sax.HandlerBase in org.xml.sax has been deprecated.
    C:\XML\BookCounter.java:21:warning:org.xml.sax.Parser in org.xml.sax has been deprecated.
    My java code as follow:
    import org.xml.sax.*;
    public class BookCounter extends HandlerBase
    public static void main (String args[]) throws Exception
    (new BookCounter()).countBooks();
    public void countBooks() throws Exception
    Parser p = new com.jclark.xml.sax.Driver();
    p.setDocumentHandler(this);
    p.parse("file:///C:/books.xml");

    the error message "package com.jclark.xml.sax does not exists" has nothign to do with the post you coded, as it imports "org.xml.sax.*" and not "com.jclark.xml.sax.*".
    download sax from here: http://sourceforge.net/project/showfiles.php?group_id=29449 (sax2r2.jar), add it to your classpath and read the following how to use it:
    http://java.sun.com/webservices/docs/ea2/tutorial/doc/JAXPSAX3.html#64190

  • CONTENT NOT ALLOWED IN PROLONG

    HI,
    I AM doing simple file2file senario in SXMB_MONI its showing redflag and i tested the source code in testing its showing the following error
    CONTENT NOT ALLOWED IN PROLONG
    Regards,
    Prasad

    Hi Prasad,
    It seems that your input payload is not correct. Take the input payload and test it in Message mapping. Check What error you are getting there. Also in test tab of message put manually the data your are getting in input payload. Check if it execute successfully.  If yes then problem is with the input payload. If not then issue with data.

  • WavesetException: XML Error: 1:1: Content is not allowed in prolog. error

    What gives?
    I have turned the exception trace on (why it is not on by default is a surprise) and when I try to create a standard Weekly Audit Report, (Activity this Week) I now get to see this exception.
    How on earth can IdM generate a badly formed XML report/document!?
    When I try to generate a Weekly Activity report, Idm reports to the screen that the Task is complete and then bombs out with the following exception, showing NullPointerError message on the screen.
    What chances are there of trapping where in Idm this fault lies?
    [#|2011-11-16T15:18:44.609+0200|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=94;_ThreadName=Thread-2;|WavesetException: XML Error: 1:1: Content is not allowed in prolog.|#]
    [#|2011-11-16T15:18:44.612+0200|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=94;_ThreadName=Thread-2;|com.waveset.util.XmlParseException: XML Error: 1:1: Content is not allowed in prolog.
    at com.waveset.util.WavesetException.checkBreakpoint(WavesetException.java:508)
    at com.waveset.util.WavesetException.<init>(WavesetException.java:109)
    at com.waveset.util.XmlParseException.<init>(XmlParseException.java:61)
    at com.waveset.util.XmlParser.wrapException(XmlParser.java:927)
    at com.waveset.util.XmlParser.parseString(XmlParser.java:561)
    at com.waveset.util.XmlUtil.parseString(XmlUtil.java:441)
    at com.waveset.util.XmlObjectFactory.create(XmlObjectFactory.java:322)
    at com.waveset.util.XmlObjectFactory.create(XmlObjectFactory.java:302)
    at com.waveset.rpc.ActivityStatusServlet.getTaskStatus(ActivityStatusServlet.java:426)
    at com.waveset.rpc.ActivityStatusServlet.getTaskStatus(ActivityStatusServlet.java:403)
    at com.waveset.rpc.ActivityStatusServlet.processRequest(ActivityStatusServlet.java:360)
    at com.waveset.rpc.ActivityStatusServlet.doGet(ActivityStatusServlet.java:262)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at com.sun.idm.profiler.instrumentation.RequestTimingFilter.doFilter(RequestTimingFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
    |#]

    Hi Anoop / Ilayarajan,
    Could you please post the solution for this error. When I provision a user to PeopleSoft, I am getting similar error: com.waveset.util.WavesetException: An error occurred adding user "userID' to resource 'PeopleSoft Component Interface'. com.waveset.util.XmlParseException: XML Error: 1:1: Content is not allowed in prolog.
    Thanks
    User_idm

Maybe you are looking for

  • How to create a build.xml file ??

    Hi there, I am learning j2ee at the moment. I have been throught the tutorial and got everything working (finally). however, now that I have started writing my own code, I am stuck with writing the build.xml file (as this is not covered in the tutori

  • Shared Reminders: How do I stop getting emails when changes are made?

    My wife and I both have iPhone 5's that we bought 2 weeks ago. We are sharing a calendar and a "Grocery" list in reminders. I have everything set up where it is working properly but I keep getting emails when a change is made to the grocery list. I d

  • I developed smartforms problem is alingment

    hi, i developed smart forms templete with 4 colums output of 4 th colum am populatilng currency but it is not alilnged properly it is alin like this 100.00   200.00 10000.00 100.00 could u plz tell me what are the steps i want to do for proper alingm

  • Problem While checkin in NWDI  adding TableSorter.java class in src of DC

    Hi I have added TableSorter.java class in Source folder of One Develop Component and implemented the code to sort the table.It is working fine Locally.     While I am trying to checkin in NWDI it is throwing error messages like location: package test

  • Getting an image from a file

    I am trying to get an image from a file is there a way to convert a BufferedImage into an Image? or otherwise get an Image directly from a file? my searches turn up nothing TIA