Commit 01e6c0a0 authored by Nikunj Bhagat's avatar Nikunj Bhagat Committed by Commit Bot

Ignore comments in histograms.xml leaf tags.

Change-Id: I4cd59c9a8e245ea3af4fcdb0bdd602f066c6fef0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610310Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Nik Bhagat <nikunjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662997}
parent b1b63a6d
...@@ -79,7 +79,8 @@ class Error(Exception): ...@@ -79,7 +79,8 @@ class Error(Exception):
def _JoinChildNodes(tag): def _JoinChildNodes(tag):
"""Join child nodes into a single text. """Join child nodes into a single text.
Applicable to leafs like 'summary' and 'detail'. Applicable to leafs like 'summary' and 'detail'. Removes any comment in the
node.
Args: Args:
tag: parent node tag: parent node
...@@ -87,7 +88,9 @@ def _JoinChildNodes(tag): ...@@ -87,7 +88,9 @@ def _JoinChildNodes(tag):
Returns: Returns:
a string with concatenated nodes' text representation. a string with concatenated nodes' text representation.
""" """
return ''.join(c.toxml() for c in tag.childNodes).strip() return ''.join(c.toxml()
for c in tag.childNodes
if c.nodeType != xml.dom.minidom.Node.COMMENT_NODE).strip()
def _NormalizeString(s): def _NormalizeString(s):
......
...@@ -46,7 +46,11 @@ class ExtractHistogramsTest(unittest.TestCase): ...@@ -46,7 +46,11 @@ class ExtractHistogramsTest(unittest.TestCase):
<histogram name="Test.Histogram" units="things"> <histogram name="Test.Histogram" units="things">
<owner> Please list the metric's owners. Add more owner tags as needed. <owner> Please list the metric's owners. Add more owner tags as needed.
</owner> </owner>
<summary> This is a summary </summary> <summary>
<!-- Comments are fine -->
This is a summary
<!-- Comments are fine -->
</summary>
</histogram> </histogram>
</histograms> </histograms>
</histogram-configuration> </histogram-configuration>
......
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