Menu

#79 XML Parsing error when running pldoc in ant

open
nobody
None
5
2014-08-28
2011-11-25
No

Hi Team,

I am getting following XML parsing error when I use the pldoc ant task.
[pldoc] XML-22004: (Fatal Error) Error while parsing input XML document (Expected 'version '1.0''.).

BUILD FAILED
/home/amlsad01/build.xml:999: ; SystemID: file:/home/amlsad01/pldoc-0.9.6/documentation/application.xml; Line#: 1479; Column#: 1
javax.xml.transform.TransformerException: XML-22004: (Fatal Error) Error while parsing input XML document (Expected 'version '1.0''.).

The XML version in application.xml is 1.1. I am facinf this issue for pldoc ver 0.9.4, 0.9.5 as well as the latest 0.9.6

The pldoc ant task I am using is:-
<taskdef name="pldoc" classname="net.sourceforge.pldoc.ant.PLDocTask">
<classpath>
<pathelement location="${pldir}/target/pldoc-0.9.6-jar-with-dependencies.jar" />
<pathelement location="${JDBC_HOME}/ojdbc6.jar"/>
</classpath>
</taskdef>
<pldoc verbose="yes" destdir="${pldir}/documentation" doctitle="${dirname}">
<fileset dir="${pldir}/pkg" includes="*.pks" />
</pldoc>

However, there is no error when I use the exec task in ant.
<property name="arg.list" value="-doctitle ${dirname} -d ${pldir}/documentation -verbose ${dir.stg.pkg}/*.pks" />
<exec executable="${pldir}/pldoc.sh" description="Generate documentation" failonerror="true">
<arg line="${arg.list}" />
</exec>

Please fix this bug.

Thanks, Gurpreet

Discussion

  • Stuart Turton

    Stuart Turton - 2011-11-26

    First: does pldoc_ant_example.sh pldoc_ant_example.bat work?

    Second: what is your environment: e.g.

    operating system:
    ANT version
    java version

    This is my environment, where is working fine:-
    primary:trunk sturton$ uname -a
    Darwin primary 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
    primary:trunk sturton$ ant -version
    Apache Ant(TM) version 1.8.2 compiled on June 3 2011
    primary:trunk sturton$ java -version
    java version "1.6.0_29"
    Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
    Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
    primary:trunk sturton$

     
  • Anonymous

    Anonymous - 2011-11-28

    Hi Stuart,
    Thanks for a quick response.
    I am getting following errors when running pldoc_ant_example.sh

    [pldoc] XML-22004: (Fatal Error) Error while parsing input XML document (Expected 'version '1.0''.).

    BUILD FAILED
    /home/amlsad01/pldoc-0.9.6/ant_example.xml:37: ; SystemID: file:/home/amlsad01/pldoc-0.9.6/SampleApplicationDoc/application.xml; Line#: 1809; Column#: 1
    javax.xml.transform.TransformerException: XML-22004: (Fatal Error) Error while parsing input XML document (Expected 'version '1.0''.).
    at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:905)

    Buildfile: /home/amlsad01/pldoc-0.9.6/ant_enterprise_example.xml

    BUILD FAILED
    /home/amlsad01/pldoc-0.9.6/ant_enterprise_example.xml:24: taskdef class net.sourceforge.pldoc.ant.PLDocTask cannot be found
    using the classloader AntClassLoader[/opt/oracle/product/11.2.0.1.0/client/64/jdbc/lib/ojdbc6.jar:/opt/oracle/product/11.2.0.1.0/client/64/jdbc/lib/ojdbc5.jar]

    I have not modified any of the files packged in the pldoc tar. the XML version in ant_example.xml and ant_enterprise_example.xml is 1.0.

    The environment details of my machine are :-
    /home/amlsad01> uname -a
    Linux lonrsx123.abc.net 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
    /home/amlsad01> ant -version
    Apache Ant version 1.8.1 compiled on April 30 2010
    /home/amlsad01> java -version
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

    I have found a workaround by calling pldoc using the exec task in ant.
    However, I will appreciate any help in solving/ finding the root cause of this problem.

    Thanks, Gurpreet

     
  • Stuart Turton

    Stuart Turton - 2011-11-28

    The parser is the Oracle parser
    [
    Line#: 1809; Column#: 1
    javax.xml.transform.TransformerException: XML-22004: (Fatal Error) Error
    while parsing input XML document (Expected 'version '1.0''.).
    at
    oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:905)
    ]

    In order to cope with (carriage returns?) application.xml is declared as XML 1.1- it looks as if the Oracle parser cannot cope with version 1.1.

    "<?xml version="1.1" encoding="UTF-8" standalone="no"?>"

    Possibly some of these system properties are set in the ANT build file, or in the JRE_HOME/lib/jaxp.properties file (unlikely)

    To test this try setting these system properties on the ANT command line

    -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl

    -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl

    !-- xml -->

    <system-property javax.xml.parsers.DocumentBuilderFactory=
    "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
    <system-property javax.xml.parsers.SAXParserFactory=
    "org.apache.xerces.jaxp.SAXParserFactoryImpl"/>

    <!-- xslt -->

    <system-property javax.xml.transform.TransformerFactory=
    "org.apache.xalan.processor.TransformerFactoryImpl"/>

     
  • Stuart Turton

    Stuart Turton - 2011-11-28

    The other (undesirable) way is to force the by seeing the system property/properties
    in PLDoc.java (see below)

    I have no idea whether this would mess up subsequent ANT tasks

    "
    import java.io.FileOutputStream;
    import java.util.Properties;

    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;

    public class MainClass {
    public static void main(String argv[]) throws Exception {
    Properties props = System.getProperties();
    props.put("javax.xml.transform.TransformerFactory",
    "org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
    System.setProperties(props);
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Templates translet = tFactory.newTemplates(new StreamSource(
    "OrderProcessing.xslt"));

    Transformer transformer = translet.newTransformer();

    transformer.transform(new StreamSource("CustomerOrders.xml"),
    new StreamResult(new FileOutputStream("SortedOrders.html")));

    transformer.transform(new StreamSource("CustomerOrders1.xml"),
    new StreamResult(new FileOutputStream("SortedOrders1.html")));

    }
    }

    "

     
  • Anonymous

    Anonymous - 2011-11-29

    Hi Stuart,

    I appreciate your help but I could not understand a part of your last comment and the settings required to make pldoc task work.
    So, I have rather used ant exec task to call pldoc command which is working fine.
    You may close this bug as rejected/invalid.

    Thanks

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.