Remove debug printing statement
[deliverable/lttng-ivc.git] / lttng_ivc / utils / utils.py
index 37e09e197226ec1b9c9abf9a5da5f17aaa60ae6a..755304137aed849242c7a6a2b8434850faaeb396 100644 (file)
@@ -84,6 +84,28 @@ def find_dir(root, name):
     return abs_path
 
 
+def find_file(root, name):
+    """
+    Returns the absolute path or None.
+    """
+    abs_path = None
+    for base, dirs, files in os.walk(root):
+        for tmp in files:
+            if tmp.endswith(name):
+                abs_path = os.path.abspath(os.path.join(base, tmp))
+    return abs_path
+
+
+def validate(xml_path, xsd_path):
+
+    xmlschema_doc = etree.parse(xsd_path)
+    xmlschema = etree.XMLSchema(xmlschema_doc)
+
+    xml_doc = etree.parse(xml_path)
+    result = xmlschema.validate(xml_doc)
+
+    return result
+
 def xpath_query(xml_file, xpath):
     """
     Return a list of xml node corresponding to the xpath. The list can be of lenght
This page took 0.023769 seconds and 5 git commands to generate.