diff orpg/gametree/nodehandlers/d20.py @ 118:217fb049bd00 alpha

Traipse Alpha 'OpenRPG' {091028-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! Changes made to the map for increased portability. SnowDog has changes planned in Core, though. Added an initial push to the BCG. Not much to see, just shows off how it is re-writing Main code. Fix to remote admin commands Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! Fix to Splitter Nodes not being created. Added images to Plugin Control panel for Autostart feature Fix to massive amounts of images loading; from Core fix to gsclient so with_statement imports Added 'boot' command to remote admin Prep work in Pass tool for remote admin rankings and different passwords, ei, Server, Admin, Moderator, etc. Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes. Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without breaking) {091028} 00: Made changes to gametree to start working with Element Tree, mostly from Core Minor changes to Map to start working with Element Tree, from Core Preliminary changes to map efficiency, from FlexiRPG Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Changes to main.py to start working with Element Tree
author sirebral
date Wed, 28 Oct 2009 14:24:54 -0500
parents c5bc2abaf7f8
children 8827271fbe1b
line wrap: on
line diff
--- a/orpg/gametree/nodehandlers/d20.py	Mon Oct 12 23:24:10 2009 -0500
+++ b/orpg/gametree/nodehandlers/d20.py	Wed Oct 28 14:24:54 2009 -0500
@@ -30,6 +30,8 @@
 
 from core import *
 import re
+from xml.etree.ElementTree import ElementTree, Element, iselement
+from xml.etree.ElementTree import fromstring, tostring, parse, XML
 
 D20_EXPORT = wx.NewId()
 ############################
@@ -42,12 +44,12 @@
     """ should not be used! only a base class!
     <nodehandler name='?'  module='core' class='container_handler'  />
     """
-    def __init__(self,xml_dom,tree_node):
-        node_handler.__init__(self,xml_dom,tree_node)
+    def __init__(self,xml,tree_node):
+        node_handler.__init__(self,xml,tree_node)
         self.load_children()
 
     def load_children(self):
-        children = self.master_dom._get_childNodes()
+        children = self.xml._get_childNodes()
         for c in children:
             self.tree.load_xml(c,self.mytree_node)
 
@@ -60,9 +62,9 @@
             return
         opt = wx.MessageBox("Add node as child?","Container Node",wx.YES_NO|wx.CANCEL)
         if opt == wx.YES:
-            xml_dom = self.tree.drag_obj.delete()
-            xml_dom = self.master_dom.insertBefore(xml_dom,None)
-            self.tree.load_xml(xml_dom, self.mytree_node)
+            xml = self.tree.drag_obj.delete()
+            xml = self.xml.insertBefore(xml,None)
+            self.tree.load_xml(xml, self.mytree_node)
             self.tree.Expand(self.mytree_node)
         elif opt == wx.NO:
             node_handler.on_drop(self,evt)
@@ -70,7 +72,7 @@
     def tohtml(self):
         cookie = 0
         html_str = "<table border=\"1\" ><tr><td>"
-        html_str += "<b>"+self.master_dom.getAttribute("name") + "</b>"
+        html_str += "<b>"+self.xml.get("name") + "</b>"
         html_str += "</td></tr>\n"
         html_str += "<tr><td>"
 
@@ -110,8 +112,8 @@
     """ Node handler for a d20 charactor
         <nodehandler name='?'  module='d20' class='d20char_handler2'  />
     """
-    def __init__(self,xml_dom,tree_node):
-        node_handler.__init__(self,xml_dom,tree_node)
+    def __init__(self,xml,tree_node):
+        node_handler.__init__(self,xml,tree_node)
         self.frame = component.get('frame')
         self.child_handlers = {}
         self.new_child_handler('howtouse','HowTO use this tool',d20howto,'note')
@@ -136,38 +138,32 @@
     def on_version(self,old_version):
         node_handler.on_version(self,old_version)
         if old_version == "":
-            tmp = open(orpg.dirpath.dir_struct["nodes"]+"d20character.xml","r")
-            xml_dom = parseXml_with_dlg(self.tree,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            ## add new nodes
+            data = parse(orpg.dirpath.dir_struct["nodes"]+"d20character.xml").getroot()
             for tag in ("howtouse","inventory","powers","divine","pp"):
-                node_list = xml_dom.getElementsByTagName(tag)
-                self.master_dom.appendChild(node_list[0])
+                self.xml.append(data.find(tag))
 
             ## add new atts
-            melee_attack = self.master_dom.getElementsByTagName('melee')[0]
-            melee_attack.setAttribute("second","0")
-            melee_attack.setAttribute("third","0")
-            melee_attack.setAttribute("forth","0")
-            melee_attack.setAttribute("fifth","0")
-            melee_attack.setAttribute("sixth","0")
-            range_attack = self.master_dom.getElementsByTagName('ranged')[0]
-            range_attack.setAttribute("second","0")
-            range_attack.setAttribute("third","0")
-            range_attack.setAttribute("forth","0")
-            range_attack.setAttribute("fifth","0")
-            range_attack.setAttribute("sixth","0")
+            melee_attack = self.xml.find('melee')
+            melee_attack.set("second","0")
+            melee_attack.set("third","0")
+            melee_attack.set("forth","0")
+            melee_attack.set("fifth","0")
+            melee_attack.set("sixth","0")
+            range_attack = self.xml.find('ranged')
+            range_attack.set("second","0")
+            range_attack.set("third","0")
+            range_attack.set("forth","0")
+            range_attack.set("fifth","0")
+            range_attack.set("sixth","0")
 
-            gen_list = self.master_dom.getElementsByTagName('general')[0]
+            gen_list = self.xml.find('general')
 
             for tag in ("currentxp","xptolevel"):
-                node_list = xml_dom.getElementsByTagName(tag)
-                gen_list.appendChild(node_list[0])
+                gen_list.append(data.find(tag))
             ## temp fix
-            #parent = self.master_dom._get_parentNode()
-            #old_dom = parent.replaceChild(xml_dom,self.master_dom)
-            #self.master_dom = xml_dom
+            #parent = self.xml._get_parentNode()
+            #old_dom = parent.replaceChild(xml,self.xml)
+            #self.xml = xml
         print old_version
 
 
@@ -185,11 +181,10 @@
 
 
     def new_child_handler(self,tag,text,handler_class,icon='gear'):
-        node_list = self.master_dom.getElementsByTagName(tag)
         tree = self.tree
         i = self.tree.icons[icon]
         new_tree_node = tree.AppendItem(self.mytree_node,text,i,i)
-        handler = handler_class(node_list[0],new_tree_node,self)
+        handler = handler_class(self.xml.find(tag),new_tree_node,self)
         tree.SetPyData(new_tree_node,handler)
         self.child_handlers[tag] = handler
 
@@ -264,7 +259,7 @@
                 panel = obj.get_design_panel(self)
             else:
                 panel = obj.get_use_panel(self)
-            name = obj.master_dom.getAttribute("name")
+            name = obj.xml.get("name")
 
             if panel:
                 self.AddPage(panel,name)
@@ -297,14 +292,13 @@
     """ Node Handler for skill.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        node_handler.__init__(self,xml_dom,tree_node)
+    def __init__(self,xml,tree_node,parent):
+        node_handler.__init__(self,xml,tree_node)
         self.char_hander = parent
         self.drag = False
         self.frame = component.get('frame')
         self.myeditor = None
 
-
     def on_drop(self,evt):
         pass
 
@@ -314,7 +308,7 @@
     def on_ldclick(self,evt):
         return
         if self.myeditor == None or self.myeditor.destroyed:
-            title = self.master_dom.getAttribute('name') + " Editor"
+            title = self.xml.get('name') + " Editor"
             self.myeditor = wx.Frame(self.frame, -1, title)
             if wx.Platform == '__WXMSW__':
                 icon = wx.Icon(orpg.dirpath.dir_struct["icon"]+'grid.ico', wx.BITMAP_TYPE_ICO)
@@ -330,7 +324,7 @@
     def on_html(self,evt):
         html_str = self.tohtml()
         wnd = http_html_window(self.frame.note,-1)
-        wnd.title = self.master_dom.getAttribute('name')
+        wnd.title = self.xml.get('name')
         self.frame.add_panel(wnd)
         wnd.SetPage(html_str)
 
@@ -348,27 +342,26 @@
     """ Node Handler for skill.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
         tree = self.tree
         icons = self.tree.icons
-        node_list = self.master_dom.getElementsByTagName('skill')
         self.skills={}
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall('skill'):
+            name = n.get('name')
             self.skills[name] = n
             new_tree_node = tree.AppendItem(self.mytree_node,name,icons['gear'],icons['gear'])
             tree.SetPyData(new_tree_node,self)
 
     def get_mod(self,name):
         skill = self.skills[name]
-        stat = skill.getAttribute('stat')
-        ac = int(skill.getAttribute('armorcheck'))
+        stat = skill.get('stat')
+        ac = int(skill.get('armorcheck'))
         if ac:
             ac = self.char_hander.child_handlers['ac'].get_check_pen()
         stat_mod = self.char_hander.child_handlers['abilities'].get_mod(stat)
-        rank = int(skill.getAttribute('rank'))
-        misc = int(skill.getAttribute('misc'))
+        rank = int(skill.get('rank'))
+        misc = int(skill.get('misc'))
         total = stat_mod + rank + misc + ac
         return total
 
@@ -382,8 +375,8 @@
             #self.frame.add_panel(wnd)
         else:
             skill = self.skills[name];
-            untrained = skill.getAttribute('untrained');
-            rank = skill.getAttribute('rank');
+            untrained = skill.get('untrained');
+            rank = skill.get('rank');
             if untrained == "0" and rank == "0":
                 txt = '%s Skill Check: Untrained' % (name)
             else:
@@ -404,14 +397,13 @@
     def tohtml(self):
         html_str = """<table border='1' width=100% ><tr BGCOLOR=#E9E9E9 ><th width='30%'>Skill</th><th>Key</th>
                     <th>Rank</th><th>Abil</th><th>Misc</th><th>Total</th></tr>"""
-        node_list = self.master_dom.getElementsByTagName('skill')
-        for n in node_list:
-            name = n.getAttribute('name')
-            stat = n.getAttribute('stat')
-            rank = n.getAttribute('rank')
+        for n in self.xml.findall('skill'):
+            name = n.get('name')
+            stat = n.get('stat')
+            rank = n.get('rank')
             html_str = html_str + "<tr ALIGN='center'><td>"+name+"</td><td>"+stat+"</td><td>"+rank+"</td>"
             stat_mod = str(self.char_hander.child_handlers['abilities'].get_mod(stat))
-            misc = n.getAttribute('misc')
+            misc = n.get('misc')
             mod = str(self.get_mod(name))
             if mod >= 0:
                 mod1 = "+"
@@ -426,14 +418,13 @@
     """ Node Handler for ability.   This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
         self.abilities = {}
-        node_list = self.master_dom.getElementsByTagName('stat')
         tree = self.tree
         icons = tree.icons
-        for n in node_list:
-            name = n.getAttribute('abbr')
+        for n in self.xml.findall('stat'):
+            name = n.get('abbr')
             self.abilities[name] = n
             new_tree_node = tree.AppendItem( self.mytree_node, name, icons['gear'], icons['gear'] )
             tree.SetPyData( new_tree_node, self )
@@ -454,13 +445,13 @@
             chat.ParsePost( txt, True, True )
 
     def get_mod(self,abbr):
-        score = int(self.abilities[abbr].getAttribute('base'))
+        score = int(self.abilities[abbr].get('base'))
         mod = (score - 10) / 2
         return mod
 
     def set_score(self,abbr,score):
         if score >= 0:
-            self.abilities[abbr].setAttribute("base",str(score))
+            self.abilities[abbr].set("base",str(score))
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,abil_grid,"Abilities")
@@ -469,12 +460,11 @@
 
     def tohtml(self):
         html_str = """<table border='1' width=100%><tr BGCOLOR=#E9E9E9 ><th width='50%'>Ability</th>
-                    <th>Base</th><th>Modifier</th></tr>"""
-        node_list = self.master_dom.getElementsByTagName('stat')
-        for n in node_list:
-            name = n.getAttribute('name')
-            abbr = n.getAttribute('abbr')
-            base = n.getAttribute('base')
+                    <th>Base</th><th>Modifier</th></tr>""" 
+        for n in self.xml.findall('stat'):
+            name = n.get('name')
+            abbr = n.get('abbr')
+            base = n.get('base')
             mod = str(self.get_mod(abbr))
             if mod >= 0:
                 mod1 = "+"
@@ -484,29 +474,29 @@
         html_str = html_str + "</table>"
         return html_str
 
+
 class d20saves(d20_char_child):
     """ Node Handler for saves.   This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
         tree = self.tree
         icons = self.tree.icons
-        node_list = self.master_dom.getElementsByTagName('save')
         self.saves={}
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall('save'):
+            name = n.get('name')
             self.saves[name] = n
             new_tree_node = tree.AppendItem(self.mytree_node,name,icons['gear'],icons['gear'])
             tree.SetPyData(new_tree_node,self)
 
     def get_mod(self,name):
         save = self.saves[name]
-        stat = save.getAttribute('stat')
+        stat = save.get('stat')
         stat_mod = self.char_hander.child_handlers['abilities'].get_mod(stat)
-        base = int(save.getAttribute('base'))
-        miscmod = int(save.getAttribute('miscmod'))
-        magmod = int(save.getAttribute('magmod'))
+        base = int(save.get('base'))
+        miscmod = int(save.get('miscmod'))
+        magmod = int(save.get('magmod'))
         total = stat_mod + base + miscmod + magmod
         return total
 
@@ -537,15 +527,14 @@
         html_str = """<table border='1' width=100% ><tr BGCOLOR=#E9E9E9 ><th width='30%'>Save</th>
                     <th>Key</th><th>Base</th><th>Abil</th><th>Magic</th>
                     <th>Misc</th><th>Total</th></tr>"""
-        node_list = self.master_dom.getElementsByTagName('save')
-        for n in node_list:
-            name = n.getAttribute('name')
-            stat = n.getAttribute('stat')
-            base = n.getAttribute('base')
+        for n in self.xml.findall('save'):
+            name = n.get('name')
+            stat = n.get('stat')
+            base = n.get('base')
             html_str = html_str + "<tr ALIGN='center'><td>"+name+"</td><td>"+stat+"</td><td>"+base+"</td>"
             stat_mod = str(self.char_hander.child_handlers['abilities'].get_mod(stat))
-            mag = n.getAttribute('magmod')
-            misc = n.getAttribute('miscmod')
+            mag = n.get('magmod')
+            misc = n.get('miscmod')
             mod = str(self.get_mod(name))
             if mod >= 0:
                 mod1 = "+"
@@ -561,8 +550,8 @@
     """ Node Handler for general information.   This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,gen_grid,"General Information")
@@ -570,12 +559,10 @@
         return wnd
 
     def tohtml(self):
-        n_list = self.master_dom._get_childNodes()
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
-        for n in n_list:
-            t_node = component.get('xml').safe_get_text_node(n)
-            html_str += "<B>"+n._get_tagName().capitalize() +":</B> "
-            html_str += t_node._get_nodeValue() + ", "
+        for n in self.xml:
+            html_str += "<B>"+n.tag.capitalize() +":</B> "
+            html_str += n.text + ", "
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
@@ -583,17 +570,15 @@
         self.char_hander.rename(name)
 
     def get_char_name( self ):
-        node = self.master_dom.getElementsByTagName( 'name' )[0]
-        t_node = component.get('xml').safe_get_text_node( node )
-        return t_node._get_nodeValue()
+        return self.xml.find( 'name' ).text
 
 
 class d20classes(d20_char_child):
     """ Node Handler for classes.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,class_panel,"Classes")
@@ -602,17 +587,15 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Classes</th></tr><tr><td>"
-        n_list = self.master_dom._get_childNodes()
-        for n in n_list:
-            html_str += n.getAttribute('name') + " ("+n.getAttribute('level')+"), "
+        for n in self.xml:
+            html_str += n.get('name') + " ("+n.get('level')+"), "
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
     def get_char_lvl( self, attr ):
-        node_list = self.master_dom.getElementsByTagName('class')
-        for n in node_list:
-            lvl = n.getAttribute('level')
-            type = n.getAttribute('name')
+        for n in self.xml.findall('class'):
+            lvl = n.get('level')
+            type = n.get('name')
             if attr == "level":
                 return lvl
             elif attr == "class":
@@ -623,8 +606,8 @@
     """ Node Handler for classes.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,feat_panel,"Feats")
@@ -633,24 +616,23 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Feats</th></tr><tr><td>"
-        n_list = self.master_dom._get_childNodes()
-        for n in n_list:
-            html_str += n.getAttribute('name')+ ", "
+        for n in self.xml:
+            html_str += n.get('name')+ ", "
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
+
 class d20spells(d20_char_child):
     """ Node Handler for classes.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
-        node_list = self.master_dom.getElementsByTagName( 'spell' )
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
         self.spells = {}
         tree = self.tree
         icons = self.tree.icons
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall( 'spell' ):
+            name = n.get('name')
             self.spells[ name ] = n
             new_tree_node = tree.AppendItem( self.mytree_node, name, icons['gear'], icons['gear'] )
             tree.SetPyData( new_tree_node, self )
@@ -661,10 +643,10 @@
         if item == self.mytree_node:
             d20_char_child.on_ldclick( self, evt )
         else:
-            level = self.spells[ name ].getAttribute( 'level' )
-            descr = self.spells[ name ].getAttribute( 'desc' )
-            use = self.spells[ name ].getAttribute( 'used' )
-            memrz = self.spells[ name ].getAttribute( 'memrz' )
+            level = self.spells[ name ].get( 'level' )
+            descr = self.spells[ name ].get( 'desc' )
+            use = self.spells[ name ].get( 'used' )
+            memrz = self.spells[ name ].get( 'memrz' )
             cname = self.char_hander.get_char_name()
             use += '+1'
             left = eval( '%s - ( %s )' % ( memrz, use ) )
@@ -679,16 +661,15 @@
                     s = 's'
                 txt = '%s can cast %s %d more time%s' % ( cname, name, left, s )
                 self.chat.ParsePost( txt, False, False )
-                self.spells[ name ].setAttribute( 'used', `eval( use )` )
+                self.spells[ name ].set( 'used', `eval( use )` )
 
     def refresh_spells(self):
         self.spells = {}
         tree = self.tree
         icons = self.tree.icons
         tree.CollapseAndReset(self.mytree_node)
-        node_list = self.master_dom.getElementsByTagName('spell')
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall('spell'):
+            name = n.get('name')
             new_tree_node = tree.AppendItem(self.mytree_node,name,icons['gear'],icons['gear'])
             tree.SetPyData(new_tree_node,self)
             self.spells[name]=n
@@ -700,9 +681,8 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Arcane Spells</th></tr><tr><td><br />"
-        n_list = self.master_dom._get_childNodes()
-        for n in n_list:
-            html_str += "(" + n.getAttribute('level') + ") " + n.getAttribute('name')+ ", "
+        for n in self.xml:
+            html_str += "(" + n.get('level') + ") " + n.get('name')+ ", "
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
@@ -713,14 +693,13 @@
     """ Node Handler for classes.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,component,parent)
-        node_list = self.master_dom.getElementsByTagName( 'gift' )
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
         self.spells = {}
         tree = self.tree
         icons = self.tree.icons
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall( 'gift' ):
+            name = n.get('name')
             self.spells[ name ] = n
             new_tree_node = tree.AppendItem( self.mytree_node, name, icons['flask'], icons['flask'] )
             tree.SetPyData( new_tree_node, self )
@@ -731,10 +710,10 @@
         if item == self.mytree_node:
             d20_char_child.on_ldclick( self, evt )
         else:
-            level = self.spells[ name ].getAttribute( 'level' )
-            descr = self.spells[ name ].getAttribute( 'desc' )
-            use = self.spells[ name ].getAttribute( 'used' )
-            memrz = self.spells[ name ].getAttribute( 'memrz' )
+            level = self.spells[ name ].get( 'level' )
+            descr = self.spells[ name ].get( 'desc' )
+            use = self.spells[ name ].get( 'used' )
+            memrz = self.spells[ name ].get( 'memrz' )
             cname = self.char_hander.get_char_name()
             use += '+1'
             left = eval( '%s - ( %s )' % ( memrz, use ) )
@@ -749,20 +728,19 @@
                     s = 's'
                 txt = '%s can cast %s %d more time%s' % ( cname, name, left, s )
                 self.chat.ParsePost( txt, False, False )
-                self.spells[ name ].setAttribute( 'used', `eval( use )` )
+                self.spells[ name ].set( 'used', `eval( use )` )
 
     def refresh_spells(self):
         self.spells = {}
         tree = self.tree
         icons = self.tree.icons
         tree.CollapseAndReset(self.mytree_node)
-        node_list = self.master_dom.getElementsByTagName('gift')
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall('gift'):
+            name = n.get('name')
             new_tree_node = tree.AppendItem(self.mytree_node,name,icons['flask'],icons['flask'])
             tree.SetPyData(new_tree_node,self)
             self.spells[name]=n
-
+            
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,divine_panel,"Spells")
         wnd.title = "Spells"
@@ -770,9 +748,8 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Divine Spells</th></tr><tr><td><br />"
-        n_list = self.master_dom._get_childNodes()
-        for n in n_list:
-            html_str += "(" + n.getAttribute('level') + ") " + n.getAttribute('name')+ ", "
+        for n in self.xml:
+            html_str += "(" + n.get('level') + ") " + n.get('name')+ ", "
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
@@ -783,15 +760,14 @@
     """ Node Handler for classes.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
-        node_list = self.master_dom.getElementsByTagName( 'power' )
-        #cpp = self.master_dom.getElementsByTagName( 'pp' ).getAttribute('current1')
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
+        #cpp = self.xml.findall( 'pp' ).get('current1')
         self.powers = {}
         tree = self.tree
         icons = self.tree.icons
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall( 'power' ):
+            name = n.get('name')
             self.powers[ name ] = n
             new_tree_node = tree.AppendItem( self.mytree_node, name, icons['gear'], icons['gear'] )
             tree.SetPyData( new_tree_node, self )
@@ -802,10 +778,10 @@
         if item == self.mytree_node:
             d20_char_child.on_ldclick( self, evt )
         else:
-            level = self.powers[ name ].getAttribute( 'level' )
-            descr = self.powers[ name ].getAttribute( 'desc' )
-            use = self.powers[ name ].getAttribute( 'used' )
-            points = self.powers[ name ].getAttribute( 'point' )
+            level = self.powers[ name ].get( 'level' )
+            descr = self.powers[ name ].get( 'desc' )
+            use = self.powers[ name ].get( 'used' )
+            points = self.powers[ name ].get( 'point' )
             cpp = self.char_hander.get_char_pp('current1')
             fre = self.char_hander.get_char_pp('free')
             cname = self.char_hander.get_char_name()
@@ -837,7 +813,7 @@
                     if left != 1:
                         s = 's'
                     txt = '%s can use %s %d more time%s' % ( cname, name, numcast, s )
-                    txt += ' - And has %d more PowerpointsP left' % (left)
+                    txt += ' - And has %d more Powerpoints left' % (left)
                     self.chat.ParsePost( txt, False, False )
                     self.char_hander.set_char_pp('current1', left)
 
@@ -846,9 +822,8 @@
         tree = self.tree
         icons = self.tree.icons
         tree.CollapseAndReset(self.mytree_node)
-        node_list = self.master_dom.getElementsByTagName('power')
-        for n in node_list:
-            name = n.getAttribute('name')
+        for n in self.xml.findall('power'):
+            name = n.get('name')
             new_tree_node = tree.AppendItem(self.mytree_node,name,icons['questionhead'],icons['questionhead'])
             tree.SetPyData(new_tree_node,self)
             self.powers[name]=n
@@ -860,9 +835,8 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Powers</th></tr><tr><td><br />"
-        n_list = self.master_dom._get_childNodes()
-        for n in n_list:
-            html_str += "(" + n.getAttribute('level') + ") " + n.getAttribute('name')+ ", "
+        for n in self.xml:
+            html_str += "(" + n.get('level') + ") " + n.get('name')+ ", "
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
@@ -879,8 +853,8 @@
     """ Node Handler for hit points.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,howto_panel,"How To")
@@ -891,8 +865,8 @@
     """ Node Handler for general information.   This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,inventory_grid,"Inventory")
@@ -900,12 +874,10 @@
         return wnd
 
     def tohtml(self):
-        n_list = self.master_dom._get_childNodes()
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
-        for n in n_list:
-            t_node = component.get('xml').safe_get_text_node(n)
-            html_str += "<B>"+n._get_tagName().capitalize() +":</B> "
-            html_str += t_node._get_nodeValue() + "<br />"
+        for n in self.xml:
+            html_str += "<B>"+n.tag.capitalize() +":</B> "
+            html_str += n.text + "<br />"
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
@@ -913,16 +885,15 @@
         self.char_hander.rename(name)
 
     def get_char_name( self ):
-        node = self.master_dom.getElementsByTagName( 'name' )[0]
-        t_node = component.get('xml').safe_get_text_node( node )
-        return t_node._get_nodeValue()
+        return self.xml.find( 'name' ).text
+
 
 class d20hp(d20_char_child):
     """ Node Handler for hit points.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,hp_panel,"Hit Points")
@@ -931,19 +902,19 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=4>Hit Points</th></tr>"
-        html_str += "<tr><th>Max:</th><td>"+self.master_dom.getAttribute('max')+"</td>"
-        html_str += "<th>Current:</th><td>"+self.master_dom.getAttribute('current')+"</td>"
+        html_str += "<tr><th>Max:</th><td>"+self.xml.get('max')+"</td>"
+        html_str += "<th>Current:</th><td>"+self.xml.get('current')+"</td>"
         html_str += "</tr></table>"
         return html_str
 
     def get_max_hp( self ):
         try:
-            return eval( self.master_dom.getAttribute( 'max' ) )
+            return eval( self.xml.get( 'max' ) )
         except:
             return 0
     def get_current_hp( self ):
         try:
-            return eval( self.master_dom.getAttribute( 'current' ) )
+            return eval( self.xml.get( 'current' ) )
         except:
             return 0
 
@@ -951,8 +922,8 @@
     """ Node Handler for power points.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_design_panel(self,parent):
         wnd = outline_panel(parent,self,pp_panel,"Power Points")
@@ -961,30 +932,30 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=8>Power Points</th></tr>"
-        html_str += "<tr><th>Max:</th><td>"+self.master_dom.getAttribute('max1')+"</td>"
-        html_str += "<th>Current:</th><td>"+self.master_dom.getAttribute('current1')+"</td>"
-        html_str += "<th>Current Talents/day:</th><td>"+self.master_dom.getAttribute('free')+"</td>"
-        html_str += "<th>Max Talents/day:</th><td>"+self.master_dom.getAttribute('maxfree')+"</td>"
+        html_str += "<tr><th>Max:</th><td>"+self.xml.get('max1')+"</td>"
+        html_str += "<th>Current:</th><td>"+self.xml.get('current1')+"</td>"
+        html_str += "<th>Current Talents/day:</th><td>"+self.xml.get('free')+"</td>"
+        html_str += "<th>Max Talents/day:</th><td>"+self.xml.get('maxfree')+"</td>"
         html_str += "</tr></table>"
         return html_str
 
     def get_char_pp( self, attr ):
-        pp = self.master_dom.getAttribute(attr)
+        pp = self.xml.get(attr)
         return pp
 
     def set_char_pp( self, attr, evl ):
-        pp = self.master_dom.setAttribute(attr, evl)
+        pp = self.xml.set(attr, evl)
         return pp
 
 class d20attacks(d20_char_child):
     """ Node Handler for attacks.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
-        node_list = self.master_dom.getElementsByTagName('melee')
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
+        node_list = self.xml.findall('melee')
         self.melee = node_list[0]
-        node_list = self.master_dom.getElementsByTagName('ranged')
+        node_list = self.xml.findall('ranged')
         self.ranged = node_list[0]
         self.refresh_weapons()
 
@@ -993,22 +964,22 @@
         tree = self.tree
         icons = self.tree.icons
         tree.CollapseAndReset(self.mytree_node)
-        node_list = self.master_dom.getElementsByTagName('weapon')
+        node_list = self.xml.findall('weapon')
         for n in node_list:
-            name = n.getAttribute('name')
+            name = n.get('name')
             new_tree_node = tree.AppendItem(self.mytree_node,name,icons['sword'],icons['sword'])
             tree.SetPyData(new_tree_node,self)
             self.weapons[name]=n
 
     def get_attack_data(self):
         temp = self.melee
-        base = int(temp.getAttribute('base'))
-        base2 = int(temp.getAttribute('second'))
-        base3 = int(temp.getAttribute('third'))
-        base4 = int(temp.getAttribute('forth'))
-        base5 = int(temp.getAttribute('fifth'))
-        base6 = int(temp.getAttribute('sixth'))
-        misc = int(temp.getAttribute('misc'))
+        base = int(temp.get('base'))
+        base2 = int(temp.get('second'))
+        base3 = int(temp.get('third'))
+        base4 = int(temp.get('forth'))
+        base5 = int(temp.get('fifth'))
+        base6 = int(temp.get('sixth'))
+        misc = int(temp.get('misc'))
         return (base, base2, base3, base4, base5, base6, misc)
 
     # Replace any 'S' and 'D' in an attack modifier and damage modifier with the
@@ -1038,10 +1009,10 @@
             #self.frame.add_panel(self.get_design_panel(self.frame.note))
         else:
             # Weapon/attack specific attack modifier (e.g. "S+1" for a longsword+1).
-            attack_mod_str = self.weapons[name].getAttribute('mod')
+            attack_mod_str = self.weapons[name].get('mod')
 
             # Weapon/attack specific damage (e.g. "1d8+S+1" for a longsword+1).
-            damage_str = self.weapons[name].getAttribute('damage')
+            damage_str = self.weapons[name].get('damage')
             (num_damage_dice, damage_die, damage_mods, extra_damage) = self.decompose_damage( damage_str )
 
             # Replace any 'S' and 'D' in attack_mod_str and damage_str with the
@@ -1052,10 +1023,10 @@
             bab_attributes = ['base', 'second', 'third', 'forth', 'fifth', 'sixth']
             bab = []
             for b in bab_attributes:
-                bab.append( int(self.melee.getAttribute( b )) )
+                bab.append( int(self.melee.get( b )) )
 
             # Misc. attack modifier to be applied to *all* attacks.
-            misc_mod = int(self.melee.getAttribute( 'misc' ));
+            misc_mod = int(self.melee.get( 'misc' ));
 
             # Attack modifier (except BAB)
             attack_mod = misc_mod + eval( attack_mod_str )
@@ -1067,7 +1038,7 @@
                 damage_mod = 0
 
             # Determine critical hit range and multiplier.
-            critical_str = self.weapons[name].getAttribute( 'critical' )
+            critical_str = self.weapons[name].get( 'critical' )
             m = re.match( r"(((?P<min>\d+)-)?\d+/)?x(?P<mult>\d+)", critical_str )
             crit_min = m.group( 'min' )
             crit_mult = m.group( 'mult' )
@@ -1120,32 +1091,32 @@
         html_str += "</td></tr><tr ALIGN='center' ><th BGCOLOR=#E9E9E9>Misc. Attack Bonus</th>"
         html_str += '<td>%+d</td></tr></table>' % babs[6]
 
-        n_list = self.master_dom.getElementsByTagName('weapon')
+        n_list = self.xml.findall('weapon')
         for n in n_list:
-            (attack_mod, damage_mod) = self.process_mod_codes( n.getAttribute( 'mod' ), \
-                                                               n.getAttribute( 'damage' ) )
+            (attack_mod, damage_mod) = self.process_mod_codes( n.get( 'mod' ), \
+                                                               n.get( 'damage' ) )
             attack_mod = eval( attack_mod )
             html_str += """<P><table width=100% border=1><tr BGCOLOR=#E9E9E9><th colspan=3>Weapon</th>
                     <th>Attack</th><th >Damage</th></tr>""" \
                       + "<tr ALIGN='center'><td colspan=3>" \
-                      + n.getAttribute('name') + "</td><td>"
+                      + n.get('name') + "</td><td>"
             html_str += '%+d</td><td>%s</td></tr>' % (attack_mod, damage_mod)
             html_str += """<tr BGCOLOR=#E9E9E9 ><th>Critical</th><th>Range</th><th>Weight</th>
                         <th>Type</th><th>Size</th></tr>""" \
                       + "<tr ALIGN='center'><td>" \
-                      + n.getAttribute( 'critical' ) + "</td><td>" \
-                      + n.getAttribute( 'range' ) + "</td><td>" \
-                      + n.getAttribute( 'weight' )+"</td><td>" \
-                      + n.getAttribute( 'type' ) + "</td><td>" \
-                      + n.getAttribute( 'size' ) + "</td></tr></table>"
+                      + n.get( 'critical' ) + "</td><td>" \
+                      + n.get( 'range' ) + "</td><td>" \
+                      + n.get( 'weight' )+"</td><td>" \
+                      + n.get( 'type' ) + "</td><td>" \
+                      + n.get( 'size' ) + "</td></tr></table>"
         return html_str
 
 class d20armor(d20_char_child):
     """ Node Handler for ac.  This handler will be
         created by d20char_handler.
     """
-    def __init__(self,xml_dom,tree_node,parent):
-        d20_char_child.__init__(self,xml_dom,tree_node,parent)
+    def __init__(self,xml,tree_node,parent):
+        d20_char_child.__init__(self,xml,tree_node,parent)
 
     def get_spell_failure(self):
         return self.get_total('spellfailure')
@@ -1168,19 +1139,19 @@
         return ac_total
 
     def get_max_dex(self):
-        armor_list = self.master_dom.getElementsByTagName('armor')
+        armor_list = self.xml.findall('armor')
         dex = 10
         for a in armor_list:
-            temp = int(a.getAttribute("maxdex"))
+            temp = int(a.get("maxdex"))
             if temp < dex:
                 dex = temp
         return dex
 
     def get_total(self,attr):
-        armor_list = self.master_dom.getElementsByTagName('armor')
+        armor_list = self.xml.findall('armor')
         total = 0
         for a in armor_list:
-            total += int(a.getAttribute(attr))
+            total += int(a.get(attr))
         return total
 
     def get_design_panel(self,parent):
@@ -1196,20 +1167,19 @@
         html_str += "<td>"+str(self.get_spell_failure())+"</td>"
         html_str += "<td>"+str(self.get_max_dex())+"</td>"
         html_str += "<td>"+str(self.get_total_weight())+"</td></tr></table>"
-        n_list = self.master_dom._get_childNodes()
-        for n in n_list:
+        for n in self.xml:
             html_str += """<P><table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=3>Armor</th>
                     <th>Type</th><th >Bonus</th></tr>"""
-            html_str += "<tr ALIGN='center' ><td  colspan=3>"+n.getAttribute('name')+"</td>"
-            html_str += "<td>"+n.getAttribute('type')+"</td>"
-            html_str += "<td>"+n.getAttribute('bonus')+"</td></tr>"
+            html_str += "<tr ALIGN='center' ><td  colspan=3>"+n.get('name')+"</td>"
+            html_str += "<td>"+n.get('type')+"</td>"
+            html_str += "<td>"+n.get('bonus')+"</td></tr>"
             html_str += """<tr BGCOLOR=#E9E9E9 ><th>Check Penalty</th><th>Spell Failure</th>
                         <th>Max Dex</th><th>Speed</th><th>Weight</th></tr>"""
-            html_str += "<tr ALIGN='center'><td>"+n.getAttribute('checkpenalty')+"</td>"
-            html_str += "<td>"+n.getAttribute('spellfailure')+"</td>"
-            html_str += "<td>"+n.getAttribute('maxdex')+"</td>"
-            html_str += "<td>"+n.getAttribute('speed')+"</td>"
-            html_str += "<td>"+n.getAttribute('weight')+"</td></tr></table>"
+            html_str += "<tr ALIGN='center'><td>"+n.get('checkpenalty')+"</td>"
+            html_str += "<td>"+n.get('spellfailure')+"</td>"
+            html_str += "<td>"+n.get('maxdex')+"</td>"
+            html_str += "<td>"+n.get('speed')+"</td>"
+            html_str += "<td>"+n.get('weight')+"</td></tr></table>"
         return html_str
 
 
@@ -1242,7 +1212,7 @@
 
 class char_panel(wx.ScrolledWindow):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'TWO')
+        pname = handler.xml.set("name", 'TWO')
         wx.ScrolledWindow.__init__(self, parent, -1,style=wx.VSCROLL | wx.SUNKEN_BORDER  )
         self.height = 1200
         self.SetScrollbars(10, 10,80, self.height/10)
@@ -1297,14 +1267,12 @@
 class howto_panel(wx.Panel):
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, -1)
-        pname = handler.master_dom.setAttribute("name", 'How To')
+        pname = handler.xml.set("name", 'How To')
         self.sizer = wx.FlexGridSizer(2, 4, 2, 2)  # rows, cols, hgap, vgap
-        self.master_dom = handler.master_dom
-        n_list = self.master_dom._get_childNodes()
-        for n in n_list:
-            t_node = component.get('xml').safe_get_text_node(n)
-        self.sizer.AddMany([ (wx.StaticText(self, -1, t_node._get_nodeValue()),   0, wx.ALIGN_CENTER_VERTICAL),
-                 ])
+        self.sizer.AddMany([ (wx.StaticText(self, -1, 
+                              handler.xml.find('howto').text), 
+                              0, wx.ALIGN_CENTER_VERTICAL),
+                            ])
         self.sizer.AddGrowableCol(1)
         self.SetSizer(self.sizer)
 
@@ -1315,13 +1283,13 @@
 class hp_panel(wx.Panel):
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, -1)
-        pname = handler.master_dom.setAttribute("name", 'HitPoints')
+        pname = handler.xml.set("name", 'HitPoints')
         self.sizer = wx.FlexGridSizer(2, 4, 2, 2)  # rows, cols, hgap, vgap
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.sizer.AddMany([ (wx.StaticText(self, -1, "HP Current:"),   0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, HP_CUR, self.master_dom.getAttribute('current')),   0, wx.EXPAND),
+                 (wx.TextCtrl(self, HP_CUR, self.xml.get('current')),   0, wx.EXPAND),
                  (wx.StaticText(self, -1, "HP Max:"), 0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, HP_MAX, self.master_dom.getAttribute('max')),  0, wx.EXPAND),
+                 (wx.TextCtrl(self, HP_MAX, self.xml.get('max')),  0, wx.EXPAND),
                  ])
         self.sizer.AddGrowableCol(1)
         self.SetSizer(self.sizer)
@@ -1332,9 +1300,9 @@
     def on_text(self,evt):
         id = evt.GetId()
         if id == HP_CUR:
-            self.master_dom.setAttribute('current',evt.GetString())
+            self.xml.set('current',evt.GetString())
         elif id == HP_MAX:
-            self.master_dom.setAttribute('max',evt.GetString())
+            self.xml.set('max',evt.GetString())
 
     def on_size(self,evt):
         s = self.GetClientSizeTuple()
@@ -1348,18 +1316,18 @@
 class pp_panel(wx.Panel):
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, -1)
-        pname = handler.master_dom.setAttribute("name", 'PowerPoints')
+        pname = handler.xml.set("name", 'PowerPoints')
         self.sizer = wx.FlexGridSizer(2, 4, 2, 2)  # rows, cols, hgap, vgap
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
 
         self.sizer.AddMany([ (wx.StaticText(self, -1, "PP Current:"),   0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, PP_CUR, self.master_dom.getAttribute('current1')),   0, wx.EXPAND),
+                 (wx.TextCtrl(self, PP_CUR, self.xml.get('current1')),   0, wx.EXPAND),
                  (wx.StaticText(self, -1, "PP Max:"), 0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, PP_MAX, self.master_dom.getAttribute('max1')),  0, wx.EXPAND),
+                 (wx.TextCtrl(self, PP_MAX, self.xml.get('max1')),  0, wx.EXPAND),
                  (wx.StaticText(self, -1, "Current Free Talants per day:"), 0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, PP_FRE, self.master_dom.getAttribute('free')),  0, wx.EXPAND),
+                 (wx.TextCtrl(self, PP_FRE, self.xml.get('free')),  0, wx.EXPAND),
                  (wx.StaticText(self, -1, "Max Free Talants per day:"), 0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, PP_MFRE, self.master_dom.getAttribute('maxfree')),  0, wx.EXPAND),
+                 (wx.TextCtrl(self, PP_MFRE, self.xml.get('maxfree')),  0, wx.EXPAND),
                  ])
         self.sizer.AddGrowableCol(1)
         self.SetSizer(self.sizer)
@@ -1372,13 +1340,13 @@
     def on_text(self,evt):
         id = evt.GetId()
         if id == PP_CUR:
-            self.master_dom.setAttribute('current1',evt.GetString())
+            self.xml.set('current1',evt.GetString())
         elif id == PP_MAX:
-            self.master_dom.setAttribute('max1',evt.GetString())
+            self.xml.set('max1',evt.GetString())
         elif id == PP_FRE:
-            self.master_dom.setAttribute('free',evt.GetString())
+            self.xml.set('free',evt.GetString())
         elif id == PP_MFRE:
-            self.master_dom.setAttribute('maxfree',evt.GetString())
+            self.xml.set('maxfree',evt.GetString())
 
     def on_size(self,evt):
         s = self.GetClientSizeTuple()
@@ -1388,12 +1356,12 @@
 class gen_grid(wx.grid.Grid):
     """grid for gen info"""
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'General')
+        pname = handler.xml.set("name", 'General')
         wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.Bind(wx.EVT_SIZE, self.on_size)
         self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
         self.handler = handler
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml[:]
         self.CreateGrid(len(n_list),2)
         self.SetRowLabelSize(0)
         self.SetColLabelSize(0)
@@ -1406,15 +1374,13 @@
         row = evt.GetRow()
         col = evt.GetCol()
         value = self.GetCellValue(row,col)
-        t_node = self.n_list[row]._get_firstChild()
-        t_node._set_nodeValue(value)
+        self.n_list[row].text = value
         if row==0: self.handler.on_name_change(value)
 
     def refresh_row(self,rowi):
-        t_node = component.get('xml').safe_get_text_node(self.n_list[rowi])
-        self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName())
+        self.SetCellValue(rowi,0,self.n_list[rowi].tag)
         self.SetReadOnly(rowi,0)
-        self.SetCellValue(rowi,1,t_node._get_nodeValue())
+        self.SetCellValue(rowi,1,self.n_list[rowi].text)
 
     def on_size(self,evt):
         (w,h) = self.GetClientSizeTuple()
@@ -1428,12 +1394,12 @@
 class inventory_grid(wx.grid.Grid):
     """grid for gen info"""
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Money and Inventory')
+        pname = handler.xml.set("name", 'Money and Inventory')
         wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.Bind(wx.EVT_SIZE, self.on_size)
         self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
         self.handler = handler
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml[:]
         self.CreateGrid(len(n_list),2)
         self.SetRowLabelSize(0)
         self.SetColLabelSize(0)
@@ -1446,15 +1412,13 @@
         row = evt.GetRow()
         col = evt.GetCol()
         value = self.GetCellValue(row,col)
-        t_node = self.n_list[row]._get_firstChild()
-        t_node._set_nodeValue(value)
+        self.n_list[row].text = value
         if row==0: self.handler.on_name_change(value)
 
     def refresh_row(self,rowi):
-        t_node = component.get('xml').safe_get_text_node(self.n_list[rowi])
-        self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName())
+        self.SetCellValue(rowi,0,self.n_list[rowi].tag)
         self.SetReadOnly(rowi,0)
-        self.SetCellValue(rowi,1,t_node._get_nodeValue())
+        self.SetCellValue(rowi,1,self.n_list[rowi].text)
 
     def on_size(self,evt):
         (w,h) = self.GetClientSizeTuple()
@@ -1468,12 +1432,12 @@
 class abil_grid(wx.grid.Grid):
     """grid for abilities"""
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Stats')
+        pname = handler.xml.set("name", 'Stats')
         wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.Bind(wx.EVT_SIZE, self.on_size)
         self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
         self.handler = handler
-        stats = handler.master_dom.getElementsByTagName('stat')
+        stats = handler.xml.findall('stat')
         self.CreateGrid(len(stats),3)
         self.SetRowLabelSize(0)
         col_names = ['Ability','Score','Modifier']
@@ -1491,7 +1455,7 @@
         value = self.GetCellValue(row,col)
         try:
             int(value)
-            self.stats[row].setAttribute('base',value)
+            self.stats[row].set('base',value)
             self.refresh_row(row)
         except:
             self.SetCellValue(row,col,"0")
@@ -1500,11 +1464,11 @@
 
     def refresh_row(self,rowi):
         s = self.stats[rowi]
-        name = s.getAttribute('name')
-        abbr = s.getAttribute('abbr')
+        name = s.get('name')
+        abbr = s.get('abbr')
         self.SetCellValue(rowi,0,name)
         self.SetReadOnly(rowi,0)
-        self.SetCellValue(rowi,1,s.getAttribute('base'))
+        self.SetCellValue(rowi,1,s.get('base'))
         self.SetCellValue(rowi,2,str(self.handler.get_mod(abbr)))
         self.SetReadOnly(rowi,2)
 
@@ -1526,12 +1490,12 @@
 class save_grid(wx.grid.Grid):
     """grid for saves"""
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Saves')
+        pname = handler.xml.set("name", 'Saves')
         wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.Bind(wx.EVT_SIZE, self.on_size)
         self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
         self.handler = handler
-        saves = handler.master_dom.getElementsByTagName('save')
+        saves = handler.xml.findall('save')
         self.stats = handler.char_hander.child_handlers['abilities']
         self.CreateGrid(len(saves),7)
         self.SetRowLabelSize(0)
@@ -1550,28 +1514,28 @@
         try:
             int(value)
             if col == 2:
-                self.saves[row].setAttribute('base',value)
+                self.saves[row].set('base',value)
             elif col ==4:
-                self.saves[row].setAttribute('magmod',value)
+                self.saves[row].set('magmod',value)
             elif col ==4:
-                self.saves[row].setAttribute('miscmod',value)
+                self.saves[row].set('miscmod',value)
             self.refresh_row(row)
         except:
             self.SetCellValue(row,col,"0")
 
     def refresh_row(self,rowi):
         s = self.saves[rowi]
-        name = s.getAttribute('name')
+        name = s.get('name')
         self.SetCellValue(rowi,0,name)
         self.SetReadOnly(rowi,0)
-        stat = s.getAttribute('stat')
+        stat = s.get('stat')
         self.SetCellValue(rowi,1,stat)
         self.SetReadOnly(rowi,1)
-        self.SetCellValue(rowi,2,s.getAttribute('base'))
+        self.SetCellValue(rowi,2,s.get('base'))
         self.SetCellValue(rowi,3,str(self.stats.get_mod(stat)))
         self.SetReadOnly(rowi,3)
-        self.SetCellValue(rowi,4,s.getAttribute('magmod'))
-        self.SetCellValue(rowi,5,s.getAttribute('miscmod'))
+        self.SetCellValue(rowi,4,s.get('magmod'))
+        self.SetCellValue(rowi,5,s.get('miscmod'))
         mod = str(self.handler.get_mod(name))
         self.SetCellValue(rowi,6,mod)
         self.SetReadOnly(rowi,6)
@@ -1594,12 +1558,12 @@
 class skill_grid(wx.grid.Grid):
     """ panel for skills """
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Skills')
+        pname = handler.xml.set("name", 'Skills')
         wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.Bind(wx.EVT_SIZE, self.on_size)
         self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
         self.handler = handler
-        skills = handler.master_dom.getElementsByTagName('skill')
+        skills = handler.xml.findall('skill')
         self.stats = handler.char_hander.child_handlers['abilities']
         self.CreateGrid(len(skills),6)
         self.SetRowLabelSize(0)
@@ -1618,25 +1582,25 @@
         try:
             int(value)
             if col == 2:
-                self.skills[row].setAttribute('rank',value)
+                self.skills[row].set('rank',value)
             elif col ==4:
-                self.skills[row].setAttribute('misc',value)
+                self.skills[row].set('misc',value)
             self.refresh_row(row)
         except:
             self.SetCellValue(row,col,"0")
 
     def refresh_row(self,rowi):
         s = self.skills[rowi]
-        name = s.getAttribute('name')
+        name = s.get('name')
         self.SetCellValue(rowi,0,name)
         self.SetReadOnly(rowi,0)
-        stat = s.getAttribute('stat')
+        stat = s.get('stat')
         self.SetCellValue(rowi,1,stat)
         self.SetReadOnly(rowi,1)
-        self.SetCellValue(rowi,2,s.getAttribute('rank'))
+        self.SetCellValue(rowi,2,s.get('rank'))
         self.SetCellValue(rowi,3,str(self.stats.get_mod(stat)))
         self.SetReadOnly(rowi,3)
-        self.SetCellValue(rowi,4,s.getAttribute('misc'))
+        self.SetCellValue(rowi,4,s.get('misc'))
         mod = str(self.handler.get_mod(name))
         self.SetCellValue(rowi,5,mod)
         self.SetReadOnly(rowi,5)
@@ -1659,7 +1623,7 @@
 
 class feat_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Feats')
+        pname = handler.xml.set("name", 'Feats')
         wx.Panel.__init__(self, parent, -1)
         self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -1671,9 +1635,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_remove, id=10)
         self.Bind(wx.EVT_BUTTON, self.on_add, id=20)
 
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml[:]
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.grid.CreateGrid(len(n_list),2,1)
         self.grid.SetRowLabelSize(0)
         self.grid.SetColLabelValue(0,"Feat")
@@ -1685,8 +1649,8 @@
 
     def refresh_row(self,i):
         feat = self.n_list[i]
-        name = feat.getAttribute('name')
-        type = feat.getAttribute('type')
+        name = feat.get('name')
+        type = feat.get('type')
         self.grid.SetCellValue(i,0,name)
         self.grid.SetReadOnly(i,0)
         self.grid.SetCellValue(i,1,type)
@@ -1697,28 +1661,25 @@
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
+                self.xml.removeChild(self.n_list[i])
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["d20"]+"d20feats.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('feat')
+            tree = parse(orpg.dirpath.dir_struct["d20"]+"d20feats.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('feat')
         opts = []
         for f in f_list:
-            opts.append(f.getAttribute('name'))
+            opts.append(f.get('name'))
         dlg = wx.SingleChoiceDialog(self,'Choose Feat','Feats',opts)
         if dlg.ShowModal() == wx.ID_OK:
             i = dlg.GetSelection()
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(XML(tostring(f_list[i])))
             self.grid.AppendRows(1)
+            self.n_list = self.xml.findall('feat')
             self.refresh_row(self.grid.GetNumberRows()-1)
         dlg.Destroy()
 
-
     def on_size(self,event):
         s = self.GetClientSizeTuple()
         self.grid.SetDimensions(0,0,s[0],s[1]-25)
@@ -1731,7 +1692,7 @@
 
 class spell_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Arcane Spells')
+        pname = handler.xml.set("name", 'Arcane Spells')
         wx.Panel.__init__(self, parent, -1)
         self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.handler = handler
@@ -1748,9 +1709,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_add, id=20)
         self.Bind(wx.EVT_BUTTON, self.on_refresh_spells, id=30)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml[:]
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.grid.CreateGrid(len(n_list),4,1)
         self.grid.SetRowLabelSize(0)
         self.grid.SetColLabelValue(0,"No.")
@@ -1766,15 +1727,14 @@
         col = evt.GetCol()
         value = self.grid.GetCellValue(row,col)
         if col == 0:
-            self.n_list[row].setAttribute('memrz',value)
-
+            self.n_list[row].set('memrz',value)
 
     def refresh_row(self,i):
         spell = self.n_list[i]
-        memrz = spell.getAttribute('memrz')
-        name = spell.getAttribute('name')
-        type = spell.getAttribute('desc')
-        level = spell.getAttribute('level')
+        memrz = spell.get('memrz')
+        name = spell.get('name')
+        type = spell.get('desc')
+        level = spell.get('level')
         self.grid.SetCellValue(i,0,memrz)
         self.grid.SetCellValue(i,2,name)
         self.grid.SetReadOnly(i,2)
@@ -1788,42 +1748,39 @@
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
+                self.xml.removeChild(self.n_list[i])
                 self.handler.refresh_spells()
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["d20"]+"d20spells.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('spell')
+            tree = parse(orpg.dirpath.dir_struct["d20"]+"d20spells.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('spell')
         opts = []
         # lvl = int(self.handler.get_char_lvl('level'))
         # castlvl = lvl / 2
         for f in f_list:
-            opts.append("(" + f.getAttribute('level') + ")" + f.getAttribute('name'))
-            # spelllvl = f.getAttribute('level')
+            opts.append("(" + f.get('level') + ")" + f.get('name'))
+            # spelllvl = f.get('level')
             # if spelllvl <= "1":
-            #     opts.append("(" + f.getAttribute('level') + ")" + f.getAttribute('name'))
+            #     opts.append("(" + f.get('level') + ")" + f.get('name'))
             # else:
             #     if eval('%d >= %s' %(castlvl, spelllvl)):
-            #         opts.append("(" + f.getAttribute('level') + ")" + f.getAttribute('name'))
+            #         opts.append("(" + f.get('level') + ")" + f.get('name'))
         dlg = wx.SingleChoiceDialog(self,'Choose Spell','Spells',opts)
         if dlg.ShowModal() == wx.ID_OK:
             i = dlg.GetSelection()
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(XML(tostring(f_list[i])))
             self.grid.AppendRows(1)
-            self.n_list = self.master_dom.getElementsByTagName('spell')
+            self.n_list = self.xml.findall('spell')
             self.refresh_row(self.grid.GetNumberRows()-1)
             self.handler.refresh_spells()
         dlg.Destroy()
 
     def on_refresh_spells( self, evt ):
-        f_list = self.master_dom.getElementsByTagName('spell')
+        f_list = self.xml.findall('spell')
         for spell in f_list:
-            spell.setAttribute( 'used', '0' )
+            spell.set( 'used', '0' )
 
     def on_size(self,event):
         s = self.GetClientSizeTuple()
@@ -1845,7 +1802,7 @@
 
 class divine_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Divine Spells')
+        pname = handler.xml.set("name", 'Divine Spells')
         wx.Panel.__init__(self, parent, -1)
         self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.handler = handler
@@ -1862,9 +1819,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_add, id=20)
         self.Bind(wx.EVT_BUTTON, self.on_refresh_spells, id=30)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml[:]
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.grid.CreateGrid(len(n_list),4,1)
         self.grid.SetRowLabelSize(0)
         self.grid.SetColLabelValue(0,"No.")
@@ -1880,15 +1837,15 @@
         col = evt.GetCol()
         value = self.grid.GetCellValue(row,col)
         if col == 0:
-            self.n_list[row].setAttribute('memrz',value)
+            self.n_list[row].set('memrz',value)
 
 
     def refresh_row(self,i):
         spell = self.n_list[i]
-        memrz = spell.getAttribute('memrz')
-        name = spell.getAttribute('name')
-        type = spell.getAttribute('desc')
-        level = spell.getAttribute('level')
+        memrz = spell.get('memrz')
+        name = spell.get('name')
+        type = spell.get('desc')
+        level = spell.get('level')
         self.grid.SetCellValue(i,0,memrz)
         self.grid.SetCellValue(i,2,name)
         self.grid.SetReadOnly(i,2)
@@ -1902,42 +1859,39 @@
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
+                self.xml.remove(self.n_list[i])
                 self.handler.refresh_spells()
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["d20"]+"d20divine.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('gift')
+            tree = parse(orpg.dirpath.dir_struct["d20"]+"d20divine.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('gift')
         opts = []
         # lvl = int(self.handler.get_char_lvl('level'))
         # castlvl = lvl / 2
         for f in f_list:
-            opts.append("(" + f.getAttribute('level') + ")" + f.getAttribute('name'))
-            # spelllvl = f.getAttribute('level')
+            opts.append("(" + f.get('level') + ")" + f.get('name'))
+            # spelllvl = f.get('level')
             # if spelllvl <= "1":
-            #     opts.append("(" + f.getAttribute('level') + ")" + f.getAttribute('name'))
+            #     opts.append("(" + f.get('level') + ")" + f.get('name'))
             # else:
             #     if eval('%d >= %s' %(castlvl, spelllvl)):
-            #         opts.append("(" + f.getAttribute('level') + ")" + f.getAttribute('name'))
+            #         opts.append("(" + f.get('level') + ")" + f.get('name'))
         dlg = wx.SingleChoiceDialog(self,'Choose Spell','Spells',opts)
         if dlg.ShowModal() == wx.ID_OK:
             i = dlg.GetSelection()
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(XML(tostring(f_list[i])))
             self.grid.AppendRows(1)
-            self.n_list = self.master_dom.getElementsByTagName('gift')
+            self.n_list = self.xml.findall('gift')
             self.refresh_row(self.grid.GetNumberRows()-1)
             self.handler.refresh_spells()
         dlg.Destroy()
 
     def on_refresh_spells( self, evt ):
-        f_list = self.master_dom.getElementsByTagName('gift')
+        f_list = self.xml.findall('gift')
         for spell in f_list:
-            spell.setAttribute( 'used', '0' )
+            spell.set( 'used', '0' )
 
     def on_size(self,event):
         s = self.GetClientSizeTuple()
@@ -1960,7 +1914,7 @@
 
 class power_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Pionic Powers')
+        pname = handler.xml.set("name", 'Pionic Powers')
         wx.Panel.__init__(self, parent, -1)
         self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.handler = handler
@@ -1976,9 +1930,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_add, id=20)
         self.Bind(wx.EVT_BUTTON, self.on_refresh_powers, id=30)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml[:]
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.grid.CreateGrid(len(n_list),5,1)
         self.grid.SetRowLabelSize(0)
         self.grid.SetColLabelValue(0,"PP")
@@ -1997,16 +1951,16 @@
         col = evt.GetCol()
         value = self.grid.GetCellValue(row,col)
         """if col == 0:
-            self.n_list[row].setAttribute('memrz',value)"""
+            self.n_list[row].set('memrz',value)"""
 
 
     def refresh_row(self,i):
         power = self.n_list[i]
-        point = power.getAttribute('point')
-        name = power.getAttribute('name')
-        type = power.getAttribute('desc')
-        test = power.getAttribute('test')
-        level = power.getAttribute('level')
+        point = power.get('point')
+        name = power.get('name')
+        type = power.get('desc')
+        test = power.get('test')
+        level = power.get('level')
         self.grid.SetCellValue(i,0,point)
         self.grid.SetReadOnly(i,0)
         self.grid.SetCellValue(i,1,level)
@@ -2023,34 +1977,31 @@
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
+                self.xml.removeChild(self.n_list[i])
                 self.handler.refresh_powers()
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["d20"]+"d20powers.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('power')
+            tree = parse(orpg.dirpath.dir_struct["d20"]+"d20powers.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('power')
         opts = []
         # lvl = int(self.handler.get_char_lvl('level'))
         # castlvl = lvl / 2
         for f in f_list:
-            opts.append("(" + f.getAttribute('level') + ") - " + f.getAttribute('name') + " - " + f.getAttribute('test'))
-            # spelllvl = f.getAttribute('level')
+            opts.append("(" + f.get('level') + ") - " + f.get('name') + " - " + f.get('test'))
+            # spelllvl = f.get('level')
             # if spelllvl <= "1":
-            #     opts.append("(" + f.getAttribute('level') + ") - " + f.getAttribute('name') + " - " + f.getAttribute('test'))
+            #     opts.append("(" + f.get('level') + ") - " + f.get('name') + " - " + f.get('test'))
             # else:
             #     if eval('%d >= %s' %(castlvl, spelllvl)):
-            #         opts.append("(" + f.getAttribute('level') + ") - " + f.getAttribute('name') + " - " + f.getAttribute('test'))
+            #         opts.append("(" + f.get('level') + ") - " + f.get('name') + " - " + f.get('test'))
         dlg = wx.SingleChoiceDialog(self,'Choose Power','Powers',opts)
         if dlg.ShowModal() == wx.ID_OK:
             i = dlg.GetSelection()
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(XML(tostring(f_list[i])))
             self.grid.AppendRows(1)
-            self.n_list = self.master_dom.getElementsByTagName('power')
+            self.n_list = self.xml.findall('power')
             self.refresh_row(self.grid.GetNumberRows()-1)
             self.handler.refresh_powers()
         dlg.Destroy()
@@ -2060,8 +2011,8 @@
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
-                self.n_list = self.master_dom.getElementsByTagName('weapon')
+                self.xml.remove(self.n_list[i])
+                self.n_list = self.xml.findall('weapon')
                 self.handler.refresh_weapons()
 
 
@@ -2093,7 +2044,7 @@
 class attack_grid(wx.grid.Grid):
     """grid for attacks"""
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Melee')
+        pname = handler.xml.set("name", 'Melee')
         wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         self.parent = parent
         self.handler = handler
@@ -2117,7 +2068,7 @@
             value = "0"
             self.SetCellValue( row, col, value )
         attribs = ['base','second','third','forth','fifth','sixth','misc']
-        self.babs.setAttribute( attribs[col], value )
+        self.babs.set( attribs[col], value )
         self.parent.refresh_data()
 
     def refresh_data(self):
@@ -2136,7 +2087,7 @@
 
 class weapon_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Weapons')
+        pname = handler.xml.set("name", 'Weapons')
         wx.Panel.__init__(self, parent, -1)
         self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -2148,9 +2099,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_remove, id=10)
         self.Bind(wx.EVT_BUTTON, self.on_add, id=20)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
-        n_list = handler.master_dom.getElementsByTagName('weapon')
+        n_list = handler.xml.findall('weapon')
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.handler = handler
         self.grid.CreateGrid(len(n_list),8,1)
         self.grid.SetRowLabelSize(0)
@@ -2166,51 +2117,48 @@
         col = evt.GetCol()
         value = self.grid.GetCellValue(row,col)
         if col == 0:
-            self.n_list[row].setAttribute('name',value)
+            self.n_list[row].set('name',value)
             self.handler.refresh_weapons();
         else:
-            self.n_list[row].setAttribute(self.grid.GetColLabelValue(col),value)
+            self.n_list[row].set(self.grid.GetColLabelValue(col),value)
 
     def refresh_row(self,i):
         n = self.n_list[i]
-        name = n.getAttribute('name')
-        mod = n.getAttribute('mod')
-        ran = n.getAttribute('range')
+        name = n.get('name')
+        mod = n.get('mod')
+        ran = n.get('range')
         self.grid.SetCellValue(i,0,name)
-        self.grid.SetCellValue(i,1,n.getAttribute('damage'))
+        self.grid.SetCellValue(i,1,n.get('damage'))
         self.grid.SetCellValue(i,2,mod)
-        self.grid.SetCellValue(i,3,n.getAttribute('critical'))
-        self.grid.SetCellValue(i,4,n.getAttribute('type'))
-        self.grid.SetCellValue(i,5,n.getAttribute('weight'))
+        self.grid.SetCellValue(i,3,n.get('critical'))
+        self.grid.SetCellValue(i,4,n.get('type'))
+        self.grid.SetCellValue(i,5,n.get('weight'))
         self.grid.SetCellValue(i,6,ran)
-        self.grid.SetCellValue(i,7,n.getAttribute('size') )
+        self.grid.SetCellValue(i,7,n.get('size') )
 
     def on_remove(self,evt):
         rows = self.grid.GetNumberRows()
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
-                self.n_list = self.master_dom.getElementsByTagName('weapon')
+                self.xml.remove(self.n_list[i])
+                self.n_list = self.xml.findall('weapon')
                 self.handler.refresh_weapons()
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["d20"]+"d20weapons.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('weapon')
+            tree = parse(orpg.dirpath.dir_struct["d20"]+"d20weapons.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('weapon')
         opts = []
         for f in f_list:
-            opts.append(f.getAttribute('name'))
+            opts.append(f.get('name'))
         dlg = wx.SingleChoiceDialog(self,'Choose Weapon','Weapon List',opts)
         if dlg.ShowModal() == wx.ID_OK:
             i = dlg.GetSelection()
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(XML(tostring(f_list[i])))
             self.grid.AppendRows(1)
-            self.n_list = self.master_dom.getElementsByTagName('weapon')
+            self.n_list = self.xml.findall('weapon')
             self.refresh_row(self.grid.GetNumberRows()-1)
             self.handler.refresh_weapons()
         dlg.Destroy()
@@ -2233,7 +2181,7 @@
 
 class attack_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Melee')
+        pname = handler.xml.set("name", 'Melee')
         wx.Panel.__init__(self, parent, -1)
 
         self.a_grid = attack_grid(self, handler)
@@ -2255,7 +2203,7 @@
 
 class ac_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Armor')
+        pname = handler.xml.set("name", 'Armor')
         wx.Panel.__init__(self, parent, -1)
         self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -2267,8 +2215,8 @@
         self.Bind(wx.EVT_BUTTON, self.on_remove, id=10)
         self.Bind(wx.EVT_BUTTON, self.on_add, id=20)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
-        self.master_dom = handler.master_dom
-        n_list = handler.master_dom._get_childNodes()
+        self.xml = handler.xml
+        n_list = handler.xml[:]
         self.n_list = n_list
         col_names = ['Armor','bonus','maxdex','cp','sf','weight','speed','type']
         self.grid.CreateGrid(len(n_list),len(col_names),1)
@@ -2288,43 +2236,42 @@
         if col >= 1 and col <= 5:
             try:
                 int(value)
-                self.n_list[row].setAttribute(self.atts[col],value)
+                self.n_list[row].set(self.atts[col],value)
             except:
                 self.grid.SetCellValue(row,col,"0")
         else:
-            self.n_list[row].setAttribute(self.atts[col],value)
+            self.n_list[row].set(self.atts[col],value)
 
     def refresh_row(self,i):
         n = self.n_list[i]
         for y in range(len(self.atts)):
-            self.grid.SetCellValue(i,y,n.getAttribute(self.atts[y]))
+            self.grid.SetCellValue(i,y,n.get(self.atts[y]))
 
     def on_remove(self,evt):
         rows = self.grid.GetNumberRows()
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
+                self.xml.remove(self.n_list[i])
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["d20"]+"d20armor.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('armor')
+            tree = parse(orpg.dirpath.dir_struct["d20"]+"d20armor.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('armor')
         opts = []
         for f in f_list:
-            opts.append(f.getAttribute('name'))
+            opts.append(f.get('name'))
         dlg = wx.SingleChoiceDialog(self,'Choose Armor:','Armor List',opts)
         if dlg.ShowModal() == wx.ID_OK:
             i = dlg.GetSelection()
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(XML(tostring(f_list[i])))
             self.grid.AppendRows(1)
+            self.n_list = self.xml.findall('armor')
             self.refresh_row(self.grid.GetNumberRows()-1)
         dlg.Destroy()
 
+
     def on_size(self,event):
         s = self.GetClientSizeTuple()
         self.grid.SetDimensions(0,0,s[0],s[1]-25)
@@ -2339,7 +2286,7 @@
 
 class class_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Class')
+        pname = handler.xml.set("name", 'Class')
         wx.Panel.__init__(self, parent, -1)
         self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
         sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -2353,9 +2300,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_add, id=20)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
 
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml[:]
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.grid.CreateGrid(len(n_list),2,1)
         self.grid.SetRowLabelSize(0)
         self.grid.SetColLabelValue(0,"Class")
@@ -2370,15 +2317,14 @@
         value = self.grid.GetCellValue(row,col)
         try:
             int(value)
-            self.n_list[row].setAttribute('level',value)
+            self.n_list[row].set('level',value)
         except:
             self.grid.SetCellValue(row,col,"1")
 
-
     def refresh_row(self,i):
         n = self.n_list[i]
-        name = n.getAttribute('name')
-        level = n.getAttribute('level')
+        name = n.get('name')
+        level = n.get('level')
         self.grid.SetCellValue(i,0,name)
         self.grid.SetReadOnly(i,0)
         self.grid.SetCellValue(i,1,level)
@@ -2389,28 +2335,25 @@
         for i in range(rows):
             if self.grid.IsInSelection(i,0):
                 self.grid.DeleteRows(i)
-                self.master_dom.removeChild(self.n_list[i])
+                self.xml.remove(self.n_list[i])
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["d20"]+"d20classes.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('class')
+            tree = parse(orpg.dirpath.dir_struct["d20"]+"d20classes.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('class')
         opts = []
         for f in f_list:
-            opts.append(f.getAttribute('name'))
+            opts.append(f.get('name'))
         dlg = wx.SingleChoiceDialog(self,'Choose Class','Classes',opts)
         if dlg.ShowModal() == wx.ID_OK:
             i = dlg.GetSelection()
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(XML(tostring(f_list[i])))
             self.grid.AppendRows(1)
+            self.n_list = self.xml.findall('class')
             self.refresh_row(self.grid.GetNumberRows()-1)
         dlg.Destroy()
 
-
     def on_size(self,event):
         s = self.GetClientSizeTuple()
         self.grid.SetDimensions(0,0,s[0],s[1]-25)