diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-05-16 09:25:44 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-05-16 09:26:09 +0200 |
commit | 161e19193654676f6df72ac544d87a257de18f2a (patch) | |
tree | 028c1c2105ed83a1be6ce4f7791a3640d0e1fb78 /scripts/Util.py | |
parent | Add final newline to js/.eslintignore (diff) | |
download | ice-161e19193654676f6df72ac544d87a257de18f2a.tar.bz2 ice-161e19193654676f6df72ac544d87a257de18f2a.tar.xz ice-161e19193654676f6df72ac544d87a257de18f2a.zip |
Added support for stripping out invalid XML characters from the JUnit XML file generated by allTests.py
Diffstat (limited to 'scripts/Util.py')
-rw-r--r-- | scripts/Util.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/Util.py b/scripts/Util.py index 11f768c3104..e8e4caf6744 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -52,12 +52,15 @@ def val(v, escapeQuotes=False, quoteValue=True): else: return str(v) +illegalXMLChars = re.compile(u'[\x00-\x08\x0b\x0c\x0e-\x1F\uD800-\uDFFF\uFFFE\uFFFF]') + def escapeXml(s, attribute=False): # Remove backspace characters from the output (they aren't accepted by Jenkins XML parser) if isPython2: s = "".join(ch for ch in unicode(s.decode("utf-8")) if ch != u"\u0008").encode("utf-8") else: s = "".join(ch for ch in s if ch != u"\u0008") + s = illegalXMLChars.sub("?", s) # Strip invalid XML characters return xml.sax.saxutils.quoteattr(s) if attribute else xml.sax.saxutils.escape(s) def getIceSoVersion(): |