|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
import sys
|
|
|
|
|
import time
|
|
|
|
|
import re
|
|
|
|
|
from ..cl_xml import xpath
|
|
|
|
|
from ..cl_xml import xpath, xml_to_str, str_to_xml_doc
|
|
|
|
|
# import xml.dom.minidom
|
|
|
|
|
from lxml import etree
|
|
|
|
|
from .xml_xfce import xml_xfce
|
|
|
|
@ -73,8 +73,7 @@ class xml_gconf(xml_xfce):
|
|
|
|
|
if not self.text.strip():
|
|
|
|
|
self.text = '''<?xml version="1.0"?><gconf></gconf>'''
|
|
|
|
|
try:
|
|
|
|
|
# self.doc = xml.dom.minidom.parseString(self.text)
|
|
|
|
|
self.doc = etree.XML(bytes(bytearray(self.text, encoding='utf-8')))
|
|
|
|
|
self.doc = str_to_xml_doc(self.text)
|
|
|
|
|
except Exception:
|
|
|
|
|
self.setError(_("The template content is not XML"))
|
|
|
|
|
return False
|
|
|
|
@ -160,7 +159,7 @@ class xml_gconf(xml_xfce):
|
|
|
|
|
'action="drop")')
|
|
|
|
|
self.setError(textError)
|
|
|
|
|
return False
|
|
|
|
|
if xmlOldNode.getparent():
|
|
|
|
|
if xmlNewNode.getparent():
|
|
|
|
|
findAttrStr = ""
|
|
|
|
|
if attrName:
|
|
|
|
|
findAttrStr = "[%s]" % attrName
|
|
|
|
@ -282,7 +281,7 @@ class xml_gconf(xml_xfce):
|
|
|
|
|
else:
|
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
data = self.doc.toxml().split("\n")
|
|
|
|
|
data = xml_to_str(self.doc).split("\n")
|
|
|
|
|
data = [expandStartTabs(x) for x in data if x.strip()]
|
|
|
|
|
dataOut = []
|
|
|
|
|
z = 0
|
|
|
|
@ -298,4 +297,6 @@ class xml_gconf(xml_xfce):
|
|
|
|
|
z = 2
|
|
|
|
|
continue
|
|
|
|
|
dataOut.append(data[i])
|
|
|
|
|
#TODO test this
|
|
|
|
|
dataOut.insert(0, '<?xml version="1.0" encoding="UTF-8"?>\n')
|
|
|
|
|
return "\n".join(dataOut)
|
|
|
|
|