|
@@ -346,6 +346,11 @@ class ComplexMarker: |
|
|
""" |
|
|
""" |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class LocalMarker: |
|
|
|
|
|
"""marker for complex type information |
|
|
|
|
|
""" |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MarkerInterface: |
|
|
class MarkerInterface: |
|
|
def isDefinition(self): |
|
|
def isDefinition(self): |
|
@@ -384,6 +389,9 @@ class MarkerInterface: |
|
|
def isComplex(self): |
|
|
def isComplex(self): |
|
|
return isinstance(self, ComplexMarker) |
|
|
return isinstance(self, ComplexMarker) |
|
|
|
|
|
|
|
|
|
|
|
def isLocal(self): |
|
|
|
|
|
return isinstance(self, LocalMarker) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########################################################## |
|
|
########################################################## |
|
|
# Schema Components |
|
|
# Schema Components |
|
@@ -1203,6 +1211,7 @@ class AttributeDeclaration(XMLSchemaComponent,\ |
|
|
|
|
|
|
|
|
class LocalAttributeDeclaration(AttributeDeclaration,\ |
|
|
class LocalAttributeDeclaration(AttributeDeclaration,\ |
|
|
AttributeMarker,\ |
|
|
AttributeMarker,\ |
|
|
|
|
|
LocalMarker,\ |
|
|
DeclarationMarker): |
|
|
DeclarationMarker): |
|
|
"""<attribute name> |
|
|
"""<attribute name> |
|
|
parent: |
|
|
parent: |
|
@@ -1348,6 +1357,9 @@ class AttributeGroupDefinition(XMLSchemaComponent,\ |
|
|
self.annotation = None |
|
|
self.annotation = None |
|
|
self.attr_content = None |
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def getAttributeContent(self): |
|
|
|
|
|
return self.attr_content |
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
|
contents = self.getContents(node) |
|
|
contents = self.getContents(node) |
|
@@ -1637,7 +1649,8 @@ class ElementDeclaration(XMLSchemaComponent,\ |
|
|
self.constraints = tuple(constraints) |
|
|
self.constraints = tuple(constraints) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LocalElementDeclaration(ElementDeclaration): |
|
|
|
|
|
|
|
|
class LocalElementDeclaration(ElementDeclaration,\ |
|
|
|
|
|
LocalMarker): |
|
|
"""<element> |
|
|
"""<element> |
|
|
parents: |
|
|
parents: |
|
|
all, choice, sequence |
|
|
all, choice, sequence |
|
@@ -2039,6 +2052,9 @@ class ComplexType(XMLSchemaComponent,\ |
|
|
self.content = None |
|
|
self.content = None |
|
|
self.attr_content = None |
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def getAttributeContent(self): |
|
|
|
|
|
return self.attr_content |
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
|
contents = self.getContents(node) |
|
|
contents = self.getContents(node) |
|
@@ -2154,6 +2170,15 @@ class ComplexType(XMLSchemaComponent,\ |
|
|
contents = {'xsd':['annotation', 'group', 'all', 'choice',\ |
|
|
contents = {'xsd':['annotation', 'group', 'all', 'choice',\ |
|
|
'sequence', 'attribute', 'attributeGroup', 'anyAttribute']} |
|
|
'sequence', 'attribute', 'attributeGroup', 'anyAttribute']} |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, parent): |
|
|
|
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
|
|
|
self.annotation = None |
|
|
|
|
|
self.content = None |
|
|
|
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def getAttributeContent(self): |
|
|
|
|
|
return self.attr_content |
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
|
contents = self.getContents(node) |
|
|
contents = self.getContents(node) |
|
@@ -2276,6 +2301,9 @@ class ComplexType(XMLSchemaComponent,\ |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
self.annotation = None |
|
|
self.annotation = None |
|
|
self.attr_content = None |
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def getAttributeContent(self): |
|
|
|
|
|
return self.attr_content |
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
@@ -2332,8 +2360,54 @@ class ComplexType(XMLSchemaComponent,\ |
|
|
contents = {'xsd':['annotation', 'simpleType', 'attribute',\ |
|
|
contents = {'xsd':['annotation', 'simpleType', 'attribute',\ |
|
|
'attributeGroup', 'anyAttribute'] + RestrictionMarker.facets} |
|
|
'attributeGroup', 'anyAttribute'] + RestrictionMarker.facets} |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, parent): |
|
|
|
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
|
|
|
self.annotation = None |
|
|
|
|
|
self.content = None |
|
|
|
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def getAttributeContent(self): |
|
|
|
|
|
return self.attr_content |
|
|
|
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
|
|
|
self.content = [] |
|
|
|
|
|
self.setAttributes(node) |
|
|
|
|
|
contents = self.getContents(node) |
|
|
|
|
|
|
|
|
|
|
|
indx = 0 |
|
|
|
|
|
num = len(contents) |
|
|
|
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
|
|
|
|
if component == 'annotation': |
|
|
|
|
|
self.annotation = Annotation(self) |
|
|
|
|
|
self.annotation.fromDom(contents[indx]) |
|
|
|
|
|
indx += 1 |
|
|
|
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
|
|
|
|
|
|
|
|
|
|
content = [] |
|
|
|
|
|
while indx < num: |
|
|
|
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
|
|
|
|
if component == 'attribute': |
|
|
|
|
|
if contents[indx].hasattr('ref'): |
|
|
|
|
|
content.append(AttributeReference(self)) |
|
|
|
|
|
else: |
|
|
|
|
|
content.append(LocalAttributeDeclaration(self)) |
|
|
|
|
|
elif component == 'attributeGroup': |
|
|
|
|
|
content.append(AttributeGroupReference(self)) |
|
|
|
|
|
elif component == 'anyAttribute': |
|
|
|
|
|
content.append(AttributeWildCard(self)) |
|
|
|
|
|
elif component == 'simpleType': |
|
|
|
|
|
self.content.append(LocalSimpleType(self)) |
|
|
|
|
|
self.content[-1].fromDom(contents[indx]) |
|
|
|
|
|
else: |
|
|
|
|
|
raise SchemaError, 'Unknown component (%s)'\ |
|
|
|
|
|
%(contents[indx].getTagName()) |
|
|
|
|
|
content[-1].fromDom(contents[indx]) |
|
|
|
|
|
indx += 1 |
|
|
|
|
|
self.attr_content = tuple(content) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LocalComplexType(ComplexType): |
|
|
|
|
|
|
|
|
class LocalComplexType(ComplexType,\ |
|
|
|
|
|
LocalMarker): |
|
|
"""<complexType> |
|
|
"""<complexType> |
|
|
parents: |
|
|
parents: |
|
|
element |
|
|
element |
|
@@ -2375,7 +2449,6 @@ class SimpleType(XMLSchemaComponent,\ |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
self.annotation = None |
|
|
self.annotation = None |
|
|
self.content = None |
|
|
self.content = None |
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
@@ -2422,13 +2495,11 @@ class SimpleType(XMLSchemaComponent,\ |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
self.annotation = None |
|
|
self.annotation = None |
|
|
self.content = None |
|
|
self.content = None |
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
|
contents = self.getContents(node) |
|
|
contents = self.getContents(node) |
|
|
content = [] |
|
|
content = [] |
|
|
self.attr_content = [] |
|
|
|
|
|
|
|
|
|
|
|
for indx in range(len(contents)): |
|
|
for indx in range(len(contents)): |
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
@@ -2461,17 +2532,16 @@ class SimpleType(XMLSchemaComponent,\ |
|
|
attributes = {'id':None, |
|
|
attributes = {'id':None, |
|
|
'memberTypes':None } |
|
|
'memberTypes':None } |
|
|
contents = {'xsd':['annotation', 'simpleType']} |
|
|
contents = {'xsd':['annotation', 'simpleType']} |
|
|
|
|
|
|
|
|
def __init__(self, parent): |
|
|
def __init__(self, parent): |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
self.annotation = None |
|
|
self.annotation = None |
|
|
self.content = None |
|
|
self.content = None |
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
|
contents = self.getContents(node) |
|
|
contents = self.getContents(node) |
|
|
content = [] |
|
|
content = [] |
|
|
self.attr_content = [] |
|
|
|
|
|
|
|
|
|
|
|
for indx in range(len(contents)): |
|
|
for indx in range(len(contents)): |
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
@@ -2503,13 +2573,11 @@ class SimpleType(XMLSchemaComponent,\ |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
XMLSchemaComponent.__init__(self, parent) |
|
|
self.annotation = None |
|
|
self.annotation = None |
|
|
self.content = None |
|
|
self.content = None |
|
|
self.attr_content = None |
|
|
|
|
|
|
|
|
|
|
|
def fromDom(self, node): |
|
|
def fromDom(self, node): |
|
|
self.setAttributes(node) |
|
|
self.setAttributes(node) |
|
|
contents = self.getContents(node) |
|
|
contents = self.getContents(node) |
|
|
self.content = [] |
|
|
self.content = [] |
|
|
self.attr_content = [] |
|
|
|
|
|
|
|
|
|
|
|
for indx in range(len(contents)): |
|
|
for indx in range(len(contents)): |
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
|
component = SplitQName(contents[indx].getTagName())[1] |
|
|