Commit bf028670 authored by Nicolas Delaby's avatar Nicolas Delaby

Use 4Suite Library instead minidom if avalaible

parent b689249b
......@@ -20,7 +20,11 @@
#
##############################################################################
from xml.dom.minidom import parse, parseString, getDOMImplementation
from xml.dom.minidom import parseString, getDOMImplementation
try:
from Ft.Xml import Parse as parse
except:
from xml.dom.minidom import parse
import sys
import getopt
import os
......@@ -180,8 +184,7 @@ class ERP5Diff:
child_element = createElement('xupdate:element')
child_element.setAttribute('name', element.tagName)
attr_map = element.attributes
for i in range(attr_map.length):
attr = attr_map.item(i)
for attr in attr_map.values():
attr_element = createElement('xupdate:attribute')
attr_element.setAttribute('name', attr.name)
text_node = createTextNode(attr.nodeValue)
......@@ -206,8 +209,7 @@ class ERP5Diff:
child_element = createElement('xupdate:element')
child_element.setAttribute('name', element.tagName)
attr_map = element.attributes
for i in range(attr_map.length):
attr = attr_map.item(i)
for attr in attr_map.values():
attr_element = createElement('xupdate:attribute')
attr_element.setAttribute('name', attr.name)
text_node = createTextNode(attr.nodeValue)
......@@ -232,8 +234,7 @@ class ERP5Diff:
id_list = []
for attr_map in (element1.attributes, element2.attributes):
for i in range(attr_map.length):
attr = attr_map.item(i)
for attr in attr_map.values():
if attr.name == 'id':
id_list.append(attr.nodeValue)
break
......@@ -252,8 +253,7 @@ class ERP5Diff:
dict_list = []
for attr_map in (element1.attributes, element2.attributes):
dict = {}
for i in range(attr_map.length):
attr = attr_map.item(i)
for attr in attr_map.values():
dict[attr.name] = attr.nodeValue
dict_list.append(dict)
dict1, dict2 = dict_list
......@@ -314,8 +314,7 @@ class ERP5Diff:
# Check if this element has an attribute 'id'.
id_val = None
attr_map = element.attributes
for i in range(attr_map.length):
attr = attr_map.item(i)
for attr in attr_map.values():
if attr.name == 'id':
id_val = attr.nodeValue
break
......@@ -444,8 +443,8 @@ class ERP5Diff:
self._testAttributes(old_root_element, new_root_element, '/')
self._xupdateUpdateElement(new_root_element, '/')
finally:
old_doc.unlink()
new_doc.unlink()
del old_doc
del new_doc
def output(self, file=None):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment