tools/metrics/common/pretty_print_xml.py
def _PrettyPrintMinidom(self, doc):
    """Transforms minidom to ElementTree before pretty printing it."""
    raw_xml = doc.toxml()

    # minidom prepends a document type, so remove it.
    raw_xml = raw_xml.replace(minidom.Document().toxml(), '')

    etree_root = etree_util.ParseXMLString(raw_xml)
    top_content = etree_util.GetTopLevelContent(raw_xml)

    # Add newlines between top-level comments.
    top_content = top_content.replace('--><!--', '-->\n\n<!--')

    formatted_xml = self.PrettyPrintXml(etree_root)
    return top_content + formatted_xml
Transforms minidom to ElementTree before pretty printing it.
Transforms minidom to ElementTree before pretty printing it.
Transforms minidom to ElementTree before pretty printing it .
def _PrettyPrintMinidom(self, doc):
    raw_xml = doc.toxml()
    raw_xml = raw_xml.replace(minidom.Document().toxml(), '')
    etree_root = etree_util.ParseXMLString(raw_xml)
    top_content = etree_util.GetTopLevelContent(raw_xml)
    top_content = top_content.replace('--><!--', '-->\n\n<!--')
    formatted_xml = self.PrettyPrintXml(etree_root)
    return top_content + formatted_xml
def _PrettyPrintMinidom ( self , doc ) : raw_xml = doc . toxml ( ) raw_xml = raw_xml . replace ( minidom . Document ( ) . toxml ( ) , '' ) etree_root = etree_util . ParseXMLString ( raw_xml ) top_content = etree_util . GetTopLevelContent ( raw_xml ) top_content = top_content . replace ( '--><!--' , '-->\n\n<!--' ) formatted_xml = self . PrettyPrintXml ( etree_root ) return top_content + formatted_xml
Transforms minidom to ElementTree before pretty printing it.
Transforms minidom to ElementTree before pretty printing it .
"""Transforms minidom to ElementTree before pretty printing it.""" # minidom prepends a document type, so remove it. # Add newlines between top-level comments.
self
doc