Add the ability to include other XML files by using a
authorIan Romanick <idr@us.ibm.com>
Tue, 8 Feb 2005 02:11:14 +0000 (02:11 +0000)
committerIan Romanick <idr@us.ibm.com>
Tue, 8 Feb 2005 02:11:14 +0000 (02:11 +0000)
<include name="file"/> element as a sub-element of <OpenGLAPI>.

src/mesa/glapi/gl_XML.py

index a24a8450a1f78bb27ba054670780880c2a99ced7..b2e3cd4325232d00e0d9a99a88b563e2731eebc4 100644 (file)
@@ -611,6 +611,8 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase):
                        self.current_object.startElement(name, attrs)
                elif name == "category":
                        self.current_category = attrs.get('name', "")
+               elif name == "include":
+                       self.next_include = attrs.get('name', "")
                else:
                        self.current_object = self.factory.create(self, name, attrs)
                return
@@ -620,6 +622,14 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase):
                if self.current_object != None:
                        if self.current_object.endElement(name):
                                self.current_object = None
+               elif name == "include":
+                       parser = make_parser()
+                       parser.setFeature(feature_namespaces, 0)
+                       parser.setContentHandler(self)
+
+                       f = open(self.next_include)
+                       parser.parse(f)
+
                return