xGen is to creating XML what XPath is to reading XML.
The string
/html/body/div#container/div.menu/ul/li[5]
Can be used to create XML.
This saves a lot of boilerplate code when generating XML and a templating mechanism is not a good fit for your project.