* xmlSchemaInitTypes: * * Initialize the default XML Schemas type library * * Returns 0 on success, -1 on error. */
| 517 | * Returns 0 on success, -1 on error. |
| 518 | */ |
| 519 | int |
| 520 | xmlSchemaInitTypes(void) |
| 521 | { |
| 522 | if (xmlSchemaTypesInitialized != 0) |
| 523 | return (0); |
| 524 | xmlSchemaTypesBank = xmlHashCreate(40); |
| 525 | if (xmlSchemaTypesBank == NULL) { |
| 526 | xmlSchemaTypeErrMemory(); |
| 527 | goto error; |
| 528 | } |
| 529 | |
| 530 | /* |
| 531 | * 3.4.7 Built-in Complex Type Definition |
| 532 | */ |
| 533 | xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType", |
| 534 | XML_SCHEMAS_ANYTYPE, |
| 535 | NULL); |
| 536 | if (xmlSchemaTypeAnyTypeDef == NULL) |
| 537 | goto error; |
| 538 | xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef; |
| 539 | xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED; |
| 540 | /* |
| 541 | * Init the content type. |
| 542 | */ |
| 543 | xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED; |
| 544 | { |
| 545 | xmlSchemaParticlePtr particle; |
| 546 | xmlSchemaModelGroupPtr sequence; |
| 547 | xmlSchemaWildcardPtr wild; |
| 548 | /* First particle. */ |
| 549 | particle = xmlSchemaAddParticle(); |
| 550 | if (particle == NULL) |
| 551 | goto error; |
| 552 | xmlSchemaTypeAnyTypeDef->subtypes = (xmlSchemaTypePtr) particle; |
| 553 | /* Sequence model group. */ |
| 554 | sequence = (xmlSchemaModelGroupPtr) |
| 555 | xmlMalloc(sizeof(xmlSchemaModelGroup)); |
| 556 | if (sequence == NULL) { |
| 557 | xmlSchemaTypeErrMemory(); |
| 558 | goto error; |
| 559 | } |
| 560 | memset(sequence, 0, sizeof(xmlSchemaModelGroup)); |
| 561 | sequence->type = XML_SCHEMA_TYPE_SEQUENCE; |
| 562 | particle->children = (xmlSchemaTreeItemPtr) sequence; |
| 563 | /* Second particle. */ |
| 564 | particle = xmlSchemaAddParticle(); |
| 565 | if (particle == NULL) |
| 566 | goto error; |
| 567 | particle->minOccurs = 0; |
| 568 | particle->maxOccurs = UNBOUNDED; |
| 569 | sequence->children = (xmlSchemaTreeItemPtr) particle; |
| 570 | /* The wildcard */ |
| 571 | wild = (xmlSchemaWildcardPtr) xmlMalloc(sizeof(xmlSchemaWildcard)); |
| 572 | if (wild == NULL) { |
| 573 | xmlSchemaTypeErrMemory(); |
| 574 | goto error; |
| 575 | } |
| 576 | memset(wild, 0, sizeof(xmlSchemaWildcard)); |