Example #1
0
 def testFormat(self):
     x = XMLBuilder('utf-8', format=True)
     with x.root():
         x << ('array', )
         with x.array(len=10):
             with x.el(val=0):
                 pass
             with x.el('xyz', val=1):
                 pass
             x << ("el", "abc", {'val': 2}) << ('el', dict(val=3))
             x << ('el', dict(val=4)) << ('el', dict(val='5'))
             with x('sup-el', val=23):
                 x << "test  "
     self.assertEqual(str(x), result1)
Example #2
0
 def testFormat(self):
     x = XMLBuilder('utf-8',format = True)
     with x.root():
         x << ('array',)
         with x.array(len = 10):
             with x.el(val = 0):
                 pass
             with x.el('xyz',val = 1):
                 pass
             x << ("el","abc",{'val':2}) << ('el',dict(val=3))
             x << ('el',dict(val=4)) << ('el',dict(val='5'))
             with x('sup-el',val = 23):
                 x << "test  "
     self.assertEqual(str(x),result1)