summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ast-to-instr/src/XMLManager.java')
-rw-r--r--ast-to-instr/src/XMLManager.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/ast-to-instr/src/XMLManager.java b/ast-to-instr/src/XMLManager.java
index 03fbe6d..dc3eef1 100644
--- a/ast-to-instr/src/XMLManager.java
+++ b/ast-to-instr/src/XMLManager.java
@@ -82,6 +82,23 @@ public class XMLManager
return XPATH.compile(expression);
}
+ public static XPathExpression compile_or_die (final String expression)
+ {
+ try
+ {
+ return XPATH.compile(expression);
+ }
+ catch (final XPathExpressionException xpee)
+ {
+ System.err.println("[P] Invalid XPathExpression (report as bug):");
+ xpee.printStackTrace();
+
+ System.exit(-1);
+ }
+
+ return null; /* Because Java. */
+ }
+
public static Collection<Node> node_list_to_node_collection
(
final NodeList nl
@@ -101,4 +118,9 @@ public class XMLManager
return result;
}
+
+ public static String get_attribute (final Node n, final String attr)
+ {
+ return n.getAttributes().getNamedItem(attr).getNodeValue();
+ }
}