Index: gclient_utils.py |
diff --git a/gclient_utils.py b/gclient_utils.py |
index 6154974823e4d91808ae8a14750a78bef48d9b54..97c8227c097370f2e933f759a5a268e752d72020 100644 |
--- a/gclient_utils.py |
+++ b/gclient_utils.py |
@@ -14,6 +14,8 @@ import subprocess |
import sys |
import threading |
import time |
+import xml.dom.minidom |
+import xml.parsers.expat |
def hack_subprocess(): |
@@ -112,6 +114,29 @@ def SplitUrlRevision(url): |
return tuple(components) |
+def ParseXML(output): |
+ try: |
+ return xml.dom.minidom.parseString(output) |
+ except xml.parsers.expat.ExpatError: |
+ return None |
+ |
+ |
+def GetNamedNodeText(node, node_name): |
+ child_nodes = node.getElementsByTagName(node_name) |
+ if not child_nodes: |
+ return None |
+ assert len(child_nodes) == 1 and child_nodes[0].childNodes.length == 1 |
+ return child_nodes[0].firstChild.nodeValue |
+ |
+ |
+def GetNodeNamedAttributeText(node, node_name, attribute_name): |
+ child_nodes = node.getElementsByTagName(node_name) |
+ if not child_nodes: |
+ return None |
+ assert len(child_nodes) == 1 |
+ return child_nodes[0].getAttribute(attribute_name) |
+ |
+ |
def SyntaxErrorToError(filename, e): |
"""Raises a gclient_utils.Error exception with the human readable message""" |
try: |