Community
Participate
Working Groups
In org.eclipse.jst.server.tomcat.core.internal.xml.Factory.java it was requested to improve the xml formatting. 53: // TODO Try to improve formating, maybe dup an appropriate text node Initially an attempt was made to use a TransformerFactory within javax.xml.transform however it didn't always honor the current indentation of the existing XML. On occasion it also wouldn't indent correctly even though it should have. Therefore code was written to do a better job honoring existing indentation as well as remove extraneous indentation that may have been added by prior indentation requests. This patch attempts to determine the most common indentation level for a Node and then copy it to the node being inserted. When an indented node is removed the extra space is removed. If there was no indentation, such as server.xml files prior to this implementation it will leave the existing node. server.xml prior to patch: (Note Context right next to end of Valve) ... Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." resolveHosts="false" suffix=".txt"/><Context docBase="WebApplication1" path="/WebApplication1" reloadable="true" source="org.eclipse.jst.jee.server:WebApplication1"/> </Host> ... Would now have Context on its own line with the correct indentation ... Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." resolveHosts="false" suffix=".txt"/> <Context docBase="WebApplication1" path="/WebApplication1" reloadable="true" source="org.eclipse.jst.jee.server:WebApplication1"/> </Host> ...
Created attachment 180533 [details] Improve XML formatting