Element root = factory.element("root");
root.addContent(parent2);
root.addContent(parent1);
Attribute rootAttr1 = factory.attribute("rootAttr1", "value");
Attribute rootAttr2 = factory.attribute("rootAttr2", "value");
Attribute parentAttr1 = factory.attribute("parentAttr1", "value");
root.setAttribute(rootAttr2);
root.setAttribute(rootAttr1);
parent1.setAttribute(parentAttr1);