import nu.xom.*; public class Domains { public static void main(String[] arguments) { // Create elements, text elements, and an element attribute Element domains = new Element("domains"); Element domain = new Element("domain"); Element name = new Element("name"); Element dns = new Element("dns"); Element ttl = new Element("ttl"); Element ip = new Element("ip"); Element webdir = new Element("webdir"); Attribute status = new Attribute("status", "parked"); Text nameText = new Text("java21days.com"); Text ttlText = new Text("86400"); // Create a document using the domains root element Document doc = new Document(domains); // Add XML data to the root element domains.appendChild(domain); domain.appendChild(name); name.appendChild(nameText); domain.appendChild(dns); dns.appendChild(ttl); ttl.appendChild(ttlText); dns.appendChild(ip); ip.appendChild("64.81.250.253"); domain.appendChild(webdir); webdir.appendChild("/web/java21days"); webdir.addAttribute(status); // Display the XML document System.out.println(doc.toXML()); } }