Hi,
I'm getting the following from MPXJ 4.7.6, it was originally working and now there is a problem with the following line:
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
Here is the exception which pointed me to it
java.lang.IllegalArgumentException
at oracle.xml.jaxp.JXTransformer.setOutputProperty(JXTransformer.java:796)
at net.sf.mpxj.primavera.PrimaveraPMFileWriter.write(PrimaveraPMFileWriter.java:112)
at net.sf.mpxj.writer.AbstractProjectWriter.write(AbstractProjectWriter.java:55)
at pmsched.writer.PrimaveraWriter.writeScheduleToPMXML(PrimaveraWriter.java:49)
at pmsched.ExportPrimaveraPMXMLAction.execute(ExportPrimaveraPMXMLAction.java:105)
I tried the namespace URI though this it returns a 404 now, as Apache has retired the XML project. Is this a brand new error? I can't just upgrade to the last release as there were many API changes causing my methods to break. I see the same line in version 5.2.1 as well.
It may not be required anyways, I'm trying to find a way to build the version 4.7.6 without it, looks like I'm missing some pieces to the puzzle.
Thanks,
Andrew H
So it seems there is a problem using the Oracle JDeveloper 11g IDE, see the following thread:
http://stackoverflow.com/questions/25996464/illegalargumentexception-at-oracle-xml-jaxp-jxtransformer-setoutputproperty
Therefore its required to create a TransformerFactory as a specific factory class, example in thread below
http://stackoverflow.com/questions/2968190/how-to-select-saxon-transformerfactory-in-java
So the fix was to make xalan.jar exist on the classpath and change
TransformerFactory transFact = TransformerFactory.newInstance();
to
TransformerFactory transFact = TransformerFactory.newInstance("org.apache.xalan.processor.TransformerFactoryImpl", null);
Though it resolved the exception there is no indentation in the output. Not exactly sure how to resolve this yet.
I've added some code to the latest version which just swallows any exceptions raised when trying to configure the transformer. You won't get the nice indentation, but you should get usable XML. Let me know if this doesn't work for you.
Jon