Advertisement
Guest User

Untitled

a guest
Oct 1st, 2012
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import xml.dom.minidom as minidom
  4. import base64
  5.  
  6. def main():
  7.     xml = minidom.parse('index.xml')
  8.     print '<table border="1">'
  9.     for tnode in xml.getElementsByTagName('tabpage'):
  10.         print '<tr><td colspan="4"><b>%s tab</b></td></tr>' % (
  11.             base64.b64decode(tnode.attributes['name'].value))
  12.  
  13.         for node in tnode.childNodes:
  14.             if node.attributes.has_key('osc_cs'):
  15.                 name = base64.b64decode(node.attributes['name'].value)
  16.                 osc = node.attributes['osc_cs'].value
  17.                 tp = node.attributes['type'].value
  18.                 print '<tr><td>%s</td><td>%s</td><td>%s</td>' % (
  19.                     name, tp, osc)
  20.  
  21.                 print '<td><font size="-1">'
  22.                 for a in node.attributes.items():
  23.                     if a[0] not in ['name', 'osc_cs', 'type']:
  24.                         if a[0] == 'text':
  25.                             value = base64.b64decode(a[1])
  26.                         else:
  27.                             value = a[1]
  28.                         print '<i>%s</i>: %s ' % (a[0], value)
  29.                 print "</font></td></tr>"
  30.     print '</table>'
  31.  
  32. if __name__ == '__main__':
  33.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement