I want to write an XML file in java as follows. \[code\]<Model> <Type name="A"> <SubType name="B" type="b"/> <SubType name="C" type="c"/> <SubType name="D" type="d"/> </Type> <Type name="B"> <SubType name="E" type="e"/> <SubType name="F" type="f"/> <SubType name="G" type="g"/> </Type> <Type name="C"> <SubType name="H" type="h"/> <SubType name="I" type="i"/> <SubType name="J" type="j"/> </Type> <Type name="D"> <SubType name="K" type="k"/> <SubType name="L" type="l"/> <SubType name="M" type="m"/> </Type></Model>\[/code\]I am getting output as \[code\]<Model> <Type name="A"> <SubType name="B" type="b"/> <SubType name="C" type="c"/> <SubType name="D" type="d"/> </Type> <Type name="B"> <SubType name="E" type="e"/> <SubType name="F" type="f"/> <SubType name="G" type="g"/> </Type> <Type name="C"> <SubType name="H" type="h"/> <SubType name="I" type="i"/> <SubType name="J" type="j"/> </Type> <Type name="D"> <SubType name="K" type="k"/> <SubType name="L" type="l"/> <SubType name="M" type="m"/> </Type></Model>\[/code\]I want new line to be present between \[code\]Type\[/code\] tags. How to achieve this?My java code writing into xml is,\[code\]TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer();transformer.setOutputProperty (OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{xml.apache.org/xslt}indent-amount", "2");DOMSource source = new DOMSource(doc); FileOutputStream fos = new FileOutputStream(new File(fileName)); StreamResult result = new StreamResult(fos); transformer.transform(source, result); \[/code\]Java code for creating elements,\[code\]Element root = doc.createElement("Model"); doc.appendChild(root); Element type = doc.createElement("Type"); root.appendChild(type); Element subType = doc.createElement("SubType"); type.appendChild(subType);\[/code\]