diff --git a/common.mk b/common.mk
index 7458e5f..3eeb193 100644
--- a/common.mk
+++ b/common.mk
@@ -7,4 +7,5 @@ SCANNER_ARGS = -v --add-include-path=$(top_builddir)/gir --add-include-path=.
 SCANNER = $(SCANNER_ENV) $(SCANNER_BIN) $(SCANNER_ARGS)
 SCANNER_LIBS = \
 	$(top_srcdir)/giscanner/*.py \
-	$(top_builddir)/giscanner/libgiscanner.la
+	$(top_builddir)/giscanner/libgiscanner.la \
+	$(top_builddir)/girepository/libgirepository.la
diff --git a/girepository/gdump.c b/girepository/gdump.c
index b26b0e8..a58e620 100644
--- a/girepository/gdump.c
+++ b/girepository/gdump.c
@@ -186,7 +186,12 @@ dump_interface_type (GType type, const char *symbol, GOutputStream *out)
   for (i = 0; i < n_interfaces; i++)
     {
       GType itype = interfaces[i];
-      escaped_printf (out, "    <extends>%s</extends>\n",
+      if (itype == G_TYPE_OBJECT)
+	{
+	  /* This is implicit */
+	  continue;
+	}
+      escaped_printf (out, "    <prerequisite name=\"%s\"/>\n",
 		      g_type_name (itype));
     }
   dump_properties (type, out);
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 65ba282..cf7a26b 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -54,7 +54,7 @@ typedef enum
   STATE_INTERFACE_PROPERTY,   /* 15 */
   STATE_INTERFACE_FIELD,
   STATE_IMPLEMENTS, 
-  STATE_REQUIRES,
+  STATE_PREREQUISITE,
   STATE_BOXED,  
   STATE_BOXED_FIELD, /* 20 */
   STATE_STRUCT,   
@@ -2330,25 +2330,6 @@ start_element_handler (GMarkupParseContext *context,
 			    attribute_names, attribute_values,
 			    ctx, error))
 	goto out;
-      else if (strcmp (element_name, "class") == 0 &&
-	       ctx->state == STATE_REQUIRES)
-	{
-	  const gchar *name;
-
-	  name = find_attribute ("name", attribute_names, attribute_values);
-
-	  if (name == NULL)
-	    MISSING_ATTRIBUTE (context, error, element_name, "name");
-	  else
-	    {  
-	      GIrNodeInterface *iface;
-
-	      iface = (GIrNodeInterface *)ctx->current_node;
-	      iface ->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
-	    }
-
-	  goto out;
-	}
       break;
 
     case 'd':
@@ -2514,7 +2495,26 @@ start_element_handler (GMarkupParseContext *context,
 				attribute_names, attribute_values,
 				ctx, error))
 	goto out;
+      else if (strcmp (element_name, "prerequisite") == 0 &&
+	       ctx->state == STATE_INTERFACE)
+	{
+	  const gchar *name;
 
+	  name = find_attribute ("name", attribute_names, attribute_values);
+
+	  state_switch (ctx, STATE_PREREQUISITE);
+
+	  if (name == NULL)
+	    MISSING_ATTRIBUTE (context, error, element_name, "name");
+	  else
+	    {  
+	      GIrNodeInterface *iface;
+
+	      iface = (GIrNodeInterface *)ctx->current_node;
+	      iface->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
+	    }
+	  goto out;
+	}
       break;
 
     case 'r':
@@ -2541,13 +2541,6 @@ start_element_handler (GMarkupParseContext *context,
 				   attribute_names, attribute_values,
 				   ctx, error))
 	goto out;      
-      else if (strcmp (element_name, "requires") == 0 &&
-	       ctx->state == STATE_INTERFACE)
-	{
-	  state_switch (ctx, STATE_REQUIRES);
-	  
-	  goto out;
-	}
       else if (start_struct (context, element_name,
 			     attribute_names, attribute_values,
 			     ctx, error))
@@ -2885,8 +2878,8 @@ end_element_handler (GMarkupParseContext *context,
       if (require_end_element (context, ctx, "implements", element_name, error))
         state_switch (ctx, STATE_CLASS);
       break;
-    case STATE_REQUIRES:
-      if (require_end_element (context, ctx, "requires", element_name, error))
+    case STATE_PREREQUISITE:
+      if (require_end_element (context, ctx, "prerequisite", element_name, error))
         state_switch (ctx, STATE_INTERFACE);
       break;
     case STATE_NAMESPACE_CONSTANT:
diff --git a/giscanner/ast.py b/giscanner/ast.py
index b4e8e9e..41587bc 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -385,6 +385,7 @@ class Interface(Node):
         self.methods = []
         self.properties = []
         self.fields = []
+        self.prerequisites = []
 
     def __repr__(self):
         return '%s(%r, %r)' % (
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 02c78b9..cb391e7 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -151,6 +151,8 @@ class GIRParser(object):
         ctor_args.append(node.attrib.get(_cns('type')))
         for iface in node.findall(_corens('implements')):
             obj.interfaces.append(iface.attrib['name'])
+        for iface in node.findall(_corens('prerequisites')):
+            obj.prerequisities.append(iface.attrib['name'])
         for method in node.findall(_corens('method')):
             obj.methods.append(self._parse_function_common(method, Function))
         for ctor in node.findall(_corens('constructor')):
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 030ea82..a5c50d9 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -254,6 +254,9 @@ class GIRWriter(XMLWriter):
             if isinstance(node, GLibObject):
                 for iface in node.interfaces:
                     self.write_tag('implements', [('name', iface)])
+            if isinstance(node, Interface):
+                for iface in node.prerequisites:
+                    self.write_tag('prerequisite', [('name', iface)])
             if isinstance(node, Class):
                 for method in node.constructors:
                     self._write_constructor(method)
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index 5f079ba..2edab36 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -575,6 +575,10 @@ class GLibTransformer(object):
             type_name, xmlnode.attrib['get-type'])
         self._introspect_properties(node, xmlnode)
         self._introspect_signals(node, xmlnode)
+        for child in xmlnode.findall('prerequisite'):
+            name = child.attrib['name']
+            prereq = self._resolve_gtypename(name)
+            node.prerequisites.append(prereq)
         # GtkFileChooserEmbed is an example of a private interface, we
         # just filter them out
         if xmlnode.attrib['get-type'].startswith('_'):
@@ -728,6 +732,9 @@ class GLibTransformer(object):
         self._resolve_methods(node.methods)
         self._resolve_properties(node.properties, node)
         self._resolve_signals(node.signals)
+        node.prerequisites = filter(None,
+            [self._force_resolve(x, allow_unknown=True)
+             for x in node.prerequisites])
 
     def _resolve_glib_object(self, node):
         node.parent = self._force_resolve(node.parent)
diff --git a/tests/scanner/foo-1.0-expected.gir b/tests/scanner/foo-1.0-expected.gir
index 312db61..19ffc23 100644
--- a/tests/scanner/foo-1.0-expected.gir
+++ b/tests/scanner/foo-1.0-expected.gir
@@ -40,6 +40,42 @@
         </parameters>
       </callback>
     </record>
+    <interface name="SubInterface"
+               c:type="FooSubInterface"
+               glib:type-name="FooSubInterface"
+               glib:get-type="foo_sub_interface_get_type">
+      <prerequisite name="Interface"/>
+      <method name="do_bar" c:identifier="foo_sub_interface_do_bar">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <callback name="do_bar" c:type="do_bar">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="self" transfer-ownership="none">
+            <type name="SubInterface" c:type="FooSubInterface*"/>
+          </parameter>
+        </parameters>
+      </callback>
+    </interface>
+    <record name="SubInterfaceIface" c:type="FooSubInterfaceIface">
+      <field name="parent_iface">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <callback name="do_bar" c:type="do_bar">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="self" transfer-ownership="none">
+            <type name="SubInterface" c:type="FooSubInterface*"/>
+          </parameter>
+        </parameters>
+      </callback>
+    </record>
     <class name="Object"
            c:type="FooObject"
            parent="GObject.Object"
diff --git a/tests/scanner/foo-1.0-expected.tgir b/tests/scanner/foo-1.0-expected.tgir
index 51430fe..b92f7ae 100644
--- a/tests/scanner/foo-1.0-expected.tgir
+++ b/tests/scanner/foo-1.0-expected.tgir
@@ -13,6 +13,19 @@
         <type name="GObject.TypeInterface"/>
       </field>
     </record>
+    <interface name="SubInterface" glib:type-name="FooSubInterface" glib:get-type="foo_sub_interface_get_type">
+      <prerequisite name="Interface"/>
+      <method name="do_bar" c:identifier="foo_sub_interface_do_bar">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </method>
+    </interface>
+    <record name="SubInterfaceIface">
+      <field name="parent_iface">
+        <type name="GObject.TypeInterface"/>
+      </field>
+    </record>
     <class name="Object" parent="GObject.Object" glib:type-name="FooObject" glib:get-type="foo_object_get_type">
       <implements name="Interface"/>
       <field name="parent_instance">
diff --git a/tests/scanner/foo.c b/tests/scanner/foo.c
index ee1f4f1..50b78c2 100644
--- a/tests/scanner/foo.c
+++ b/tests/scanner/foo.c
@@ -75,6 +75,30 @@ foo_foo_interface_init (gpointer         g_iface,
   iface->do_foo = foo_do_foo;
 }
 
+GType
+foo_sub_interface_get_type (void)
+{
+  static GType object_type = 0;
+
+  if (!object_type)
+    {
+      object_type = g_type_register_static_simple (G_TYPE_INTERFACE,
+                                                   "FooSubInterface",
+                                                   sizeof (FooSubInterfaceIface),
+                                                   NULL, 0, NULL, 0);
+
+      g_type_interface_add_prerequisite (object_type, FOO_TYPE_INTERFACE);
+    }
+
+  return object_type;
+}
+
+void foo_sub_interface_do_bar (FooSubInterface *self)
+{
+  FOO_SUBINTERFACE_GET_INTERFACE(self)->do_bar (self);
+}
+
+
 G_DEFINE_TYPE_EXTENDED (FooObject, foo_object, G_TYPE_OBJECT,
 			0, G_IMPLEMENT_INTERFACE (FOO_TYPE_INTERFACE,
 						  foo_foo_interface_init));
diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h
index 17a22d2..0bf087a 100644
--- a/tests/scanner/foo.h
+++ b/tests/scanner/foo.h
@@ -9,6 +9,12 @@
 #define FOO_IS_INTERFACE(object)     (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_INTERFACE))
 #define FOO_INTERFACE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), FOO_TYPE_INTERFACE, FooInterfaceIface))
 
+#define FOO_TYPE_SUBINTERFACE           (foo_sub_interface_get_type ())
+#define FOO_SUBINTERFACE(object)        (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_SUBINTERFACE, FooSubInterface))
+#define FOO_IS_SUBINTERFACE(object)     (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_SUBINTERFACE))
+#define FOO_SUBINTERFACE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), FOO_TYPE_SUBINTERFACE, FooSubInterfaceIface))
+
+
 #define FOO_TYPE_OBJECT              (foo_object_get_type ())
 #define FOO_OBJECT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_OBJECT, FooObject))
 #define FOO_IS_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_OBJECT))
@@ -19,6 +25,8 @@
 
 typedef struct _FooInterface       FooInterface;
 typedef struct _FooInterfaceIface  FooInterfaceIface;
+typedef struct _FooSubInterface       FooSubInterface;
+typedef struct _FooSubInterfaceIface  FooSubInterfaceIface;
 typedef struct _FooObject          FooObject;
 typedef struct _FooObjectClass     FooObjectClass;
 typedef struct _FooSubobject       FooSubobject;
@@ -33,6 +41,17 @@ struct _FooInterfaceIface
 
 GType                 foo_interface_get_type       (void) G_GNUC_CONST;
 
+struct _FooSubInterfaceIface
+{
+  GTypeInterface parent_iface;
+
+  void (*do_bar) (FooSubInterface *self);
+};
+
+GType                 foo_sub_interface_get_type       (void) G_GNUC_CONST;
+
+void foo_sub_interface_do_bar (FooSubInterface *self);
+
 struct _FooObject
 {
   GObject parent_instance;
diff --git a/tools/generate.c b/tools/generate.c
index 840de7c..7c849bc 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -986,24 +986,19 @@ write_interface_info (const gchar     *namespace,
 
   if (deprecated)
     xml_printf (file, " deprecated=\"1\"");
-	
 
   if (g_interface_info_get_n_prerequisites (info) > 0)
     {
-      xml_start_element (file, "requires");
       for (i = 0; i < g_interface_info_get_n_prerequisites (info); i++)
 	{
 	  GIBaseInfo *req = g_interface_info_get_prerequisite (info, i);
-	  
-	  if (g_base_info_get_type (req) == GI_INFO_TYPE_INTERFACE)
-            xml_start_element (file, "interface");
-	  else
-            xml_start_element (file, "object");
+
+	  xml_start_element (file, "prerequisite");
 	  write_type_name_attribute (namespace, req, "name", file);
+
           xml_end_element_unchecked (file);
 	  g_base_info_unref (req);
 	}
-      xml_end_element (file, "requires");
     }
 
   for (i = 0; i < g_interface_info_get_n_methods (info); i++)
