para = doc.createElement("para") para.appendChild(doc.createTextNode("I think widgets are great.you should buy lots \ of them from")) company = doc.createElement("company") company.appendChild(doc.createTextNode("Springy widgets,Inc")) para.appendChild(company)
<?xmlversion="1.0" ?> <book> <title> Sample XML Thing </title> <author> <name> <first> Benjamin </first> <last> Smith </last> </name> </author> <chapter number="1"> <title> Fisrt Chapter </title> <para> I think widgets are great.you should buy lots of them from <company> Springy widgets,Inc </company> </para> </chapter> </book>