In TCL, if you use the DOM package (available in the ActiveState distribution) you can create an xml.
set xmlDoc [::dom::create]
set root [::dom::document createElement $xmlDoc "trafficStatistics"]
set statElement [::dom::document createElement $root "Tx_Frames"]
::dom::element setAttribute $statElement "type" "numericlist"
::dom::element setAttribute $statElement "displayName" "Tx Frames"
puts [::dom::serialize $xmlDoc -indent true]
creating this simple xml:
<result>
<trafficStatistics type="structure">
<Tx_Frames type="numericlist" displayName="Tx Frames"></Tx_Frames>
</trafficStatistics>
</result>
How can I add some data to the Tx_Frames element?
<Tx_Frames type="numericlist" displayName="Tx Frames">some data</Tx_Frames>
Note that the dom package is actually a wrapper over libxml2