diff --git a/gir/GLib-assertions.txt b/gir/GLib-assertions.txt
index 0d26271..21dc95f 100644
--- a/gir/GLib-assertions.txt
+++ b/gir/GLib-assertions.txt
@@ -1,3 +1,3 @@
-/namespace/alias[@name='Quark']
-/namespace/record[@name='PtrArray']
-/namespace/callback[@name='ThreadFunc']/return-value/type[@name='any']
+namespace/alias[@name='Quark']
+namespace/record[@name='PtrArray']
+namespace/callback[@name='ThreadFunc']/return-value/type[@name='any']
diff --git a/giscanner/Makefile.am b/giscanner/Makefile.am
index e824b34..be97930 100644
--- a/giscanner/Makefile.am
+++ b/giscanner/Makefile.am
@@ -42,7 +42,7 @@ pkgpyexec_PYTHON = 		\
 	girwriter.py		\
 	glibast.py		\
 	glibtransformer.py 	\
-	minixpath.py		\
+	ElementPath.py		\
 	odict.py		\
 	sourcescanner.py	\
 	transformer.py		\
diff --git a/giscanner/minixpath.py b/giscanner/minixpath.py
deleted file mode 100644
index b142e8b..0000000
--- a/giscanner/minixpath.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# -*- Mode: Python -*-
-# GObject-Introspection - a framework for introspecting GObject libraries
-# Copyright (C) 2008 Colin Walters
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-
-from .girparser import C_NS, GLIB_NS
-from .girparser import _corens
-
-_nsmap = {'c': C_NS,
-          'glib': GLIB_NS}
-
-
-def myxpath(node, expr):
-    """I Can't Believe It's Not XPath!"""
-    elts = expr.split('/')
-    curnode = node
-    for elt in elts:
-        if elt == '':
-            continue
-        try:
-            (elt, qual) = elt.split('[', 1)
-            qual = qual[1:-1]
-            pairs = [x.split('=', 1) for x in qual.split(',')]
-            exp_attrs = [(x[0], x[1][1:-1]) for x in pairs]
-        except ValueError, e:
-            (elt, exp_attrs) = (elt, [])
-        try:
-            (ns, elt) = elt.split(':', 1)
-            ns = _nsmap[ns]
-            elt = '{%s}%s' % (ns, elt)
-        except ValueError, e:
-            elt = _corens(elt)
-        curnodes = curnode.findall(elt)
-        if not curnodes:
-            return None
-        found = True
-        #print "LOOKING %d nodes" % (len(curnodes), )
-        for node in curnodes:
-            #print "LOOKING: %r expecting: %r attrib: %r" \
-            #    % (node, exp_attrs, node.attrib)
-            passes = True
-            for name, val in exp_attrs:
-                a = node.attrib.get(name)
-                if not a or a != val:
-                    #print "ATTR FAIL: %r=%r" % (val, a)
-                    passes = False
-                    break
-            if passes:
-                found = True
-                #print 'ATTR PASS: %r' % (node, )
-                curnode = node
-                break
-            found = False
-        if not found:
-            return None
-    return curnode
-
-
-def xpath_assert(node, path, attribs=[]):
-    elt = myxpath(node, path)
-    if elt is None:
-        raise AssertionError("Failed to find %r" % (path, ))
-    for (name, expvalue) in attribs:
-        value = elt.attrib.get(name)
-        if not value:
-            raise AssertionError("Failed to find attibute %r" +
-                                 "in node %r" % (name, elt, ))
-        if value != expvalue:
-            raise AssertionError("Attibute %r in node %r has " +
-                                 "unexpected value %r" % (name, elt, expvalue))
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d806b2..532a355 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,6 +31,6 @@ GIRTESTS = 			\
 
 check-local: $(GIRTESTS)
 	@echo Running PEP8 on Python sources
-	@find $(top_srcdir)/giscanner -name \*.py | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pep8.py --repeat
+	@find $(top_srcdir)/giscanner -name \*.py | grep -v ElementPath | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pep8.py --repeat
 	@echo Running Pyflakes on Python sources
-	@find $(top_srcdir)/giscanner -name \*.py | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pyflakes.py
+	@find $(top_srcdir)/giscanner -name \*.py | grep -v ElementPath | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pyflakes.py
diff --git a/tools/g-ir-scanner b/tools/g-ir-scanner
index 667a9ac..fb74860 100755
--- a/tools/g-ir-scanner
+++ b/tools/g-ir-scanner
@@ -38,8 +38,7 @@ sys.path.insert(0, path)
 from giscanner.glibtransformer import GLibTransformer
 from giscanner.sourcescanner import SourceScanner
 from giscanner.transformer import Transformer
-from giscanner.minixpath import myxpath, xpath_assert
-
+import giscanner.ElementPath as ElementPath
 
 def _get_option_parser():
     parser = optparse.OptionParser('%prog [options] sources')
@@ -123,7 +122,7 @@ def inject(path, additions, outpath):
     injectDoc = parse(open(additions))
     for node in injectDoc.getroot():
         injectPath = node.attrib['path']
-        target = myxpath(root, injectPath)
+        target = ElementPath.find(root, injectPath)
         if not target:
             raise ValueError("Couldn't find path %r" % (injectPath, ))
         for child in node:
@@ -133,6 +132,19 @@ def inject(path, additions, outpath):
     outf.close()
     return 0
 
+def xpath_assert(node, path, attribs=[]):
+    elt = ElementPath.find(node, path)
+    if elt is None:
+        raise AssertionError("Failed to find %r" % (path, ))
+    for (name, expvalue) in attribs:
+        value = elt.attrib.get(name)
+        if not value:
+            raise AssertionError("Failed to find attibute %r" +
+                                 "in node %r" % (name, elt, ))
+        if value != expvalue:
+            raise AssertionError("Attibute %r in node %r has " +
+                                 "unexpected value %r" % (name, elt, expvalue))
+
 def validate(assertions, path):
     from xml.etree.cElementTree import parse
     doc = parse(open(path))
