I downloaded the new Xerces 2.8 release to try out the new pretty print feature.
But I still get the error :
org.w3c.dom.DOMException: FEATURE_NOT_SUPPORTED: The parameter format-pretty-print is recognized but the requested value cannot be set.
at org.apache.xml.serialize.DOMSerializerImpl.setParameter(Unknown Source)
at com.dd.xml.dom.DomUtils.serializetoString(DomUtils.java:238)


I am using the following method:

public static String serializetoString(Document document)
{
DOMImplementationLS implls =
(DOMImplementationLS) document.getImplementation();
LSSerializer domWriter = implls.createLSSerializer();
DOMStringList list = domWriter.getDomConfig().getParameterNames();
for (int i = 0; i < list.getLength(); i++)
{
System.out.println(list.item(i));
}
if (domWriter
.getDomConfig()
.canSetParameter("format-pretty-print", Boolean.TRUE))
{
System.out.println("pretty-print works now!!");
domWriter.getDomConfig().setParameter(
"format-pretty-print",
Boolean.TRUE);
}


domWriter.setNewLine("\n");
return domWriter.writeToString(document);

}

Any suggestions ?
Dick Deneer

Reply via email to