xml_tools: minor attribute renaming

This commit is contained in:
Goffi 2015-08-15 22:27:39 +02:00
commit 7cbcc26d7d

View file

@ -1105,10 +1105,10 @@ class ElementParser(object):
Found at http://stackoverflow.com/questions/2093400/how-to-create-twisted-words-xish-domish-element-entirely-from-raw-xml/2095942#2095942
(c) Karl Anderson"""
def __call__(self, string, force_spaces=False):
def __call__(self, raw_xml, force_spaces=False):
"""
@param string: the XML string
@param force_spaces: if True, replace occurrences of 'n' and '\t' with ' '.
@param raw_xml(unicode): the raw XML
@param force_spaces: if True, replace occurrences of '\n' and '\t' with ' '.
"""
self.result = None
@ -1127,7 +1127,7 @@ class ElementParser(object):
parser.DocumentEndEvent = onEnd
tmp = domish.Element((None, "s"))
if force_spaces:
string = string.replace('\n', ' ').replace('\t', ' ')
tmp.addRawXml(string)
raw_xml = raw_xml.replace('\n', ' ').replace('\t', ' ')
tmp.addRawXml(raw_xml)
parser.parse(tmp.toXml().encode('utf-8'))
return self.result.firstChildElement()