Browse Source

----------------------------------------------------------------------

Modified Files:
 	XMLSchema.py -- added a couple convenience methods for grabbing
           various Schema Items.

 ----------------------------------------------------------------------
main
Joshua Boverhof 20 years ago
parent
commit
e027c000c0
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      XMLSchema.py

+ 14
- 0
XMLSchema.py View File

@@ -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)


Loading…
Cancel
Save