I am using transformer to transform one type to another type. Code for this is
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//Getting error here
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new FileWriter(outputFilePath));
transformer.transform(source, result);
The Stack trace of the exception is java.lang.IllegalArgumentException at oracle.xml.jaxp.JXTransformer.setOutputProperty(JXTransformer.java:798)
I am using Jdeveloper and its java version 1.6 added jars jdom1.0 and xercesimpl.jar
Will any one help on this.
You are using the (rarely-used) Oracle XSLT engine (the one that Oracle developed before they acquired Sun and Java), but you are supplying an output property defined by Apache Xalan. Decide which XSLT engine you actually want to use, and then don't set properties that this engine doesn't recognize (or catch the exception).
Actually setOutputProperty() shouldn't really throw this exception when the property name is namespace-qualified, but the spec doesn't say this all that clearly, and in any case the spec has been considerably refined since the Oracle processor was last updated, so it's not totally unreasonable.