xmlclass/xsdschema.py
changeset 1768 691083b5682a
parent 1767 c74815729afd
child 1774 ac0fe8aabb5e
equal deleted inserted replaced
1767:c74815729afd 1768:691083b5682a
    73 NUMBER_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["maxInclusive", "maxExclusive", "minInclusive", "minExclusive"])
    73 NUMBER_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["maxInclusive", "maxExclusive", "minInclusive", "minExclusive"])
    74 DECIMAL_FACETS = GenerateDictFacets(NUMBER_FACETS.keys() + ["totalDigits", "fractionDigits"])
    74 DECIMAL_FACETS = GenerateDictFacets(NUMBER_FACETS.keys() + ["totalDigits", "fractionDigits"])
    75 STRING_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["length", "minLength", "maxLength"])
    75 STRING_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["length", "minLength", "maxLength"])
    76 
    76 
    77 ALL_FACETS = ["pattern", "whiteSpace", "enumeration", "maxInclusive",
    77 ALL_FACETS = ["pattern", "whiteSpace", "enumeration", "maxInclusive",
    78     "maxExclusive", "minInclusive", "minExclusive", "totalDigits",
    78               "maxExclusive", "minInclusive", "minExclusive", "totalDigits",
    79     "fractionDigits", "length", "minLength", "maxLength"]
    79               "fractionDigits", "length", "minLength", "maxLength"]
    80 
    80 
    81 
    81 
    82 #-------------------------------------------------------------------------------
    82 #-------------------------------------------------------------------------------
    83 #                           Structure reducing functions
    83 #                           Structure reducing functions
    84 #-------------------------------------------------------------------------------
    84 #-------------------------------------------------------------------------------
  1141 
  1141 
  1142 #-------------------------------------------------------------------------------
  1142 #-------------------------------------------------------------------------------
  1143 #                           Syntax elements definition
  1143 #                           Syntax elements definition
  1144 #-------------------------------------------------------------------------------
  1144 #-------------------------------------------------------------------------------
  1145 
  1145 
  1146     "all": {"struct": """
  1146     "all": {
       
  1147         "struct": """
  1147         <all
  1148         <all
  1148           id = ID
  1149           id = ID
  1149           maxOccurs = 1 : 1
  1150           maxOccurs = 1 : 1
  1150           minOccurs = (0 | 1) : 1
  1151           minOccurs = (0 | 1) : 1
  1151           {any attributes with non-schema namespace . . .}>
  1152           {any attributes with non-schema namespace . . .}>
  1152           Content: (annotation?, element*)
  1153           Content: (annotation?, element*)
  1153         </all>""",
  1154         </all>""",
  1154         "type": SYNTAXELEMENT,
  1155         "type": SYNTAXELEMENT,
  1155         "extract": {
  1156         "extract": {
  1156             "default": GenerateElement("all", ["id", "maxOccurs", "minOccurs"],
  1157             "default": GenerateElement(
       
  1158                 "all", ["id", "maxOccurs", "minOccurs"],
  1157                 re.compile("((?:annotation )?(?:element )*)"))
  1159                 re.compile("((?:annotation )?(?:element )*)"))
  1158         },
  1160         },
  1159         "reduce": ReduceAll
  1161         "reduce": ReduceAll
  1160     },
  1162     },
  1161 
  1163 
  1162     "annotation": {"struct": """
  1164     "annotation": {
       
  1165         "struct": """
  1163         <annotation
  1166         <annotation
  1164           id = ID
  1167           id = ID
  1165           {any attributes with non-schema namespace . . .}>
  1168           {any attributes with non-schema namespace . . .}>
  1166           Content: (appinfo | documentation)*
  1169           Content: (appinfo | documentation)*
  1167         </annotation>""",
  1170         </annotation>""",
  1168         "type": SYNTAXELEMENT,
  1171         "type": SYNTAXELEMENT,
  1169         "extract": {
  1172         "extract": {
  1170             "default": GenerateElement("annotation", ["id"],
  1173             "default": GenerateElement(
       
  1174                 "annotation", ["id"],
  1171                 re.compile("((?:app_info |documentation )*)"))
  1175                 re.compile("((?:app_info |documentation )*)"))
  1172         },
  1176         },
  1173         "reduce": ReduceAnnotation
  1177         "reduce": ReduceAnnotation
  1174     },
  1178     },
  1175 
  1179 
  1176     "any": {"struct": """
  1180     "any": {
       
  1181         "struct": """
  1177         <any
  1182         <any
  1178           id = ID
  1183           id = ID
  1179           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1184           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1180           minOccurs = nonNegativeInteger : 1
  1185           minOccurs = nonNegativeInteger : 1
  1181           namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
  1186           namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
  1183           {any attributes with non-schema namespace . . .}>
  1188           {any attributes with non-schema namespace . . .}>
  1184           Content: (annotation?)
  1189           Content: (annotation?)
  1185         </any>""",
  1190         </any>""",
  1186         "type": SYNTAXELEMENT,
  1191         "type": SYNTAXELEMENT,
  1187         "extract": {
  1192         "extract": {
  1188             "default": GenerateElement("any",
  1193             "default": GenerateElement(
       
  1194                 "any",
  1189                 ["id", "maxOccurs", "minOccurs", "namespace", "processContents"],
  1195                 ["id", "maxOccurs", "minOccurs", "namespace", "processContents"],
  1190                 re.compile("((?:annotation )?(?:simpleType )*)"))
  1196                 re.compile("((?:annotation )?(?:simpleType )*)"))
  1191         },
  1197         },
  1192         "reduce": ReduceAny
  1198         "reduce": ReduceAny
  1193     },
  1199     },
  1194 
  1200 
  1195     "anyAttribute": {"struct": """
  1201     "anyAttribute": {
       
  1202         "struct": """
  1196         <anyAttribute
  1203         <anyAttribute
  1197           id = ID
  1204           id = ID
  1198           namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
  1205           namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
  1199           processContents = (lax | skip | strict) : strict
  1206           processContents = (lax | skip | strict) : strict
  1200           {any attributes with non-schema namespace . . .}>
  1207           {any attributes with non-schema namespace . . .}>
  1201           Content: (annotation?)
  1208           Content: (annotation?)
  1202         </anyAttribute>""",
  1209         </anyAttribute>""",
  1203         "type": SYNTAXELEMENT,
  1210         "type": SYNTAXELEMENT,
  1204         "extract": {
  1211         "extract": {
  1205             "default": GenerateElement("anyAttribute",
  1212             "default": GenerateElement(
  1206                 ["id", "namespace", "processContents"], ONLY_ANNOTATION)
  1213                 "anyAttribute", ["id", "namespace", "processContents"], ONLY_ANNOTATION)
  1207         },
  1214         },
  1208         "reduce": ReduceAnyAttribute
  1215         "reduce": ReduceAnyAttribute
  1209     },
  1216     },
  1210 
  1217 
  1211     "appinfo": {"struct": """
  1218     "appinfo": {
       
  1219         "struct": """
  1212         <appinfo
  1220         <appinfo
  1213           source = anyURI
  1221           source = anyURI
  1214           {any attributes with non-schema namespace . . .}>
  1222           {any attributes with non-schema namespace . . .}>
  1215           Content: ({any})*
  1223           Content: ({any})*
  1216         </appinfo>""",
  1224         </appinfo>""",
  1219             "default": GenerateElement("appinfo", ["source"], re.compile("(.*)"), True)
  1227             "default": GenerateElement("appinfo", ["source"], re.compile("(.*)"), True)
  1220         },
  1228         },
  1221         "reduce": ReduceAppInfo
  1229         "reduce": ReduceAppInfo
  1222     },
  1230     },
  1223 
  1231 
  1224     "attribute": {"struct": """
  1232     "attribute": {
       
  1233         "struct": """
  1225         <attribute
  1234         <attribute
  1226           default = string
  1235           default = string
  1227           fixed = string
  1236           fixed = string
  1228           form = (qualified | unqualified)
  1237           form = (qualified | unqualified)
  1229           id = ID
  1238           id = ID
  1234           {any attributes with non-schema namespace . . .}>
  1243           {any attributes with non-schema namespace . . .}>
  1235           Content: (annotation?, simpleType?)
  1244           Content: (annotation?, simpleType?)
  1236         </attribute>""",
  1245         </attribute>""",
  1237         "type": SYNTAXELEMENT,
  1246         "type": SYNTAXELEMENT,
  1238         "extract": {
  1247         "extract": {
  1239             "default": GenerateElement("attribute",
  1248             "default": GenerateElement(
       
  1249                 "attribute",
  1240                 ["default", "fixed", "form", "id", "name", "ref", "type", "use"],
  1250                 ["default", "fixed", "form", "id", "name", "ref", "type", "use"],
  1241                 re.compile("((?:annotation )?(?:simpleType )?)")),
  1251                 re.compile("((?:annotation )?(?:simpleType )?)")),
  1242             "schema": GenerateElement("attribute",
  1252             "schema": GenerateElement(
       
  1253                 "attribute",
  1243                 ["default", "fixed", "form", "id", "name", "type"],
  1254                 ["default", "fixed", "form", "id", "name", "type"],
  1244                 re.compile("((?:annotation )?(?:simpleType )?)"))
  1255                 re.compile("((?:annotation )?(?:simpleType )?)"))
  1245         },
  1256         },
  1246         "reduce": ReduceAttribute
  1257         "reduce": ReduceAttribute
  1247     },
  1258     },
  1248 
  1259 
  1249     "attributeGroup": {"struct": """
  1260     "attributeGroup": {
       
  1261         "struct": """
  1250         <attributeGroup
  1262         <attributeGroup
  1251           id = ID
  1263           id = ID
  1252           name = NCName
  1264           name = NCName
  1253           ref = QName
  1265           ref = QName
  1254           {any attributes with non-schema namespace . . .}>
  1266           {any attributes with non-schema namespace . . .}>
  1255           Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
  1267           Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
  1256         </attributeGroup>""",
  1268         </attributeGroup>""",
  1257         "type": SYNTAXELEMENT,
  1269         "type": SYNTAXELEMENT,
  1258         "extract": {
  1270         "extract": {
  1259             "default": GenerateElement("attributeGroup",
  1271             "default": GenerateElement(
       
  1272                 "attributeGroup",
  1260                 ["id", "ref"], ONLY_ANNOTATION),
  1273                 ["id", "ref"], ONLY_ANNOTATION),
  1261             "schema": GenerateElement("attributeGroup",
  1274             "schema": GenerateElement(
       
  1275                 "attributeGroup",
  1262                 ["id", "name"],
  1276                 ["id", "name"],
  1263                 re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))"))
  1277                 re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))"))
  1264         },
  1278         },
  1265         "reduce": ReduceAttributeGroup
  1279         "reduce": ReduceAttributeGroup
  1266     },
  1280     },
  1267 
  1281 
  1268     "choice": {"struct": """
  1282     "choice": {
       
  1283         "struct": """
  1269         <choice
  1284         <choice
  1270           id = ID
  1285           id = ID
  1271           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1286           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1272           minOccurs = nonNegativeInteger : 1
  1287           minOccurs = nonNegativeInteger : 1
  1273           {any attributes with non-schema namespace . . .}>
  1288           {any attributes with non-schema namespace . . .}>
  1274           Content: (annotation?, (element | group | choice | sequence | any)*)
  1289           Content: (annotation?, (element | group | choice | sequence | any)*)
  1275         </choice>""",
  1290         </choice>""",
  1276         "type": SYNTAXELEMENT,
  1291         "type": SYNTAXELEMENT,
  1277         "extract": {
  1292         "extract": {
  1278             "default": GenerateElement("choice", ["id", "maxOccurs", "minOccurs"],
  1293             "default": GenerateElement(
       
  1294                 "choice",
       
  1295                 ["id", "maxOccurs", "minOccurs"],
  1279                 re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)"))
  1296                 re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)"))
  1280         },
  1297         },
  1281         "reduce": ReduceChoice
  1298         "reduce": ReduceChoice
  1282     },
  1299     },
  1283 
  1300 
  1284     "complexContent": {"struct": """
  1301     "complexContent": {
       
  1302         "struct": """
  1285         <complexContent
  1303         <complexContent
  1286           id = ID
  1304           id = ID
  1287           mixed = boolean
  1305           mixed = boolean
  1288           {any attributes with non-schema namespace . . .}>
  1306           {any attributes with non-schema namespace . . .}>
  1289           Content: (annotation?, (restriction | extension))
  1307           Content: (annotation?, (restriction | extension))
  1290         </complexContent>""",
  1308         </complexContent>""",
  1291         "type": SYNTAXELEMENT,
  1309         "type": SYNTAXELEMENT,
  1292         "extract": {
  1310         "extract": {
  1293             "default": GenerateElement("complexContent", ["id", "mixed"],
  1311             "default": GenerateElement(
       
  1312                 "complexContent",
       
  1313                 ["id", "mixed"],
  1294                 re.compile("((?:annotation )?(?:restriction |extension ))"))
  1314                 re.compile("((?:annotation )?(?:restriction |extension ))"))
  1295         },
  1315         },
  1296         "reduce": ReduceComplexContent
  1316         "reduce": ReduceComplexContent
  1297     },
  1317     },
  1298 
  1318 
  1299     "complexType": {"struct": """
  1319     "complexType": {
       
  1320         "struct": """
  1300         <complexType
  1321         <complexType
  1301           abstract = boolean : false
  1322           abstract = boolean : false
  1302           block = (#all | List of (extension | restriction))
  1323           block = (#all | List of (extension | restriction))
  1303           final = (#all | List of (extension | restriction))
  1324           final = (#all | List of (extension | restriction))
  1304           id = ID
  1325           id = ID
  1307           {any attributes with non-schema namespace . . .}>
  1328           {any attributes with non-schema namespace . . .}>
  1308           Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
  1329           Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
  1309         </complexType>""",
  1330         </complexType>""",
  1310         "type": SYNTAXELEMENT,
  1331         "type": SYNTAXELEMENT,
  1311         "extract": {
  1332         "extract": {
  1312             "default": GenerateElement("complexType",
  1333             "default": GenerateElement(
       
  1334                 "complexType",
  1313                 ["abstract", "block", "final", "id", "mixed", "name"],
  1335                 ["abstract", "block", "final", "id", "mixed", "name"],
  1314                 re.compile("((?:annotation )?(?:simpleContent |complexContent |(?:(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))))"))
  1336                 re.compile("((?:annotation )?(?:simpleContent |complexContent |(?:(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))))"))
  1315         },
  1337         },
  1316         "reduce": ReduceComplexType
  1338         "reduce": ReduceComplexType
  1317     },
  1339     },
  1318 
  1340 
  1319     "documentation": {"struct": """
  1341     "documentation": {
       
  1342         "struct": """
  1320         <documentation
  1343         <documentation
  1321           source = anyURI
  1344           source = anyURI
  1322           xml:lang = language
  1345           xml:lang = language
  1323           {any attributes with non-schema namespace . . .}>
  1346           {any attributes with non-schema namespace . . .}>
  1324           Content: ({any})*
  1347           Content: ({any})*
  1325         </documentation>""",
  1348         </documentation>""",
  1326         "type": SYNTAXELEMENT,
  1349         "type": SYNTAXELEMENT,
  1327         "extract": {
  1350         "extract": {
  1328             "default": GenerateElement("documentation",
  1351             "default": GenerateElement(
  1329                 ["source", "lang"], re.compile("(.*)"), True)
  1352                 "documentation",
       
  1353                 ["source", "lang"],
       
  1354                 re.compile("(.*)"), True)
  1330         },
  1355         },
  1331         "reduce": ReduceDocumentation
  1356         "reduce": ReduceDocumentation
  1332     },
  1357     },
  1333 
  1358 
  1334     "element": {"struct": """
  1359     "element": {
       
  1360         "struct": """
  1335         <element
  1361         <element
  1336           abstract = boolean : false
  1362           abstract = boolean : false
  1337           block = (#all | List of (extension | restriction | substitution))
  1363           block = (#all | List of (extension | restriction | substitution))
  1338           default = string
  1364           default = string
  1339           final = (#all | List of (extension | restriction))
  1365           final = (#all | List of (extension | restriction))
  1350           {any attributes with non-schema namespace . . .}>
  1376           {any attributes with non-schema namespace . . .}>
  1351           Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
  1377           Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
  1352         </element>""",
  1378         </element>""",
  1353         "type": SYNTAXELEMENT,
  1379         "type": SYNTAXELEMENT,
  1354         "extract": {
  1380         "extract": {
  1355             "default": GenerateElement("element",
  1381             "default": GenerateElement(
       
  1382                 "element",
  1356                 ["abstract", "block", "default", "final", "fixed", "form", "id", "maxOccurs", "minOccurs", "name", "nillable", "ref", "substitutionGroup", "type"],
  1383                 ["abstract", "block", "default", "final", "fixed", "form", "id", "maxOccurs", "minOccurs", "name", "nillable", "ref", "substitutionGroup", "type"],
  1357                 re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)")),
  1384                 re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)")),
  1358             "schema": GenerateElement("element",
  1385             "schema": GenerateElement(
       
  1386                 "element",
  1359                 ["abstract", "block", "default", "final", "fixed", "form", "id", "name", "nillable", "substitutionGroup", "type"],
  1387                 ["abstract", "block", "default", "final", "fixed", "form", "id", "name", "nillable", "substitutionGroup", "type"],
  1360                 re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)"))
  1388                 re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)"))
  1361         },
  1389         },
  1362         "reduce": ReduceElement
  1390         "reduce": ReduceElement
  1363     },
  1391     },
  1364 
  1392 
  1365     "enumeration": {"struct": """
  1393     "enumeration": {
       
  1394         "struct": """
  1366         <enumeration
  1395         <enumeration
  1367           id = ID
  1396           id = ID
  1368           value = anySimpleType
  1397           value = anySimpleType
  1369           {any attributes with non-schema namespace . . .}>
  1398           {any attributes with non-schema namespace . . .}>
  1370           Content: (annotation?)
  1399           Content: (annotation?)
  1374             "default": GenerateElement("enumeration", ["id", "value"], ONLY_ANNOTATION)
  1403             "default": GenerateElement("enumeration", ["id", "value"], ONLY_ANNOTATION)
  1375         },
  1404         },
  1376         "reduce": GenerateFacetReducing("enumeration", False)
  1405         "reduce": GenerateFacetReducing("enumeration", False)
  1377     },
  1406     },
  1378 
  1407 
  1379     "extension": {"struct": """
  1408     "extension": {
       
  1409         "struct": """
  1380         <extension
  1410         <extension
  1381           base = QName
  1411           base = QName
  1382           id = ID
  1412           id = ID
  1383           {any attributes with non-schema namespace . . .}>
  1413           {any attributes with non-schema namespace . . .}>
  1384           Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
  1414           Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
  1385         </extension>""",
  1415         </extension>""",
  1386         "type": SYNTAXELEMENT,
  1416         "type": SYNTAXELEMENT,
  1387         "extract": {
  1417         "extract": {
  1388             "default": GenerateElement("extension", ["base", "id"],
  1418             "default": GenerateElement(
       
  1419                 "extension",
       
  1420                 ["base", "id"],
  1389                 re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))")),
  1421                 re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))")),
  1390             "complexContent": GenerateElement("extension", ["base", "id"],
  1422             "complexContent": GenerateElement(
       
  1423                 "extension",
       
  1424                 ["base", "id"],
  1391                 re.compile("((?:annotation )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))"))
  1425                 re.compile("((?:annotation )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))"))
  1392         },
  1426         },
  1393         "reduce": ReduceExtension
  1427         "reduce": ReduceExtension
  1394     },
  1428     },
  1395 
  1429 
  1396     "field": {"struct": """
  1430     "field": {
       
  1431         "struct": """
  1397         <field
  1432         <field
  1398           id = ID
  1433           id = ID
  1399           xpath = a subset of XPath expression, see below
  1434           xpath = a subset of XPath expression, see below
  1400           {any attributes with non-schema namespace . . .}>
  1435           {any attributes with non-schema namespace . . .}>
  1401           Content: (annotation?)
  1436           Content: (annotation?)
  1405             "default": GenerateElement("field", ["id", "xpath"], ONLY_ANNOTATION)
  1440             "default": GenerateElement("field", ["id", "xpath"], ONLY_ANNOTATION)
  1406         },
  1441         },
  1407         "reduce": ReduceField
  1442         "reduce": ReduceField
  1408     },
  1443     },
  1409 
  1444 
  1410     "fractionDigits": {"struct": """
  1445     "fractionDigits": {
       
  1446         "struct": """
  1411         <fractionDigits
  1447         <fractionDigits
  1412           fixed = boolean : false
  1448           fixed = boolean : false
  1413           id = ID
  1449           id = ID
  1414           value = nonNegativeInteger
  1450           value = nonNegativeInteger
  1415           {any attributes with non-schema namespace . . .}>
  1451           {any attributes with non-schema namespace . . .}>
  1416           Content: (annotation?)
  1452           Content: (annotation?)
  1417         </fractionDigits>""",
  1453         </fractionDigits>""",
  1418         "type": SYNTAXELEMENT,
  1454         "type": SYNTAXELEMENT,
  1419         "extract": {
  1455         "extract": {
  1420             "default": GenerateElement("fractionDigits",
  1456             "default": GenerateElement(
  1421                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1457                 "fractionDigits",
       
  1458                 ["fixed", "id", "value"],
       
  1459                 ONLY_ANNOTATION)
  1422         },
  1460         },
  1423         "reduce": GenerateFacetReducing("fractionDigits", True)
  1461         "reduce": GenerateFacetReducing("fractionDigits", True)
  1424     },
  1462     },
  1425 
  1463 
  1426     "group": {"struct": """
  1464     "group": {
       
  1465         "struct": """
  1427         <group
  1466         <group
  1428           id = ID
  1467           id = ID
  1429           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1468           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1430           minOccurs = nonNegativeInteger : 1
  1469           minOccurs = nonNegativeInteger : 1
  1431           name = NCName
  1470           name = NCName
  1433           {any attributes with non-schema namespace . . .}>
  1472           {any attributes with non-schema namespace . . .}>
  1434           Content: (annotation?, (all | choice | sequence)?)
  1473           Content: (annotation?, (all | choice | sequence)?)
  1435         </group>""",
  1474         </group>""",
  1436         "type": SYNTAXELEMENT,
  1475         "type": SYNTAXELEMENT,
  1437         "extract": {
  1476         "extract": {
  1438             "default": GenerateElement("group",
  1477             "default": GenerateElement(
       
  1478                 "group",
  1439                 ["id", "maxOccurs", "minOccurs", "ref"],
  1479                 ["id", "maxOccurs", "minOccurs", "ref"],
  1440                 re.compile("((?:annotation )?(?:all |choice |sequence )?)")),
  1480                 re.compile("((?:annotation )?(?:all |choice |sequence )?)")),
  1441             "schema": GenerateElement("group",
  1481             "schema": GenerateElement(
       
  1482                 "group",
  1442                 ["id", "name"],
  1483                 ["id", "name"],
  1443                 re.compile("((?:annotation )?(?:all |choice |sequence )?)"))
  1484                 re.compile("((?:annotation )?(?:all |choice |sequence )?)"))
  1444         },
  1485         },
  1445         "reduce": ReduceGroup
  1486         "reduce": ReduceGroup
  1446     },
  1487     },
  1447 
  1488 
  1448     "import": {"struct": """
  1489     "import": {
       
  1490         "struct": """
  1449         <import
  1491         <import
  1450           id = ID
  1492           id = ID
  1451           namespace = anyURI
  1493           namespace = anyURI
  1452           schemaLocation = anyURI
  1494           schemaLocation = anyURI
  1453           {any attributes with non-schema namespace . . .}>
  1495           {any attributes with non-schema namespace . . .}>
  1454           Content: (annotation?)
  1496           Content: (annotation?)
  1455         </import>""",
  1497         </import>""",
  1456         "type": SYNTAXELEMENT,
  1498         "type": SYNTAXELEMENT,
  1457         "extract": {
  1499         "extract": {
  1458             "default": GenerateElement("import",
  1500             "default": GenerateElement(
  1459                 ["id", "namespace", "schemaLocation"], ONLY_ANNOTATION)
  1501                 "import",
       
  1502                 ["id", "namespace", "schemaLocation"],
       
  1503                 ONLY_ANNOTATION)
  1460         },
  1504         },
  1461         "reduce": ReduceImport
  1505         "reduce": ReduceImport
  1462     },
  1506     },
  1463 
  1507 
  1464     "include": {"struct": """
  1508     "include": {
       
  1509         "struct": """
  1465         <include
  1510         <include
  1466           id = ID
  1511           id = ID
  1467           schemaLocation = anyURI
  1512           schemaLocation = anyURI
  1468           {any attributes with non-schema namespace . . .}>
  1513           {any attributes with non-schema namespace . . .}>
  1469           Content: (annotation?)
  1514           Content: (annotation?)
  1470         </include>""",
  1515         </include>""",
  1471         "type": SYNTAXELEMENT,
  1516         "type": SYNTAXELEMENT,
  1472         "extract": {
  1517         "extract": {
  1473             "default": GenerateElement("include",
  1518             "default": GenerateElement(
  1474                 ["id", "schemaLocation"], ONLY_ANNOTATION)
  1519                 "include",
       
  1520                 ["id", "schemaLocation"],
       
  1521                 ONLY_ANNOTATION)
  1475         },
  1522         },
  1476         "reduce": ReduceInclude
  1523         "reduce": ReduceInclude
  1477     },
  1524     },
  1478 
  1525 
  1479     "key": {"struct": """
  1526     "key": {
       
  1527         "struct": """
  1480         <key
  1528         <key
  1481           id = ID
  1529           id = ID
  1482           name = NCName
  1530           name = NCName
  1483           {any attributes with non-schema namespace . . .}>
  1531           {any attributes with non-schema namespace . . .}>
  1484           Content: (annotation?, (selector, field+))
  1532           Content: (annotation?, (selector, field+))
  1485         </key>""",
  1533         </key>""",
  1486         "type": SYNTAXELEMENT,
  1534         "type": SYNTAXELEMENT,
  1487         "extract": {
  1535         "extract": {
  1488             "default": GenerateElement("key", ["id", "name"],
  1536             "default": GenerateElement(
       
  1537                 "key", ["id", "name"],
  1489                 re.compile("((?:annotation )?(?:selector (?:field )+))"))
  1538                 re.compile("((?:annotation )?(?:selector (?:field )+))"))
  1490         },
  1539         },
  1491         "reduce": ReduceKey
  1540         "reduce": ReduceKey
  1492     },
  1541     },
  1493 
  1542 
  1494     "keyref": {"struct": """
  1543     "keyref": {
       
  1544         "struct": """
  1495         <keyref
  1545         <keyref
  1496           id = ID
  1546           id = ID
  1497           name = NCName
  1547           name = NCName
  1498           refer = QName
  1548           refer = QName
  1499           {any attributes with non-schema namespace . . .}>
  1549           {any attributes with non-schema namespace . . .}>
  1500           Content: (annotation?, (selector, field+))
  1550           Content: (annotation?, (selector, field+))
  1501         </keyref>""",
  1551         </keyref>""",
  1502         "type": SYNTAXELEMENT,
  1552         "type": SYNTAXELEMENT,
  1503         "extract": {
  1553         "extract": {
  1504             "default": GenerateElement("keyref", ["id", "name", "refer"],
  1554             "default": GenerateElement(
       
  1555                 "keyref", ["id", "name", "refer"],
  1505                 re.compile("((?:annotation )?(?:selector (?:field )+))"))
  1556                 re.compile("((?:annotation )?(?:selector (?:field )+))"))
  1506         },
  1557         },
  1507         "reduce": ReduceKeyRef
  1558         "reduce": ReduceKeyRef
  1508     },
  1559     },
  1509 
  1560 
  1510     "length": {"struct": """
  1561     "length": {
       
  1562         "struct": """
  1511         <length
  1563         <length
  1512           fixed = boolean : false
  1564           fixed = boolean : false
  1513           id = ID
  1565           id = ID
  1514           value = nonNegativeInteger
  1566           value = nonNegativeInteger
  1515           {any attributes with non-schema namespace . . .}>
  1567           {any attributes with non-schema namespace . . .}>
  1516           Content: (annotation?)
  1568           Content: (annotation?)
  1517         </length>""",
  1569         </length>""",
  1518         "type": SYNTAXELEMENT,
  1570         "type": SYNTAXELEMENT,
  1519         "extract": {
  1571         "extract": {
  1520             "default": GenerateElement("length",
  1572             "default": GenerateElement(
  1521                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1573                 "length", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1522         },
  1574         },
  1523         "reduce": GenerateFacetReducing("length", True)
  1575         "reduce": GenerateFacetReducing("length", True)
  1524     },
  1576     },
  1525 
  1577 
  1526     "list": {"struct": """
  1578     "list": {
       
  1579         "struct": """
  1527         <list
  1580         <list
  1528           id = ID
  1581           id = ID
  1529           itemType = QName
  1582           itemType = QName
  1530           {any attributes with non-schema namespace . . .}>
  1583           {any attributes with non-schema namespace . . .}>
  1531           Content: (annotation?, simpleType?)
  1584           Content: (annotation?, simpleType?)
  1532         </list>""",
  1585         </list>""",
  1533         "type": SYNTAXELEMENT,
  1586         "type": SYNTAXELEMENT,
  1534         "extract": {
  1587         "extract": {
  1535             "default": GenerateElement("list", ["id", "itemType"],
  1588             "default": GenerateElement(
       
  1589                 "list", ["id", "itemType"],
  1536                 re.compile("((?:annotation )?(?:simpleType )?)$"))
  1590                 re.compile("((?:annotation )?(?:simpleType )?)$"))
  1537         },
  1591         },
  1538         "reduce": ReduceList
  1592         "reduce": ReduceList
  1539     },
  1593     },
  1540 
  1594 
  1541     "maxExclusive": {"struct": """
  1595     "maxExclusive": {
       
  1596         "struct": """
  1542         <maxInclusive
  1597         <maxInclusive
  1543           fixed = boolean : false
  1598           fixed = boolean : false
  1544           id = ID
  1599           id = ID
  1545           value = anySimpleType
  1600           value = anySimpleType
  1546           {any attributes with non-schema namespace . . .}>
  1601           {any attributes with non-schema namespace . . .}>
  1547           Content: (annotation?)
  1602           Content: (annotation?)
  1548         </maxInclusive>""",
  1603         </maxInclusive>""",
  1549         "type": SYNTAXELEMENT,
  1604         "type": SYNTAXELEMENT,
  1550         "extract": {
  1605         "extract": {
  1551             "default": GenerateElement("maxExclusive",
  1606             "default": GenerateElement(
  1552                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1607                 "maxExclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1553         },
  1608         },
  1554         "reduce": GenerateFacetReducing("maxExclusive", True)
  1609         "reduce": GenerateFacetReducing("maxExclusive", True)
  1555     },
  1610     },
  1556 
  1611 
  1557     "maxInclusive": {"struct": """
  1612     "maxInclusive": {
       
  1613         "struct": """
  1558         <maxExclusive
  1614         <maxExclusive
  1559           fixed = boolean : false
  1615           fixed = boolean : false
  1560           id = ID
  1616           id = ID
  1561           value = anySimpleType
  1617           value = anySimpleType
  1562           {any attributes with non-schema namespace . . .}>
  1618           {any attributes with non-schema namespace . . .}>
  1563           Content: (annotation?)
  1619           Content: (annotation?)
  1564         </maxExclusive>""",
  1620         </maxExclusive>""",
  1565         "type": SYNTAXELEMENT,
  1621         "type": SYNTAXELEMENT,
  1566         "extract": {
  1622         "extract": {
  1567             "default": GenerateElement("maxInclusive",
  1623             "default": GenerateElement(
  1568                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1624                 "maxInclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1569         },
  1625         },
  1570         "reduce": GenerateFacetReducing("maxInclusive", True)
  1626         "reduce": GenerateFacetReducing("maxInclusive", True)
  1571     },
  1627     },
  1572 
  1628 
  1573     "maxLength": {"struct": """
  1629     "maxLength": {
       
  1630         "struct": """
  1574         <maxLength
  1631         <maxLength
  1575           fixed = boolean : false
  1632           fixed = boolean : false
  1576           id = ID
  1633           id = ID
  1577           value = nonNegativeInteger
  1634           value = nonNegativeInteger
  1578           {any attributes with non-schema namespace . . .}>
  1635           {any attributes with non-schema namespace . . .}>
  1579           Content: (annotation?)
  1636           Content: (annotation?)
  1580         </maxLength>""",
  1637         </maxLength>""",
  1581         "type": SYNTAXELEMENT,
  1638         "type": SYNTAXELEMENT,
  1582         "extract": {
  1639         "extract": {
  1583             "default": GenerateElement("maxLength",
  1640             "default": GenerateElement(
  1584                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1641                 "maxLength", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1585         },
  1642         },
  1586         "reduce": GenerateFacetReducing("maxLength", True)
  1643         "reduce": GenerateFacetReducing("maxLength", True)
  1587     },
  1644     },
  1588 
  1645 
  1589     "minExclusive": {"struct": """
  1646     "minExclusive": {
       
  1647         "struct": """
  1590         <minExclusive
  1648         <minExclusive
  1591           fixed = boolean : false
  1649           fixed = boolean : false
  1592           id = ID
  1650           id = ID
  1593           value = anySimpleType
  1651           value = anySimpleType
  1594           {any attributes with non-schema namespace . . .}>
  1652           {any attributes with non-schema namespace . . .}>
  1595           Content: (annotation?)
  1653           Content: (annotation?)
  1596         </minExclusive>""",
  1654         </minExclusive>""",
  1597         "type": SYNTAXELEMENT,
  1655         "type": SYNTAXELEMENT,
  1598         "extract": {
  1656         "extract": {
  1599             "default": GenerateElement("minExclusive",
  1657             "default": GenerateElement(
  1600                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1658                 "minExclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1601         },
  1659         },
  1602         "reduce": GenerateFacetReducing("minExclusive", True)
  1660         "reduce": GenerateFacetReducing("minExclusive", True)
  1603     },
  1661     },
  1604 
  1662 
  1605     "minInclusive": {"struct": """
  1663     "minInclusive": {
       
  1664         "struct": """
  1606         <minInclusive
  1665         <minInclusive
  1607           fixed = boolean : false
  1666           fixed = boolean : false
  1608           id = ID
  1667           id = ID
  1609           value = anySimpleType
  1668           value = anySimpleType
  1610           {any attributes with non-schema namespace . . .}>
  1669           {any attributes with non-schema namespace . . .}>
  1611           Content: (annotation?)
  1670           Content: (annotation?)
  1612         </minInclusive>""",
  1671         </minInclusive>""",
  1613         "type": SYNTAXELEMENT,
  1672         "type": SYNTAXELEMENT,
  1614         "extract": {
  1673         "extract": {
  1615             "default": GenerateElement("minInclusive",
  1674             "default": GenerateElement(
  1616                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1675                 "minInclusive", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1617         },
  1676         },
  1618         "reduce": GenerateFacetReducing("minInclusive", True)
  1677         "reduce": GenerateFacetReducing("minInclusive", True)
  1619     },
  1678     },
  1620 
  1679 
  1621     "minLength": {"struct": """
  1680     "minLength": {
       
  1681         "struct": """
  1622         <minLength
  1682         <minLength
  1623           fixed = boolean : false
  1683           fixed = boolean : false
  1624           id = ID
  1684           id = ID
  1625           value = nonNegativeInteger
  1685           value = nonNegativeInteger
  1626           {any attributes with non-schema namespace . . .}>
  1686           {any attributes with non-schema namespace . . .}>
  1627           Content: (annotation?)
  1687           Content: (annotation?)
  1628         </minLength>""",
  1688         </minLength>""",
  1629         "type": SYNTAXELEMENT,
  1689         "type": SYNTAXELEMENT,
  1630         "extract": {
  1690         "extract": {
  1631             "default": GenerateElement("minLength",
  1691             "default": GenerateElement(
  1632                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1692                 "minLength", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1633         },
  1693         },
  1634         "reduce": GenerateFacetReducing("minLength", True)
  1694         "reduce": GenerateFacetReducing("minLength", True)
  1635     },
  1695     },
  1636 
  1696 
  1637     "pattern": {"struct": """
  1697     "pattern": {
       
  1698         "struct": """
  1638         <pattern
  1699         <pattern
  1639           id = ID
  1700           id = ID
  1640           value = string
  1701           value = string
  1641           {any attributes with non-schema namespace . . .}>
  1702           {any attributes with non-schema namespace . . .}>
  1642           Content: (annotation?)
  1703           Content: (annotation?)
  1646             "default": GenerateElement("pattern", ["id", "value"], ONLY_ANNOTATION)
  1707             "default": GenerateElement("pattern", ["id", "value"], ONLY_ANNOTATION)
  1647         },
  1708         },
  1648         "reduce": GenerateFacetReducing("pattern", False)
  1709         "reduce": GenerateFacetReducing("pattern", False)
  1649     },
  1710     },
  1650 
  1711 
  1651     "redefine": {"struct": """
  1712     "redefine": {
       
  1713         "struct": """
  1652         <redefine
  1714         <redefine
  1653           id = ID
  1715           id = ID
  1654           schemaLocation = anyURI
  1716           schemaLocation = anyURI
  1655           {any attributes with non-schema namespace . . .}>
  1717           {any attributes with non-schema namespace . . .}>
  1656           Content: (annotation | (simpleType | complexType | group | attributeGroup))*
  1718           Content: (annotation | (simpleType | complexType | group | attributeGroup))*
  1657         </redefine>""",
  1719         </redefine>""",
  1658         "type": SYNTAXELEMENT,
  1720         "type": SYNTAXELEMENT,
  1659         "extract": {
  1721         "extract": {
  1660             "default": GenerateElement("refine", ["id", "schemaLocation"],
  1722             "default": GenerateElement(
       
  1723                 "refine", ["id", "schemaLocation"],
  1661                 re.compile("((?:annotation |(?:simpleType |complexType |group |attributeGroup ))*)"))
  1724                 re.compile("((?:annotation |(?:simpleType |complexType |group |attributeGroup ))*)"))
  1662         },
  1725         },
  1663         "reduce": ReduceRedefine
  1726         "reduce": ReduceRedefine
  1664     },
  1727     },
  1665 
  1728 
  1666     "restriction": {"struct": """
  1729     "restriction": {
       
  1730         "struct": """
  1667         <restriction
  1731         <restriction
  1668           base = QName
  1732           base = QName
  1669           id = ID
  1733           id = ID
  1670           {any attributes with non-schema namespace . . .}>
  1734           {any attributes with non-schema namespace . . .}>
  1671           Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))
  1735           Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))
  1672         </restriction>""",
  1736         </restriction>""",
  1673         "type": SYNTAXELEMENT,
  1737         "type": SYNTAXELEMENT,
  1674         "extract": {
  1738         "extract": {
  1675             "default": GenerateElement("restriction", ["base", "id"],
  1739             "default": GenerateElement(
       
  1740                 "restriction",
       
  1741                 ["base", "id"],
  1676                 re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)))")),
  1742                 re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)))")),
  1677             "simpleContent": GenerateElement("restriction", ["base", "id"],
  1743             "simpleContent": GenerateElement(
       
  1744                 "restriction",
       
  1745                 ["base", "id"],
  1678                 re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")),
  1746                 re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")),
  1679             "complexContent": GenerateElement("restriction", ["base", "id"],
  1747             "complexContent": GenerateElement(
       
  1748                 "restriction",
       
  1749                 ["base", "id"],
  1680                 re.compile("((?:annotation )?(?:(?:simpleType )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")),
  1750                 re.compile("((?:annotation )?(?:(?:simpleType )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")),
  1681         },
  1751         },
  1682         "reduce": ReduceRestriction
  1752         "reduce": ReduceRestriction
  1683     },
  1753     },
  1684 
  1754 
  1685     "schema": {"struct": """
  1755     "schema": {
       
  1756         "struct": """
  1686         <schema
  1757         <schema
  1687           attributeFormDefault = (qualified | unqualified) : unqualified
  1758           attributeFormDefault = (qualified | unqualified) : unqualified
  1688           blockDefault = (#all | List of (extension | restriction | substitution))  : ''
  1759           blockDefault = (#all | List of (extension | restriction | substitution))  : ''
  1689           elementFormDefault = (qualified | unqualified) : unqualified
  1760           elementFormDefault = (qualified | unqualified) : unqualified
  1690           finalDefault = (#all | List of (extension | restriction | list | union))  : ''
  1761           finalDefault = (#all | List of (extension | restriction | list | union))  : ''
  1695           {any attributes with non-schema namespace . . .}>
  1766           {any attributes with non-schema namespace . . .}>
  1696           Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*)
  1767           Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*)
  1697         </schema>""",
  1768         </schema>""",
  1698         "type": SYNTAXELEMENT,
  1769         "type": SYNTAXELEMENT,
  1699         "extract": {
  1770         "extract": {
  1700             "default": GenerateElement("schema",
  1771             "default": GenerateElement(
  1701                 ["attributeFormDefault", "blockDefault", "elementFormDefault", "finalDefault", "id", "targetNamespace", "version", "lang"],
  1772                 "schema",
       
  1773                 ["attributeFormDefault",
       
  1774                  "blockDefault",
       
  1775                  "elementFormDefault",
       
  1776                  "finalDefault",
       
  1777                  "id",
       
  1778                  "targetNamespace",
       
  1779                  "version",
       
  1780                  "lang"],
  1702                 re.compile("((?:include |import |redefine |annotation )*(?:(?:(?:simpleType |complexType |group |attributeGroup )|element |attribute |annotation )(?:annotation )*)*)"))
  1781                 re.compile("((?:include |import |redefine |annotation )*(?:(?:(?:simpleType |complexType |group |attributeGroup )|element |attribute |annotation )(?:annotation )*)*)"))
  1703         }
  1782         }
  1704     },
  1783     },
  1705 
  1784 
  1706     "selector": {"struct": """
  1785     "selector": {
       
  1786         "struct": """
  1707         <selector
  1787         <selector
  1708           id = ID
  1788           id = ID
  1709           xpath = a subset of XPath expression, see below
  1789           xpath = a subset of XPath expression, see below
  1710           {any attributes with non-schema namespace . . .}>
  1790           {any attributes with non-schema namespace . . .}>
  1711           Content: (annotation?)
  1791           Content: (annotation?)
  1715             "default": GenerateElement("selector", ["id", "xpath"], ONLY_ANNOTATION)
  1795             "default": GenerateElement("selector", ["id", "xpath"], ONLY_ANNOTATION)
  1716         },
  1796         },
  1717         "reduce": ReduceSelector
  1797         "reduce": ReduceSelector
  1718     },
  1798     },
  1719 
  1799 
  1720     "sequence": {"struct": """
  1800     "sequence": {
       
  1801         "struct": """
  1721         <sequence
  1802         <sequence
  1722           id = ID
  1803           id = ID
  1723           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1804           maxOccurs = (nonNegativeInteger | unbounded)  : 1
  1724           minOccurs = nonNegativeInteger : 1
  1805           minOccurs = nonNegativeInteger : 1
  1725           {any attributes with non-schema namespace . . .}>
  1806           {any attributes with non-schema namespace . . .}>
  1726           Content: (annotation?, (element | group | choice | sequence | any)*)
  1807           Content: (annotation?, (element | group | choice | sequence | any)*)
  1727         </sequence>""",
  1808         </sequence>""",
  1728         "type": SYNTAXELEMENT,
  1809         "type": SYNTAXELEMENT,
  1729         "extract": {
  1810         "extract": {
  1730             "default": GenerateElement("sequence", ["id", "maxOccurs", "minOccurs"],
  1811             "default": GenerateElement(
       
  1812                 "sequence", ["id", "maxOccurs", "minOccurs"],
  1731                 re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)"))
  1813                 re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)"))
  1732         },
  1814         },
  1733         "reduce": ReduceSequence
  1815         "reduce": ReduceSequence
  1734     },
  1816     },
  1735 
  1817 
  1736     "simpleContent": {"struct": """
  1818     "simpleContent": {
       
  1819         "struct": """
  1737         <simpleContent
  1820         <simpleContent
  1738           id = ID
  1821           id = ID
  1739           {any attributes with non-schema namespace . . .}>
  1822           {any attributes with non-schema namespace . . .}>
  1740           Content: (annotation?, (restriction | extension))
  1823           Content: (annotation?, (restriction | extension))
  1741         </simpleContent>""",
  1824         </simpleContent>""",
  1742         "type": SYNTAXELEMENT,
  1825         "type": SYNTAXELEMENT,
  1743         "extract": {
  1826         "extract": {
  1744             "default": GenerateElement("simpleContent", ["id"],
  1827             "default": GenerateElement(
       
  1828                 "simpleContent", ["id"],
  1745                 re.compile("((?:annotation )?(?:restriction |extension ))"))
  1829                 re.compile("((?:annotation )?(?:restriction |extension ))"))
  1746         },
  1830         },
  1747         "reduce": ReduceSimpleContent
  1831         "reduce": ReduceSimpleContent
  1748     },
  1832     },
  1749 
  1833 
  1750     "simpleType": {"struct": """
  1834     "simpleType": {
       
  1835         "struct": """
  1751         <simpleType
  1836         <simpleType
  1752           final = (#all | List of (list | union | restriction))
  1837           final = (#all | List of (list | union | restriction))
  1753           id = ID
  1838           id = ID
  1754           name = NCName
  1839           name = NCName
  1755           {any attributes with non-schema namespace . . .}>
  1840           {any attributes with non-schema namespace . . .}>
  1756           Content: (annotation?, (restriction | list | union))
  1841           Content: (annotation?, (restriction | list | union))
  1757         </simpleType>""",
  1842         </simpleType>""",
  1758         "type": SYNTAXELEMENT,
  1843         "type": SYNTAXELEMENT,
  1759         "extract": {
  1844         "extract": {
  1760             "default": GenerateElement("simpleType", ["final", "id", "name"],
  1845             "default": GenerateElement(
       
  1846                 "simpleType", ["final", "id", "name"],
  1761                 re.compile("((?:annotation )?(?:restriction |list |union ))"))
  1847                 re.compile("((?:annotation )?(?:restriction |list |union ))"))
  1762         },
  1848         },
  1763         "reduce": ReduceSimpleType
  1849         "reduce": ReduceSimpleType
  1764     },
  1850     },
  1765 
  1851 
  1766     "totalDigits": {"struct": """
  1852     "totalDigits": {
       
  1853         "struct": """
  1767         <totalDigits
  1854         <totalDigits
  1768           fixed = boolean : false
  1855           fixed = boolean : false
  1769           id = ID
  1856           id = ID
  1770           value = positiveInteger
  1857           value = positiveInteger
  1771           {any attributes with non-schema namespace . . .}>
  1858           {any attributes with non-schema namespace . . .}>
  1772           Content: (annotation?)
  1859           Content: (annotation?)
  1773         </totalDigits>""",
  1860         </totalDigits>""",
  1774         "type": SYNTAXELEMENT,
  1861         "type": SYNTAXELEMENT,
  1775         "extract": {
  1862         "extract": {
  1776             "default": GenerateElement("totalDigits",
  1863             "default": GenerateElement(
  1777                 ["fixed", "id", "value"], ONLY_ANNOTATION),
  1864                 "totalDigits", ["fixed", "id", "value"], ONLY_ANNOTATION),
  1778         },
  1865         },
  1779         "reduce": GenerateFacetReducing("totalDigits", True)
  1866         "reduce": GenerateFacetReducing("totalDigits", True)
  1780     },
  1867     },
  1781 
  1868 
  1782     "union": {"struct": """
  1869     "union": {
       
  1870         "struct": """
  1783         <union
  1871         <union
  1784           id = ID
  1872           id = ID
  1785           memberTypes = List of QName
  1873           memberTypes = List of QName
  1786           {any attributes with non-schema namespace . . .}>
  1874           {any attributes with non-schema namespace . . .}>
  1787           Content: (annotation?, simpleType*)
  1875           Content: (annotation?, simpleType*)
  1788         </union>""",
  1876         </union>""",
  1789         "type": SYNTAXELEMENT,
  1877         "type": SYNTAXELEMENT,
  1790         "extract": {
  1878         "extract": {
  1791             "default": GenerateElement("union", ["id", "memberTypes"],
  1879             "default": GenerateElement(
       
  1880                 "union", ["id", "memberTypes"],
  1792                 re.compile("((?:annotation )?(?:simpleType )*)"))
  1881                 re.compile("((?:annotation )?(?:simpleType )*)"))
  1793         },
  1882         },
  1794         "reduce": ReduceUnion
  1883         "reduce": ReduceUnion
  1795     },
  1884     },
  1796 
  1885 
  1797     "unique": {"struct": """
  1886     "unique": {
       
  1887         "struct": """
  1798         <unique
  1888         <unique
  1799           id = ID
  1889           id = ID
  1800           name = NCName
  1890           name = NCName
  1801           {any attributes with non-schema namespace . . .}>
  1891           {any attributes with non-schema namespace . . .}>
  1802           Content: (annotation?, (selector, field+))
  1892           Content: (annotation?, (selector, field+))
  1803         </unique>""",
  1893         </unique>""",
  1804         "type": SYNTAXELEMENT,
  1894         "type": SYNTAXELEMENT,
  1805         "extract": {
  1895         "extract": {
  1806             "default": GenerateElement("unique", ["id", "name"],
  1896             "default": GenerateElement(
       
  1897                 "unique", ["id", "name"],
  1807                 re.compile("((?:annotation )?(?:selector |(?:field )+))"))
  1898                 re.compile("((?:annotation )?(?:selector |(?:field )+))"))
  1808         },
  1899         },
  1809         "reduce": ReduceUnique
  1900         "reduce": ReduceUnique
  1810     },
  1901     },
  1811 
  1902 
  1812     "whiteSpace": {"struct": """
  1903     "whiteSpace": {
       
  1904         "struct": """
  1813         <whiteSpace
  1905         <whiteSpace
  1814           fixed = boolean : false
  1906           fixed = boolean : false
  1815           id = ID
  1907           id = ID
  1816           value = (collapse | preserve | replace)
  1908           value = (collapse | preserve | replace)
  1817           {any attributes with non-schema namespace . . .}>
  1909           {any attributes with non-schema namespace . . .}>
  1818           Content: (annotation?)
  1910           Content: (annotation?)
  1819         </whiteSpace>""",
  1911         </whiteSpace>""",
  1820         "type": SYNTAXELEMENT,
  1912         "type": SYNTAXELEMENT,
  1821         "extract": {
  1913         "extract": {
  1822             "default": GenerateElement("whiteSpace",
  1914             "default": GenerateElement(
  1823                 ["fixed", "id", "value"], ONLY_ANNOTATION)
  1915                 "whiteSpace", ["fixed", "id", "value"], ONLY_ANNOTATION)
  1824         },
  1916         },
  1825         "reduce": GenerateFacetReducing("whiteSpace", True)
  1917         "reduce": GenerateFacetReducing("whiteSpace", True)
  1826     },
  1918     },
  1827 
  1919 
  1828 #-------------------------------------------------------------------------------
  1920 #-------------------------------------------------------------------------------
  1840     },
  1932     },
  1841 
  1933 
  1842     "attributeFormDefault": {
  1934     "attributeFormDefault": {
  1843         "type": SYNTAXATTRIBUTE,
  1935         "type": SYNTAXATTRIBUTE,
  1844         "extract": {
  1936         "extract": {
  1845             "default": GenerateEnumeratedExtraction("member attributeFormDefault", ["qualified", "unqualified"])
  1937             "default": GenerateEnumeratedExtraction(
       
  1938                 "member attributeFormDefault", ["qualified", "unqualified"])
  1846         },
  1939         },
  1847         "default": {
  1940         "default": {
  1848             "default": "unqualified"
  1941             "default": "unqualified"
  1849         }
  1942         }
  1850     },
  1943     },