Пример #1
0
 def constrainingFacets(self, facetValues=None):
     facetValues = facetValues if facetValues else {}
     for facetElt in XmlUtil.schemaFacets(
             self, ("{http://www.w3.org/2001/XMLSchema}length",
                    "{http://www.w3.org/2001/XMLSchema}minLength",
                    "{http://www.w3.org/2001/XMLSchema}maxLength",
                    "{http://www.w3.org/2001/XMLSchema}pattern",
                    "{http://www.w3.org/2001/XMLSchema}whiteSpace",
                    "{http://www.w3.org/2001/XMLSchema}maxInclusive",
                    "{http://www.w3.org/2001/XMLSchema}maxExclusive",
                    "{http://www.w3.org/2001/XMLSchema}minExclusive",
                    "{http://www.w3.org/2001/XMLSchema}totalDigits",
                    "{http://www.w3.org/2001/XMLSchema}fractionDigits")):
         facetValue = XmlValidate.validateFacet(self, facetElt)
         facetName = facetElt.localName
         if facetName not in facetValues and facetValue is not None:  # facetValue can be zero but not None
             facetValues[facetName] = facetValue
     if "enumeration" not in facetValues:
         for facetElt in XmlUtil.schemaFacets(
                 self, ("{http://www.w3.org/2001/XMLSchema}enumeration", )):
             facetValues.setdefault("enumeration",
                                    set()).add(facetElt.get("value"))
     typeDerivedFrom = self.typeDerivedFrom
     if isinstance(typeDerivedFrom, ModelType):
         typeDerivedFrom.constrainingFacets(facetValues)
     return facetValues
Пример #2
0
 def constrainingFacets(self, facetValues=None):
     facetValues = facetValues if facetValues else {}
     for facetElt in XmlUtil.schemaFacets(self, (
                 "{http://www.w3.org/2001/XMLSchema}length", "{http://www.w3.org/2001/XMLSchema}minLength", 
                 "{http://www.w3.org/2001/XMLSchema}maxLength", 
                 "{http://www.w3.org/2001/XMLSchema}pattern", "{http://www.w3.org/2001/XMLSchema}whiteSpace",  
                 "{http://www.w3.org/2001/XMLSchema}maxInclusive", "{http://www.w3.org/2001/XMLSchema}maxExclusive", "{http://www.w3.org/2001/XMLSchema}minExclusive", 
                 "{http://www.w3.org/2001/XMLSchema}totalDigits", "{http://www.w3.org/2001/XMLSchema}fractionDigits")):
         facetValue = XmlValidate.validateFacet(self, facetElt)
         facetName = facetElt.localName
         if facetName not in facetValues and facetValue is not None:  # facetValue can be zero but not None
             facetValues[facetName] = facetValue
     if "enumeration" not in facetValues:
         for facetElt in XmlUtil.schemaFacets(self, ("{http://www.w3.org/2001/XMLSchema}enumeration",)):
             facetValues.setdefault("enumeration",set()).add(facetElt.get("value"))
     typeDerivedFrom = self.typeDerivedFrom
     if isinstance(typeDerivedFrom, ModelType):
         typeDerivedFrom.constrainingFacets(facetValues)
     return facetValues