Details
Description
Hi!
When I update or create an xml file using the command:
OperationImpl.java
XmlUtils.writeXml(webXmlMutableFile.getOutputStream(), webXml);
The updated XML (i.e. layouts.xml) loses its DTD definition:
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd"> <tiles-definitions>
DOCTYPE disappears using this command in ROO v1.1.0-M1.
I solved it using Transformer and call the other writeXml method in XmlUtils to update/create a file:
OperationImpl.java
final static String DOCTYPE_PUBLIC = "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"; final static String DOCTYPE_SYSTEM = "http://tiles.apache.org/dtds/tiles-config_2_1.dtd"; . . TransformerFactory transformerFactory = TransformerFactory .newInstance(); // Define DTD Transformer xformer; try { xformer = transformerFactory.newTransformer(); } catch (Exception ex) { throw new IllegalStateException(ex); } xformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, DOCTYPE_PUBLIC); xformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, DOCTYPE_SYSTEM); XmlUtils.writeXml(xformer, webXmlMutableFile.getOutputStream(), layoutsXml);
In ROO v1.0.2 this bug doesn't exists.
Thanks!