diff options
author | Christian Stenger <[email protected]> | 2015-01-26 15:26:30 +0100 |
---|---|---|
committer | Christian Stenger <[email protected]> | 2015-01-27 13:22:04 +0000 |
commit | 7193f932d13701945bb4782e1a711d5b69d5bc00 (patch) | |
tree | e4c3bdd4c7a3bdd346ce598bd6c0390cf21e7da3 | |
parent | 8e83b6cf0131128f894f1b683a21ee8aca15d82b (diff) |
Scripts: Fix gathering of xml tag content
If content was read partially the script stored only
the last read part instead of the whole content.
Change-Id: I331eacbd3a7321fabd32b8addec67ad01a722ed3
Reviewed-by: Tobias Hunger <[email protected]>
-rwxr-xr-x | scripts/uichanges.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/uichanges.py b/scripts/uichanges.py index 9f339e87e5b..7a345f07df5 100755 --- a/scripts/uichanges.py +++ b/scripts/uichanges.py @@ -86,11 +86,11 @@ class Generator(handler.ContentHandler): def endElement(self, name): if name == 'name': if self._context == '': - self._context = self._chars + self._context = self._chars.strip() self._chars = '' elif name == 'source': if self._chars: - self._msg = self._chars + self._msg = self._chars.strip() self._chars = '' elif name == 'message': if self._msg: @@ -106,7 +106,7 @@ class Generator(handler.ContentHandler): self._context = '' def characters(self, content): - self._chars = content + self._chars += content def tree(self): return self._tree @@ -185,15 +185,19 @@ def diffContext(ctx, old, new): # --- The main program -generator = Generator() -parser = make_parser() -parser.setContentHandler(generator) -parser.parse(sys.argv[1]) +oldGenerator = Generator() +oldParser = make_parser() +oldParser.setContentHandler(oldGenerator) +oldParser.parse(sys.argv[1]) -oldTree = generator.tree() +oldTree = oldGenerator.tree() -parser.parse(sys.argv[2]) -newTree = generator.tree() +newGenerator = Generator() +newParser = make_parser() +newParser.setContentHandler(newGenerator) +newParser.parse(sys.argv[2]) + +newTree = newGenerator.tree() oldContextSet = set(oldTree.keys()) newContextSet = set(newTree.keys()) |