- To create an element use createElement method and pass
it a tag
Element itemElement = doc.createElement("item");
- To create a text node, use createTextNode and pass it
a string
Text quantityText= doc.createTextNode("8");
- Use setAttribute method to add an attribute to the tag
priceElement.setAttribute("currency", "USD");