diff orpg/gametree/nodehandlers/dnd35.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 2fa8bd6785a5
children 06f10429eedc
line wrap: on
line diff
--- a/orpg/gametree/nodehandlers/dnd35.py	Fri Sep 25 20:47:16 2009 -0500
+++ b/orpg/gametree/nodehandlers/dnd35.py	Tue Nov 10 14:11:28 2009 -0600
@@ -5,6 +5,7 @@
 from string import *  #a 1.6003
 from inspect import *  #a 1.9001
 from orpg.dirpath import dir_struct
+from xml.etree.ElementTree import parse
 dnd35_EXPORT = wx.NewId()
 
 ############Global Stuff##############
@@ -21,12 +22,12 @@
     return root
 
 #a 1.6 convinience function added safeGetAttr
-def safeGetAttr(node,lable,defRetV=None):
-    cna=node.attributes
-    for i2 in range(len(cna)):
-        if cna.item(i2).name == lable:
-            return cna.item(i2).value
-    #retV=node.getAttribute(lable) # getAttribute does not distingish between
+def safeGetAttr(node, label, defRetV=None):
+    cna=node.attrib
+    for key in cna:
+        if key == label:
+            return cna[key]
+    #retV=node.get(lable) # get does not distingish between
     # the attribute not being present vs it having a value of ""
     # This is bad for this routine, thus not used.
     return defRetV
@@ -58,7 +59,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)
@@ -137,7 +138,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)
 
@@ -167,12 +168,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
 
@@ -183,14 +183,13 @@
 
 
     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 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')
         self.hparent = handler #a 1.5002 allow ability to run up tree, needed
         # a 1.5002 parent is functional parent, not invoking parent.
 
@@ -199,7 +198,7 @@
         #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)
@@ -212,18 +211,16 @@
         row = evt.GetRow()
         col = evt.GetCol()
         value = self.GetCellValue(row,col)
-        t_node = self.n_list[row]._get_firstChild()
-        t_node._set_nodeValue(value)
+        t_node = self.n_list[row]
+        t_node.text = value
         if row==0:
             self.handler.on_name_change(value)
         #self.AutoSizeColumn(1)
 
-    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.SetReadOnly(rowi,0)
-        self.SetCellValue(rowi,1,t_node._get_nodeValue())
+    def refresh_row(self, rowi):
+        self.SetCellValue(rowi, 0, self.n_list[rowi].tag)
+        self.SetReadOnly(rowi, 0)
+        self.SetCellValue(rowi, 1, self.n_list[rowi].text)
         self.AutoSizeColumn(1)
 
 class dnd35inventory(dnd35_char_child):
@@ -242,12 +239,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>Inventory</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
 
@@ -255,7 +251,7 @@
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, wx.ID_ANY)
 
-        self.n_list = handler.master_dom._get_childNodes()
+        self.n_list = handler.xml.getchildren()
         self.autosize = False
 
         self.sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Inventroy"), wx.VERTICAL)
@@ -317,13 +313,11 @@
 
         for node in self.n_list:
             if node._get_tagName() == nodeName:
-                t_node = component.get('xml').safe_get_text_node(node)
-                t_node._set_nodeValue(value)
+                node.text = value
 
     def saveMoney(self, row, col):
         value = self.grid.GetCellValue(row, col)
-        t_node = component.get('xml').safe_get_text_node(self.n_list[row])
-        t_node._set_nodeValue(value)
+        self.n_list[row].text = value
 
     def on_cell_change(self, evt):
         row = evt.GetRow()
@@ -334,9 +328,8 @@
 
 
     def refresh_row(self, row):
-        t_node = component.get('xml').safe_get_text_node(self.n_list[row])
-        tagname = self.n_list[row]._get_tagName()
-        value = t_node._get_nodeValue()
+        tagname = self.n_list[row].tag
+        value = self.n_list[row].text
         if tagname == 'Gear':
             self.fillTextNode(tagname, value)
         elif tagname == 'Magic':
@@ -367,7 +360,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)
@@ -405,7 +398,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)
 
@@ -429,12 +422,12 @@
         self.root.abilities = self #a 1.5002 let other classes find me.
 
         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 )
@@ -457,14 +450,14 @@
             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
         mod = int(mod)
         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")
@@ -474,11 +467,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 int(mod) >= 0: #m 1.6013 added "int(" and ")"
                 mod1 = "+"
@@ -492,7 +485,7 @@
 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')
         self.hparent = handler #a 1.5002 allow ability to run up tree.
         self.root = getRoot(self)
         #a 1.5002 in this case, we need the functional parent, not the invoking parent.
@@ -501,7 +494,7 @@
         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']
@@ -520,7 +513,7 @@
         #print value
         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")
@@ -532,11 +525,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)
         #if self.root.saves.saveGrid: #a 1.6018 d 1.9002 whole if clause
@@ -578,20 +571,20 @@
 
     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')
         # print "eclasses - get_char_lvl node_list",node_list
         tot = 0  #a 1.5009 actually, slipping in a quick enhancement ;-)
         for n in node_list:
-            lvl = n.getAttribute('level') #o 1.5009 not sure of the value of this
+            lvl = n.get('level') #o 1.5009 not sure of the value of this
             tot += int(lvl) #a 1.5009
-            type = n.getAttribute('name') #o 1.5009 not sure of the value of this
+            type = n.get('name') #o 1.5009 not sure of the value of this
             #print type,lvl #a (debug) 1.5009
             if attr == "level":
                 return lvl #o 1.5009 this returns the level of someone's first class. ???
@@ -602,17 +595,17 @@
 
     def get_class_lvl( self, classN ): #a 1.5009 need to be able to get monk lvl
         #a 1.5009 this function is new.
-        node_list = self.master_dom.getElementsByTagName('class')
+        node_list = self.xml.findall('class')
         #print "eclasses - get_class_lvl node_list",node_list
         for n in node_list:
-            lvl = n.getAttribute('level')
-            type = n.getAttribute('name')
+            lvl = n.get('level')
+            type = n.get('name')
             if classN == type:
                 return lvl
 
 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)
@@ -634,9 +627,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.getchildren()
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.grid.CreateGrid(len(n_list),3,1)
         self.grid.SetRowLabelSize(0)
         self.grid.SetColLabelValue(0,"Class")
@@ -652,7 +645,7 @@
         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")
 
@@ -660,9 +653,9 @@
     def refresh_row(self,i):
         n = self.n_list[i]
 
-        name = n.getAttribute('name')
-        level = n.getAttribute('level')
-        book = n.getAttribute('book')
+        name = n.get('name')
+        level = n.get('level')
+        book = n.get('book')
         self.grid.SetCellValue(i,0,name)
         self.grid.SetReadOnly(i,0)
         self.grid.SetCellValue(i,1,level)
@@ -677,23 +670,21 @@
         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["dnd35"]+"dnd35classes.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
+            tree = parse(dir_struct["dnd35"]+"dnd35classes.xml")
+            xml_dom = tree.getroot()
             self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('class')
+        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()
@@ -725,10 +716,10 @@
 
         self.root = getRoot(self) #a 1.5002
         self.root.saves = self #a 1.6009
-        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)
@@ -746,13 +737,13 @@
 
     def get_mod(self,name):
         save = self.saves[name]
-        stat = save.getAttribute('stat')
+        stat = save.get('stat')
         #print "dnd35saves, get_mod: self,root",self,self.root #a (debug) 1.5002
         #print "and abilities",self.root.abilities      #a (debug) 1.5002
         stat_mod = self.root.abilities.get_mod(stat)            #a 1.5002
-        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
 
@@ -788,17 +779,17 @@
             <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(dnd_globals["stats"][stat])         #d 1.5002
             stat_mod = self.root.abilities.get_mod(stat)        #a 1.5002
 
-            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 = "+"
@@ -814,7 +805,7 @@
 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')
         self.hparent = handler #a 1.5002 allow ability to run up tree.
         #a 1.5002 in this case, we need the functional parent, not the invoking parent.
         self.root = getRoot(self)
@@ -826,7 +817,7 @@
         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.CreateGrid(len(saves),7)
         self.SetRowLabelSize(0)
         col_names = ['Save','Key','base','Abil','Magic','Misc','Total']
@@ -857,11 +848,11 @@
         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 ==5:                                       # 1.5001
-                self.saves[row].setAttribute('miscmod',value)
+                self.saves[row].set('miscmod',value)
             self.refresh_row(row)
         except:
             self.SetCellValue(row,col,"0")
@@ -869,17 +860,17 @@
     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.root.abilities.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)
@@ -916,7 +907,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)
@@ -956,7 +947,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)
 
@@ -982,16 +973,16 @@
         skills_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={}
         #Adding code to not display skills you can not use -mgt
         for n in node_list:
-            name = n.getAttribute('name')
+            name = n.get('name')
             self.skills[name] = n
             skill_check = self.skills[name]
-            ranks = int(skill_check.getAttribute('rank'))
-            trained = int(skill_check.getAttribute('untrained'))
+            ranks = int(skill_check.get('rank'))
+            trained = int(skill_check.get('untrained'))
 
             if ranks > 0 or trained == 1:
                 new_tree_node = tree.AppendItem(self.mytree_node,name,
@@ -1009,15 +1000,15 @@
         tree = self.tree
         icons = self.tree.icons
         tree.CollapseAndReset(self.mytree_node)
-        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
             skill_check = self.skills[name]
-            ranks = int(skill_check.getAttribute('rank'))
-            trained = int(skill_check.getAttribute('untrained'))
+            ranks = int(skill_check.get('rank'))
+            trained = int(skill_check.get('untrained'))
 
             if ranks > 0 or trained == 1:
                 new_tree_node = tree.AppendItem(self.mytree_node,name,
@@ -1029,11 +1020,11 @@
 
     def get_mod(self,name):
         skill = self.skills[name]
-        stat = skill.getAttribute('stat')
+        stat = skill.get('stat')
         #stat_mod = int(dnd_globals["stats"][stat])                 #d 1.5002
         stat_mod = self.root.abilities.get_mod(stat)                #a 1.5002
-        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
         return total
 
@@ -1052,8 +1043,8 @@
 
         skill = self.skills[name]
 
-        untr = skill.getAttribute('untrained')                         #a 1.6004
-        rank = skill.getAttribute('rank')                              #a 1.6004
+        untr = skill.get('untrained')                         #a 1.6004
+        rank = skill.get('rank')                              #a 1.6004
         if eval('%s == 0' % (untr)):                                   #a 1.6004
             if eval('%s == 0' % (rank)):                               #a 1.6004
                 res = 'You fumble around, accomplishing nothing'       #a 1.6004
@@ -1065,7 +1056,7 @@
         armor = ''
         acCp = ''
         if ac < 0:  #acCp >= 1 #m 1.5004 this is stored as negatives.
-            armorCheck = int(skill.getAttribute('armorcheck'))
+            armorCheck = int(skill.get('armorcheck'))
             #print "ac,armorCheck",ac,armorCheck
             if armorCheck == 1:
                 acCp=ac
@@ -1095,13 +1086,13 @@
         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')
-            untr = n.getAttribute('untrained')                              #a 1.6004
+            name = n.get('name')
+            stat = n.get('stat')
+            rank = n.get('rank')
+            untr = n.get('untrained')                              #a 1.6004
             #Filter unsuable skills out of pretty print -mgt
             if eval('%s > 0' % (rank)) or eval('%s == 1' % (untr)):
                 if eval('%s >=1' % (rank)):
@@ -1118,7 +1109,7 @@
                 continue
             stat_mod = self.root.abilities.get_mod(stat)        #a 1.5002
             #stat_mod = str(dnd_globals["stats"][stat])         #d 1.5002
-            misc = n.getAttribute('misc')
+            misc = n.get('misc')
             mod = str(self.get_mod(name))
             if mod >= 0:
                 mod1 = "+"
@@ -1135,13 +1126,13 @@
     def __init__(self, parent, handler):
         self.hparent = handler    #a 1.5002 need function parent, not invoker
         self.root = getRoot(self) #a 1.5002
-        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')
         #xelf.stats = dnd_globals["stats"]                           #d 1.5002
 
         self.CreateGrid(len(skills),6)
@@ -1162,9 +1153,9 @@
         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")
@@ -1174,13 +1165,13 @@
 
     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(dnd_globals["stats"][stat]))  #d 1.5002
         if self.root.abilities: #a 1.5002 sanity check.
             stat_mod=self.root.abilities.get_mod(stat)           #a 1.5002
@@ -1191,7 +1182,7 @@
 
         self.SetCellValue(rowi,3,str(stat_mod))         #a 1.5002
         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)
@@ -1235,9 +1226,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
 
@@ -1248,8 +1239,8 @@
         #a 1.5002 in this case, we need the functional parent, not the invoking parent.
         self.root = getRoot(self) #a 1.5002
         #tempTitle= 'Feats - ' + self.root.general.charName #a 1.5010
-        #pname = handler.master_dom.setAttribute("name", tempTitle) #a 1.5010
-        pname = handler.master_dom.setAttribute("name", 'Feats') #d 1.5010
+        #pname = handler.xml.set("name", tempTitle) #a 1.5010
+        pname = handler.xml.set("name", 'Feats') #d 1.5010
 
         wx.Panel.__init__(self, parent, -1)
         self.grid = wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
@@ -1272,9 +1263,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.getchildren()
         self.n_list = n_list
-        self.master_dom = handler.master_dom
+        self.xml = handler.xml
         self.grid.CreateGrid(len(n_list),3,1)
         self.grid.SetRowLabelSize(0)
         self.grid.SetColLabelValue(0,"Feat")
@@ -1291,9 +1282,9 @@
     def refresh_row(self,i):
         feat = self.n_list[i]
 
-        name = feat.getAttribute('name')
-        type = feat.getAttribute('type')
-        desc = feat.getAttribute('desc') #m 1.6 correct typo
+        name = feat.get('name')
+        type = feat.get('type')
+        desc = feat.get('desc') #m 1.6 correct typo
         self.grid.SetCellValue(i,0,name)
         self.grid.SetReadOnly(i,0)
         self.grid.SetCellValue(i,1,type)
@@ -1310,25 +1301,23 @@
         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["dnd35"]+"dnd35feats.xml","r")
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close()
+            tree = parse(dir_struct["dnd35"]+"dnd35feats.xml")
+            xml_dom = tree.getroot()
             self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('feat')
+        f_list = self.temp_dom.findall('feat')
         opts = []
         for f in f_list:
-            opts.append(f.getAttribute('name') + "  -  [" +
-                     f.getAttribute('type') + "]  -  " + f.getAttribute('desc'))
+            opts.append(f.get('name') + "  -  [" +
+                     f.get('type') + "]  -  " + f.get('desc'))
         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)
         f_list=0; opts=0
@@ -1371,7 +1360,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)
@@ -1410,7 +1399,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)
 
@@ -1439,8 +1428,8 @@
         return wnd
 
     def on_rclick( self, evt ):
-        chp = self.master_dom.getAttribute('current')
-        mhp = self.master_dom.getAttribute('max')
+        chp = self.xml.get('current')
+        mhp = self.xml.get('max')
         txt = '((HP: %s / %s))' % ( chp, mhp )
         self.chat.ParsePost( txt, True, True )
 
@@ -1448,9 +1437,9 @@
         html_str = "<table width=100% border=1 >"
         html_str += "<tr BGCOLOR=#E9E9E9 ><th colspan=4>Hit Points</th></tr>"
         html_str += "<tr><th>Max:</th>"
-        html_str += "<td>"+self.master_dom.getAttribute('max')+"</td>"
+        html_str += "<td>"+self.xml.get('max')+"</td>"
         html_str += "<th>Current:</th>"
-        html_str += "<td>"+self.master_dom.getAttribute('current')+"</td>"
+        html_str += "<td>"+self.xml.get('current')+"</td>"
         html_str += "</tr></table>"
         return html_str
 
@@ -1460,15 +1449,15 @@
         self.hparent = handler #a 1.5002 allow ability to run up tree.  In this
         #a 1.5002 case, we need the functional parent, not the invoking parent.
 
-        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),
+           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')),
+          (wx.TextCtrl(self, HP_MAX, self.xml.get('max')),
            0, wx.EXPAND),
          ])
         self.sizer.AddGrowableCol(1)
@@ -1483,9 +1472,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()
@@ -1525,9 +1514,9 @@
         self.temp_dom={}
         #a 1.5012 end a1b
 
-        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() # this causes self.weapons to be loaded.
 
@@ -1545,7 +1534,7 @@
             fnFrame.panel.SetPage(self.html_str)
             fnFrame.Show()
 
-        #weaponsH = self.master_dom.getElementsByTagName('attacks')
+        #weaponsH = self.xml.findall('attacks')
         #mark7
 
     #a 1.9001 this whole method
@@ -1565,9 +1554,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')
             fn = safeGetAttr(n,'fn') #a 1.5012 can be removed when
             #a 1.5012 confident all characters in the world have footnotes.
             #if self.updateFootNotes:
@@ -1581,33 +1570,28 @@
 
     def updateFootN(self,n):#a 1.5012 this whole function
         if not self.temp_dom:
-            tmp = open(dir_struct["dnd35"]+"dnd35weapons.xml","r")
-            #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012
-            self.temp_dom = xml.dom.minidom.parse(tmp)
-
-            #self.temp_dom = parseXml_with_dlg(self,tmp.read())
-            self.temp_dom = self.temp_dom._get_firstChild()
-            tmp.close()
-        nameF = n.getAttribute('name')
-        w_list = self.temp_dom.getElementsByTagName('weapon')
+            tree = parse(dir_struct["dnd35"]+"dnd35weapons.xml")
+            self.temp_dom = tree.getroot()
+        nameF = n.get('name')
+        w_list = self.temp_dom.findall('weapon')
         found = False
         for w in w_list:
-            if nameF == w.getAttribute('name'):
+            if nameF == w.get('name'):
                 found = True
                 fnN = safeGetAttr(n,'fn')
                 if fnN == None or fnN == 'None':
-                    fnW = w.getAttribute('fn')
+                    fnW = w.get('fn')
                     #print "weapon",nameF,"footnotes are updated to",fnW
                     self.html_str += ("<tr ALIGN='center'><td>"+nameF+"</td>"+
                                      "<td>"+fnW+"</td></tr>\n")
-                    n.setAttribute('fn',fnW)
+                    n.set('fn',fnW)
                 break
         if not found:
             self.html_str += ("<tr ALIGN='center'><td>"+nameF+" - Custom "+
               "Weapon, research "+
               "and update manually; setting footnote to indicate custom</td>"+
                                      "<td>"+'X'+"</td></tr>\n")
-            n.setAttribute('fn','X')
+            n.set('fn','X')
 
 
     def get_mod(self,type='m'):
@@ -1625,13 +1609,13 @@
         stat_mod = -7
         stat_mod = self.root.abilities.get_mod(stat)    #a 1.5002
         #print "Big test - stat_mod",stat_mod           #a (debug) 1.6000
-        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):
@@ -1645,10 +1629,10 @@
             #self.frame.add_panel(self.get_design_panel(self.frame.note))
         else:
             #print "entering attack phase"
-            mod = int(self.weapons[name].getAttribute('mod'))
+            mod = int(self.weapons[name].get('mod'))
             wepMod = mod #a 1.5008
             footNotes = safeGetAttr(self.weapons[name],'fn','')
-            cat = self.weapons[name].getAttribute('category') #a1.6001
+            cat = self.weapons[name].get('category') #a1.6001
             result = split(cat,"-",2) #a 1.6001
             if len(result) < 2: #a 1.6021 this if & else
                 print "warning: 1.6002 unable to interpret weapon category"
@@ -1660,7 +1644,7 @@
                 tres=result[1]
             #print "print FootNotes,tres",footNotes,tres
             if tres == 'Melee': #a 1.6001   #m 1.6022 use of tres here and...
-            #if self.weapons[name].getAttribute('range') == '0':#d 1.6001
+            #if self.weapons[name].get('range') == '0':#d 1.6001
                 rangeOrMelee = 'm' #a 1.5008 code demote for next comment block
             elif tres == 'Ranged': #m 1.6001 (was just else) #m 1.6022 here
                 rangeOrMelee = 'r' #a 1.5008
@@ -1671,7 +1655,7 @@
                 rangeOrMelee ='m'
             mod = mod + self.get_mod(rangeOrMelee) #a 1.5008
             chat = self.chat
-            dmg = self.weapons[name].getAttribute('damage')
+            dmg = self.weapons[name].get('damage')
 
             #a 1.6003 start code fix instance a
             result = split(dmg,"/",2)
@@ -1858,28 +1842,28 @@
         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>"
-            html_str += n.getAttribute('name')+"</td><td>"+total+"</td>"
-            html_str += "<td>"+n.getAttribute('damage')+"</td><td>"
-            html_str += n.getAttribute('critical')+"</td></tr>"
+            html_str += n.get('name')+"</td><td>"+total+"</td>"
+            html_str += "<td>"+n.get('damage')+"</td><td>"
+            html_str += 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>"
-            html_str += n.getAttribute('weight')+"</td>"
-            html_str += "<td>"+n.getAttribute('type')+"</td><td>"
-            html_str += n.getAttribute('size')+"</td>"
+            html_str += n.get('weight')+"</td>"
+            html_str += "<td>"+n.get('type')+"</td><td>"
+            html_str += n.get('size')+"</td>"
             html_str += '<td>%s%s</td></tr>'  % (mod1, mod)
             #a 1.5012 add next two lines to pretty print footnotes.
             html_str += """<tr><th BGCOLOR=#E9E9E9 colspan=2>Footnotes:</th>"""
@@ -1890,7 +1874,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')
         self.hparent = handler #a 1.5002 allow ability to run up tree.
         #a 1.5002 we need the functional parent, not the invoking parent.
 
@@ -1932,19 +1916,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")
@@ -1983,7 +1967,7 @@
         self.hparent = handler                          #a 1.5012
         self.root = getRoot(self)
 
-        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)
@@ -2008,9 +1992,9 @@
         self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
         self.grid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.on_gridRclick)#a 1.5012
 
-        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
         #trash=input("weapon panel init colnames")
         self.colAttr = ['name','damage','mod','critical','type','weight',
@@ -2038,7 +2022,7 @@
         #print "wp, on rclick,grid row,col,value",row,col,value
         if col == 9 and value != 'None':
             n = self.n_list[row]
-            name = n.getAttribute('name')
+            name = n.get('name')
             #print "we want a panel!"
             handler = self.hparent
             #print "handler:",handler
@@ -2050,18 +2034,13 @@
             fnFrame = wx.Frame(masterFrame, -1, title)
             fnFrame.panel = wx.html.HtmlWindow(fnFrame,-1)
             if not self.temp_dom:
-                tmp = open(dir_struct["dnd35"]+
-                            "dnd35weapons.xml","r")
-                #tmp = open("c:\clh\codeSamples\sample1.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('f') # the footnotes
+                tree = parse(dir_struct["dnd35"]+ "dnd35weapons.xml")
+                self.temp_dom = tree.getroot()
+            f_list = self.temp_dom.findall('f') # the footnotes
             #print "weapon_panel - on_rclick f_list",f_list#a 1.6
             n = self.n_list[row]
-            name = n.getAttribute('name')
-            footnotes = n.getAttribute('fn')
+            name = n.get('name')
+            footnotes = n.get('fn')
             html_str = "<html><body>"
             html_str += """<table border='1' width=100% ><tr BGCOLOR=#E9E9E9 >
                         <th width='10%'>Note</th><th>Description</th></tr>\n"""
@@ -2073,9 +2052,9 @@
                 aNote=footnotes[i]
                 found=False
                 for f in f_list:
-                    if f.getAttribute('mark') == aNote:
+                    if f.get('mark') == aNote:
                         found=True
-                        text=f.getAttribute('txt')
+                        text=f.get('txt')
                         html_str += ("<tr ALIGN='center'><td>"+aNote+"</td>"+
                                      "<td>"+text+"</td></tr>\n")
                 if not found:
@@ -2099,29 +2078,29 @@
         value = self.grid.GetCellValue(row,col)
         if col == 2 and not int(value): # special case for mod, demoted
             value = "0" #a 5.012 demoted
-            self.n_list[row].setAttribute('mod',value) # a 5.012 demoted
+            self.n_list[row].set('mod',value) # a 5.012 demoted
         if not (col == 9 and value == "None" and
-                self.n_list[row].getAttribute('fn') == "None"
+                self.n_list[row].get('fn') == "None"
                 ): #a 5.012 special case for footnotes
-            self.n_list[row].setAttribute(self.colAttr[col],value)#a 5.012
+            self.n_list[row].set(self.colAttr[col],value)#a 5.012
 
 
     def refresh_row(self,i):
         n = self.n_list[i]
-        fn = n.getAttribute('fn')
+        fn = n.get('fn')
         #print "fn=",fn
-        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.SetCellValue(i,9,safeGetAttr(n,'fn','None')) #a 1.5012
         self.grid.SetCellValue(i,10,safeGetAttr(n,'comment','')) #a 1.5012
@@ -2137,31 +2116,27 @@
         for i in range(rows-1,-1,-1):   #a 1.6011 or you lose context
             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["dnd35"]+"dnd35weapons.xml","r")
-            #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012
-            xml_dom = parseXml_with_dlg(self,tmp.read())
-            xml_dom = xml_dom._get_firstChild()
-            tmp.close(); print
-            self.temp_dom = xml_dom
-        f_list = self.temp_dom.getElementsByTagName('weapon')
+            tree = parse(dir_struct["dnd35"]+"dnd35weapons.xml")
+            self.temp_dom = tree.getroot()
+        f_list = self.temp_dom.findall('weapon')
         opts = []
         #print "weapon_panel - on_add f_list",f_list#a 1.6
         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()
             #print f_list[i] # DOM Element: weapon.
-            new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
+            new_node = self.xml.append(f_list[i])
             #print self.grid.AppendRows # a bound method of wxGrid
             self.grid.AppendRows(1)
-            self.n_list = self.master_dom.getElementsByTagName('weapon')
+            self.n_list = self.xml.findall('weapon')
             #print "self.n_list",self.n_list # list of DOM weapons
             self.refresh_row(self.grid.GetNumberRows()-1)
             self.handler.refresh_weapons()
@@ -2187,7 +2162,7 @@
 
 class attack_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Melee')
+        pname = handler.xml.set("name", 'Melee')
         self.parent = parent #a 1.9001
 
         wx.Panel.__init__(self, parent, -1)
@@ -2243,19 +2218,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):
@@ -2280,29 +2255,29 @@
         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' >"
-            html_str += "<td  colspan=3>"+n.getAttribute('name')+"</td>"
-            html_str += "<td>"+n.getAttribute('type')+"</td>"
-            html_str += "<td>"+n.getAttribute('bonus')+"</td></tr>"
+            html_str += "<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 >"""
             html_str += "<th>Check Penalty</th><th>Spell Failure</th>"
             html_str += "<th>Max Dex</th><th>Speed</th><th>Weight</th></tr>"
             html_str += "<tr ALIGN='center'>"
-            html_str += "<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 += "<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
 
 
 class ac_panel(wx.Panel):
     def __init__(self, parent, handler):
-        pname = handler.master_dom.setAttribute("name", 'Armor')
+        pname = handler.xml.set("name", 'Armor')
         self.hparent = handler #a 1.5002 allow ability to run up tree.
         #a 1.5002 we need the functional parent, not the invoking parent.
 
@@ -2327,8 +2302,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.getchildren()
         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)
@@ -2349,40 +2324,37 @@
         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["dnd35"]+"dnd35armor.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["dnd35"]+"dnd35armor.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()