Python inline of XML or ASCII string/template?
<p>I am generating complex XML files through Python scripts that require a bunch of conditional statements (example <a href="http://repository.azgs.az.gov/uri_gin/azgs/dlio/536/iso19139.xml" rel="nofollow">http://repository.azgs.az.gov/uri_gin/azgs/dlio/536/iso19139.xml</a>). I am working with multiple XML or ASCII metadata standards that often have poor schema or are quite vague. </p>

<p>In PHP, I just wrote out the XML and inserted PHP snippets where needed. Is there an easy way to do that in Python? I am trying to avoid having to escape all that XML. The inline method is also very helpful for tweaking the template without much rewrite.</p>

<p>I have looked a bit into Python templeting solutions but they appeared either too static or were overkill. Moving the whole XML into an XML object is a lot of work at a cost of flexibility when changing the XML or ASCII template.</p>

<p>Thanks for the newbie support!</p>
