diff orpg/gametree/nodehandlers/StarWarsd20.py @ 135:dcf4fbe09b70 beta

Traipse Beta 'OpenRPG' {091010-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 (Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana **Pretty important update that can help remove thousands of dead children from your gametree. **Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! **New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
author sirebral
date Tue, 10 Nov 2009 14:11:28 -0600
parents c5bc2abaf7f8
children 06f10429eedc
line wrap: on
line diff
--- a/orpg/gametree/nodehandlers/StarWarsd20.py	Fri Sep 25 20:47:16 2009 -0500
+++ b/orpg/gametree/nodehandlers/StarWarsd20.py	Tue Nov 10 14:11:28 2009 -0600
@@ -29,6 +29,8 @@
 __version__ = "$Id: StarWarsd20.py,v 1.18 2006/11/15 12:11:23 digitalxero Exp $"
 
 from core import *
+from orpg.tools.orpg_log import debug
+from xml.etree.ElementTree import parse
 
 SWD20_EXPORT = wx.NewId()
 ############################
@@ -44,7 +46,7 @@
         self.load_children()
 
     def load_children(self):
-        children = self.master_dom._get_childNodes()
+        children = self.xml.getchildren()
         for c in children:
             self.tree.load_xml(c,self.mytree_node)
 
@@ -58,7 +60,7 @@
         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)
+            xml_dom = self.xml.insertBefore(xml_dom,None)
             self.tree.load_xml(xml_dom, self.mytree_node)
             self.tree.Expand(self.mytree_node)
         elif opt == wx.NO:
@@ -67,7 +69,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>"
         max = tree.GetChildrenCount(handler.mytree_node)
@@ -127,38 +129,36 @@
     def on_version(self,old_version):
         node_handler.on_version(self,old_version)
         if old_version == "":
-            tmp = open(dir_struct["nodes"]+"StarWars_d20character.xml","r")
-            xml_dom = parseXml_with_dlg(self.tree,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
+            tree = parse(dir_struct["nodes"]+"StarWars_d20character.xml")
+            xml_dom = tree.getroot()
             ## add new nodes
             for tag in ("howtouse","inventory","powers","divine","pp"):
-                node_list = xml_dom.getElementsByTagName(tag)
-                self.master_dom.appendChild(node_list[0])
+                node_list = xml_dom.findall(tag)
+                self.xml.append(node_list[0])
 
             ## 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.findall('melee')[0]
+            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.findall('ranged')[0]
+            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.findall('general')[0]
 
             for tag in ("currentxp","xptolevel"):
-                node_list = xml_dom.getElementsByTagName(tag)
-                gen_list.appendChild(node_list[0])
+                node_list = xml_dom.findall(tag)
+                gen_list.append(node_list[0])
             ## 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_dom,self.xml)
+            #self.xml = xml_dom
         print old_version
 
 
@@ -176,7 +176,7 @@
 
 
     def new_child_handler(self,tag,text,handler_class,icon='gear'):
-        node_list = self.master_dom.getElementsByTagName(tag)
+        node_list = self.xml.findall(tag)
         tree = self.tree
         i = self.tree.icons[icon]
         new_tree_node = tree.AppendItem(self.mytree_node,text,i,i)
@@ -257,7 +257,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)
@@ -288,42 +288,33 @@
         created by SWd20char_handler.
     """
     def __init__(self, xml_dom, tree_node, parent):
-        node_handler.__init__(self,xml_dom, tree_node)
+        node_handler.__init__(self, xml_dom, tree_node)
         self.char_hander = parent
         self.drag = False
         self.frame = component.get('frame')
         self.myeditor = None
 
 
-    def on_drop(self,evt):
+    def on_drop(self, evt):
         pass
 
-    def on_rclick(self,evt):
+    def on_rclick(self, evt):
         pass
 
-    def on_ldclick(self,evt): #Function needs help. Needs an OnClose I think.
-        if self.myeditor == None or self.myeditor.destroyed:
-            title = self.master_dom.getAttribute('name') + " Editor"
-            # Frame created in correctly.
-            self.myeditor = wx.Frame(self.frame,title,dir_struct["icon"]+'grid.ico')
-            wnd = self.get_design_panel(self.myeditor)
-            self.myeditor.panel = wnd
-            self.wnd = wnd
-            self.myeditor.Show(1)
-        else:
-            self.myeditor.Raise()
+    def on_ldclick(self, evt):
+        return
 
-    def on_html(self,evt):
+    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)
 
-    def get_design_panel(self,parent):
+    def get_design_panel(self, parent):
         pass
 
-    def get_use_panel(self,parent):
+    def get_use_panel(self, parent):
         return self.get_design_panel(parent)
 
     def delete(self):
@@ -338,23 +329,23 @@
         SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
         tree = self.tree
         icons = self.tree.icons
-        node_list = self.master_dom.getElementsByTagName('skill')
+        node_list = self.xml.findall('skill')
         self.skills={}
         for n in node_list:
-            name = n.getAttribute('name')
+            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
 
@@ -363,8 +354,8 @@
         item = self.tree.GetSelection()
         name = self.tree.GetItemText(item)
         skill = self.skills[name]
-        rank = int(skill.getAttribute('rank'))
-        untrained = int(skill.getAttribute('untrained'))
+        rank = int(skill.get('rank'))
+        untrained = int(skill.get('untrained'))
         chat = self.chat
         if item == self.mytree_node:
             SWd20_char_child.on_ldclick(self,evt)
@@ -388,14 +379,14 @@
     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')
+        node_list = self.xml.findall('skill')
         for n in node_list:
-            name = n.getAttribute('name')
-            stat = n.getAttribute('stat')
-            rank = n.getAttribute('rank')
+            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 = "+"
@@ -413,11 +404,11 @@
     def __init__(self, xml_dom, tree_node, parent):
         SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
         self.abilities = {}
-        node_list = self.master_dom.getElementsByTagName('stat')
+        node_list = self.xml.findall('stat')
         tree = self.tree
         icons = tree.icons
         for n in node_list:
-            name = n.getAttribute('abbr')
+            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 )
@@ -438,13 +429,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")
@@ -454,11 +445,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')
+        node_list = self.xml.findall('stat')
         for n in node_list:
-            name = n.getAttribute('name')
-            abbr = n.getAttribute('abbr')
-            base = n.getAttribute('base')
+            name = n.get('name')
+            abbr = n.get('abbr')
+            base = n.get('base')
             mod = str(self.get_mod(abbr))
             if mod >= 0:
                 mod1 = "+"
@@ -476,21 +467,21 @@
         SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
         tree = self.tree
         icons = self.tree.icons
-        node_list = self.master_dom.getElementsByTagName('save')
+        node_list = self.xml.findall('save')
         self.saves={}
         for n in node_list:
-            name = n.getAttribute('name')
+            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
         total = stat_mod + base + miscmod
         return total
@@ -522,15 +513,15 @@
         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')
+        node_list = self.xml.findall('save')
         for n in node_list:
-            name = n.getAttribute('name')
-            stat = n.getAttribute('stat')
-            base = n.getAttribute('base')
+            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 = "+"
@@ -555,12 +546,11 @@
         return wnd
 
     def tohtml(self):
-        n_list = self.master_dom._get_childNodes()
+        n_list = self.xml.getchildren()
         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() + ", "
+            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
 
@@ -568,9 +558,8 @@
         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()
+        node = self.xml.findall( 'name' )[0]
+        return node.text
 
 
 class SWd20classes(SWd20_char_child):
@@ -587,17 +576,17 @@
 
     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()
+        n_list = self.xml.getchildren()
         for n in n_list:
-            html_str += n.getAttribute('name') + " ("+n.getAttribute('level')+"), "
+            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')
+        node_list = self.xml.findall('class')
         for n in node_list:
-            lvl = n.getAttribute('level')
-            type = n.getAttribute('name')
+            lvl = n.get('level')
+            type = n.get('name')
             if attr == "level":
                 return lvl
             elif attr == "class":
@@ -618,9 +607,9 @@
 
     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()
+        n_list = self.xml.getchildren()
         for n in n_list:
-            html_str += n.getAttribute('name')+ ", "
+            html_str += n.get('name')+ ", "
         html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
         return html_str
 
@@ -649,12 +638,11 @@
         return wnd
 
     def tohtml(self):
-        n_list = self.master_dom._get_childNodes()
+        n_list = self.xml.getchildren()
         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 />"
+            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
 
@@ -662,9 +650,8 @@
         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()
+        node = self.xml.findall( 'name' )[0]
+        return node.text
 
 class SWd20hp(SWd20_char_child):
     """ Node Handler for hit points.  This handler will be
@@ -680,19 +667,19 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=4>Wound 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
 
@@ -710,19 +697,19 @@
 
     def tohtml(self):
         html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=4>Vitality 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_vp( self ):
         try:
-            return eval( self.master_dom.getAttribute( 'max' ) )
+            return eval( self.xml.get( 'max' ) )
         except:
             return 0
     def get_current_vp( self ):
         try:
-            return eval( self.master_dom.getAttribute( 'current' ) )
+            return eval( self.xml.get( 'current' ) )
         except:
             return 0
 
@@ -732,9 +719,9 @@
     """
     def __init__(self,xml_dom,tree_node,parent):
         SWd20_char_child.__init__(self,xml_dom,tree_node,parent)
-        node_list = self.master_dom.getElementsByTagName('melee')
+        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()
 
@@ -743,9 +730,9 @@
         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
@@ -761,13 +748,13 @@
         else:
             stat_mod = self.char_hander.child_handlers['abilities'].get_mod('Dex')
             temp = self.ranged
-        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, stat_mod ,misc)
 
     def on_rclick(self,evt):
@@ -778,8 +765,8 @@
             SWd20_char_child.on_ldclick(self,evt)
             #self.frame.add_panel(self.get_design_panel(self.frame.note))
         else:
-            mod = int(self.weapons[name].getAttribute('mod'))
-            if self.weapons[name].getAttribute('range') == '0':
+            mod = int(self.weapons[name].get('mod'))
+            if self.weapons[name].get('range') == '0':
                 mod = mod + self.get_mod('m')
                 if mod >= 0:
                     mod1 = "+"
@@ -792,7 +779,7 @@
                 else:
                     mod1 = ""
             chat = self.chat
-            dmg = self.weapons[name].getAttribute('damage')
+            dmg = self.weapons[name].get('damage')
             lvl = self.get_char_lvl('level')
             cname = self.char_hander.get_char_name()
             txt = '%s %s Attack Roll: [1d20%s%s] ===> DMG: [%s%s%s]' % (cname, name, mod1, mod, dmg, mod1, mod)
@@ -825,23 +812,23 @@
         html_str += "<td>"+str(ranged[1])+"</td>"
         html_str += "<td>"+str(ranged[2])+"</td></tr></table>"
 
-        n_list = self.master_dom.getElementsByTagName('weapon')
+        n_list = self.xml.findall('weapon')
         for n in n_list:
-            mod = n.getAttribute('mod')
+            mod = n.get('mod')
             if mod >= 0:
                 mod1 = "+"
             else:
                 mod1 = ""
-            ran = n.getAttribute('range')
+            ran = n.get('range')
             total = str(int(mod) + self.get_mod(ran))
             html_str += """<P><table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=2>Weapon</th>
                     <th>Attack</th><th >Damage</th><th>Critical</th></tr>"""
-            html_str += "<tr ALIGN='center' ><td  colspan=2>"+n.getAttribute('name')+"</td><td>"+total+"</td>"
-            html_str += "<td>"+n.getAttribute('damage')+"</td><td>"+n.getAttribute('critical')+"</td></tr>"
+            html_str += "<tr ALIGN='center' ><td  colspan=2>"+n.get('name')+"</td><td>"+total+"</td>"
+            html_str += "<td>"+n.get('damage')+"</td><td>"+n.get('critical')+"</td></tr>"
             html_str += """<tr BGCOLOR=#E9E9E9 ><th>Range</th><th>Weight</th>
                         <th>Type</th><th>Size</th><th>Misc Mod</th></tr>"""
-            html_str += "<tr ALIGN='center'><td>"+ran+"</td><td>"+n.getAttribute('weight')+"</td>"
-            html_str += "<td>"+n.getAttribute('type')+"</td><td>"+n.getAttribute('size')+"</td>"
+            html_str += "<tr ALIGN='center'><td>"+ran+"</td><td>"+n.get('weight')+"</td>"
+            html_str += "<td>"+n.get('type')+"</td><td>"+n.get('size')+"</td>"
             html_str += '<td>%s%s</td></tr></table>' % (mod1, mod)
         return html_str
 
@@ -870,19 +857,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):
@@ -898,19 +885,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()
+        n_list = self.xml.getchildren()
         for n in n_list:
             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('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('maxdex')+"</td>"
+            html_str += "<td>"+n.get('speed')+"</td>"
+            html_str += "<td>"+n.get('weight')+"</td></tr></table>"
         return html_str
 
 
@@ -943,7 +930,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)
@@ -999,13 +986,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()
+        self.xml = handler.xml
+        n_list = self.xml.getchildren()
         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, n.text), 0, wx.ALIGN_CENTER_VERTICAL),
                  ])
         self.sizer.AddGrowableCol(1)
         self.SetSizer(self.sizer)
@@ -1017,13 +1003,13 @@
 class hp_panel(wx.Panel):
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, -1)
-        pname = handler.master_dom.setAttribute("name", 'WoundPoints')
+        pname = handler.xml.set("name", 'WoundPoints')
         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, "WP Current:"),   0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, WP_CUR, self.master_dom.getAttribute('current')),   0, wx.EXPAND),
+                 (wx.TextCtrl(self, WP_CUR, self.xml.get('current')),   0, wx.EXPAND),
                  (wx.StaticText(self, -1, "WP Max:"), 0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, WP_MAX, self.master_dom.getAttribute('max')),  0, wx.EXPAND),
+                 (wx.TextCtrl(self, WP_MAX, self.xml.get('max')),  0, wx.EXPAND),
                  ])
         self.sizer.AddGrowableCol(1)
         self.Bind(wx.EVT_SIZE, self.on_size)
@@ -1034,9 +1020,9 @@
     def on_text(self,evt):
         id = evt.GetId()
         if id == WP_CUR:
-            self.master_dom.setAttribute('current',evt.GetString())
+            self.xml.set('current',evt.GetString())
         elif id == WP_MAX:
-            self.master_dom.setAttribute('max',evt.GetString())
+            self.xml.set('max',evt.GetString())
 
     def on_size(self,evt):
         s = self.GetClientSizeTuple()
@@ -1048,13 +1034,13 @@
 class vp_panel(wx.Panel):
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, -1)
-        pname = handler.master_dom.setAttribute("name", 'VitalityPoints')
+        pname = handler.xml.set("name", 'VitalityPoints')
         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, "VP Current:"),   0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, VP_CUR, self.master_dom.getAttribute('current')),   0, wx.EXPAND),
+                 (wx.TextCtrl(self, VP_CUR, self.xml.get('current')),   0, wx.EXPAND),
                  (wx.StaticText(self, -1, "VP Max:"), 0, wx.ALIGN_CENTER_VERTICAL),
-                 (wx.TextCtrl(self, VP_MAX, self.master_dom.getAttribute('max')),  0, wx.EXPAND),
+                 (wx.TextCtrl(self, VP_MAX, self.xml.get('max')),  0, wx.EXPAND),
                  ])
         self.sizer.AddGrowableCol(1)
         self.Bind(wx.EVT_SIZE, self.on_size)
@@ -1065,9 +1051,9 @@
     def on_text(self,evt):
         id = evt.GetId()
         if id == VP_CUR:
-            self.master_dom.setAttribute('current',evt.GetString())
+            self.xml.set('current',evt.GetString())
         elif id == VP_MAX:
-            self.master_dom.setAttribute('max',evt.GetString())
+            self.xml.set('max',evt.GetString())
 
     def on_size(self,evt):
         s = self.GetClientSizeTuple()
@@ -1081,18 +1067,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.Bind(wx.EVT_SIZE, self.on_size)
@@ -1104,13 +1090,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()
@@ -1120,12 +1106,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.getchildren()
         self.CreateGrid(len(n_list),2)
         self.SetRowLabelSize(0)
         self.SetColLabelSize(0)
@@ -1138,15 +1124,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()
@@ -1160,12 +1144,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.getchildren()
         self.CreateGrid(len(n_list),2)
         self.SetRowLabelSize(0)
         self.SetColLabelSize(0)
@@ -1178,15 +1162,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()
@@ -1200,12 +1182,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']
@@ -1223,7 +1205,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")
@@ -1232,11 +1214,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)
 
@@ -1258,12 +1240,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)
@@ -1282,28 +1264,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)
@@ -1326,12 +1308,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),7)
         self.SetRowLabelSize(0)
@@ -1351,28 +1333,28 @@
         try:
             int(value)
             if col == 3:
-                self.skills[row].setAttribute('rank',value)
+                self.skills[row].set('rank',value)
             elif col ==5:
-                self.skills[row].setAttribute('misc',value)
+                self.skills[row].set('misc',value)
             elif col == 1:
-                self.skills[row].setAttribute('untrained',value)
+                self.skills[row].set('untrained',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)
-        self.SetCellValue(rowi,1,s.getAttribute('untrained'))
-        stat = s.getAttribute('stat')
+        self.SetCellValue(rowi,1,s.get('untrained'))
+        stat = s.get('stat')
         self.SetCellValue(rowi,2,stat)
         self.SetReadOnly(rowi,2)
-        self.SetCellValue(rowi,3,s.getAttribute('rank'))
+        self.SetCellValue(rowi,3,s.get('rank'))
         self.SetCellValue(rowi,4,str(self.stats.get_mod(stat)))
         self.SetReadOnly(rowi,4)
-        self.SetCellValue(rowi,5,s.getAttribute('misc'))
+        self.SetCellValue(rowi,5,s.get('misc'))
         mod = str(self.handler.get_mod(name))
         self.SetCellValue(rowi,6,mod)
         self.SetReadOnly(rowi,6)
@@ -1395,7 +1377,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)
@@ -1410,9 +1392,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
         self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
 
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml.getchildren()
         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")
@@ -1423,8 +1405,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)
@@ -1435,23 +1417,20 @@
         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(dir_struct["SWd20"]+"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(dir_struct["SWd20"]+"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(f_list[i])
             self.grid.AppendRows(1)
             self.refresh_row(self.grid.GetNumberRows()-1)
         dlg.Destroy()
@@ -1470,7 +1449,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
@@ -1493,19 +1472,19 @@
         try:
             int(value)
             if col==1:
-                self.rows[row].setAttribute('base',value)
+                self.rows[row].set('base',value)
             elif col==2:
-                self.rows[row].setAttribute('second',value)
+                self.rows[row].set('second',value)
             elif col==3:
-                self.rows[row].setAttribute('third',value)
+                self.rows[row].set('third',value)
             elif col==4:
-                self.rows[row].setAttribute('forth',value)
+                self.rows[row].set('forth',value)
             elif col==5:
-                self.rows[row].setAttribute('fifth',value)
+                self.rows[row].set('fifth',value)
             elif col==6:
-                self.rows[row].setAttribute('sixth',value)
+                self.rows[row].set('sixth',value)
             elif col==8:
-                self.rows[row].setAttribute('misc',value)
+                self.rows[row].set('misc',value)
             self.parent.refresh_data()
         except:
             self.SetCellValue(row,col,"0")
@@ -1538,7 +1517,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)
@@ -1553,9 +1532,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
         self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
         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),9,1)
         self.grid.SetRowLabelSize(0)
@@ -1570,31 +1549,31 @@
         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)
         elif col == 2:
             try:
                 int(value)
-                self.n_list[row].setAttribute('mod',value)
+                self.n_list[row].set('mod',value)
                 self.refresh_row(row)
             except:
                 self.grid.SetCellValue(row,col,"1")
         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')
         total = str(int(mod) + self.handler.get_mod(ran))
         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') )
         self.grid.SetCellValue(i,8,total)
         self.grid.SetReadOnly(i,8)
 
@@ -1603,27 +1582,24 @@
         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(dir_struct["SWd20"]+"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(dir_struct["SWd20"]+"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(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()
@@ -1646,7 +1622,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)
@@ -1668,7 +1644,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)
@@ -1683,8 +1659,8 @@
         self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
         self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
         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.getchildren()
         self.n_list = n_list
         col_names = ['Armor','DR','Max Dex','Check Penalty','Weight','Speed (10)','Speed (6)','type']
         self.grid.CreateGrid(len(n_list),len(col_names),1)
@@ -1704,39 +1680,36 @@
         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(dir_struct["SWd20"]+"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(dir_struct["SWd20"]+"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(f_list[i])
             self.grid.AppendRows(1)
             self.refresh_row(self.grid.GetNumberRows()-1)
         dlg.Destroy()
@@ -1755,7 +1728,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)
@@ -1771,9 +1744,9 @@
         self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
 
-        n_list = handler.master_dom._get_childNodes()
+        n_list = handler.xml.getchildren()
         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")
@@ -1788,15 +1761,15 @@
         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)
@@ -1807,23 +1780,20 @@
         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(dir_struct["SWd20"]+"SWd20classes.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(dir_struct["SWd20"]+"SWd20classes.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(f_list[i])
             self.grid.AppendRows(1)
             self.refresh_row(self.grid.GetNumberRows()-1)
         dlg.Destroy()