#!/usr/bin/env python

import unittest

from genshi.template import MarkupTemplate

tmpl_data = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:py="http://genshi.edgewall.org/">

  <py:match path="body" once="true" buffer="false">
    <body>
        <div id="banner">
            This is the original text in ticket
        </div>
    </body>
  </py:match>

  <body>
  </body>
</html>"""

class TestInvalidXml(unittest.TestCase):
    def test_invalid_xml(self):
        tmpl = MarkupTemplate(tmpl_data)
        output = tmpl.generate().render('xhtml', doctype='xhtml')
        print output
        from xml.dom.minidom import parseString
        parseString(output)



