From e027c000c00c6effcfcc6c78cadf50e03b1f4523 Mon Sep 17 00:00:00 2001 From: Joshua Boverhof Date: Thu, 27 Jan 2005 23:01:19 +0000 Subject: [PATCH] ---------------------------------------------------------------------- Modified Files: XMLSchema.py -- added a couple convenience methods for grabbing various Schema Items. ---------------------------------------------------------------------- --- XMLSchema.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/XMLSchema.py b/XMLSchema.py index 3894791..c884efe 100755 --- a/XMLSchema.py +++ b/XMLSchema.py @@ -534,6 +534,12 @@ class XMLSchemaComponent(XMLBase, MarkerInterface): """ return self.getQNameAttribute('elements', attribute) + def getModelGroup(self, attribute): + """attribute -- attribute with a QName value (eg. ref). + collection -- check model_group collection in parent Schema instance. + """ + return self.getQNameAttribute('model_groups', attribute) + def getQNameAttribute(self, collection, attribute): """returns object instance representing QName --> (namespace,name), or if does not exist return None. @@ -2175,6 +2181,9 @@ class ModelGroupReference(XMLSchemaComponent,\ XMLSchemaComponent.__init__(self, parent) self.annotation = None + def getModelGroupReference(self): + return self.getModelGroup('ref') + def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) @@ -2691,6 +2700,11 @@ class SimpleType(XMLSchemaComponent,\ self.annotation = None self.content = None + def getSimpleTypeContent(self): + for el in self.content: + if el.isSimple(): return el + return None + def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)