| 20754 | } |
| 20755 | |
| 20756 | static int |
| 20757 | xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, |
| 20758 | xmlSchemaBucketPtr rootBucket) |
| 20759 | { |
| 20760 | xmlSchemaConstructionCtxtPtr con = pctxt->constructor; |
| 20761 | xmlSchemaTreeItemPtr item, *items; |
| 20762 | int nbItems, i, ret = 0; |
| 20763 | xmlSchemaBucketPtr oldbucket = con->bucket; |
| 20764 | xmlSchemaElementPtr elemDecl; |
| 20765 | |
| 20766 | #define FIXHFAILURE if (pctxt->err == XML_SCHEMAP_INTERNAL) goto exit_failure; |
| 20767 | |
| 20768 | if ((con->pending == NULL) || |
| 20769 | (con->pending->nbItems == 0)) |
| 20770 | return(0); |
| 20771 | |
| 20772 | /* |
| 20773 | * Since xmlSchemaFixupComplexType() will create new particles |
| 20774 | * (local components), and those particle components need a bucket |
| 20775 | * on the constructor, we'll assure here that the constructor has |
| 20776 | * a bucket. |
| 20777 | * TODO: Think about storing locals _only_ on the main bucket. |
| 20778 | */ |
| 20779 | if (con->bucket == NULL) |
| 20780 | con->bucket = rootBucket; |
| 20781 | |
| 20782 | /* TODO: |
| 20783 | * SPEC (src-redefine): |
| 20784 | * (6.2) "If it has no such self-reference, then all of the |
| 20785 | * following must be true:" |
| 20786 | |
| 20787 | * (6.2.2) The {model group} of the model group definition which |
| 20788 | * corresponds to it per XML Representation of Model Group |
| 20789 | * Definition Schema Components ($3.7.2) must be a `valid |
| 20790 | * restriction` of the {model group} of that model group definition |
| 20791 | * in I, as defined in Particle Valid (Restriction) ($3.9.6)." |
| 20792 | */ |
| 20793 | xmlSchemaCheckSRCRedefineFirst(pctxt); |
| 20794 | |
| 20795 | /* |
| 20796 | * Add global components to the schemata's hash tables. |
| 20797 | */ |
| 20798 | xmlSchemaAddComponents(pctxt, rootBucket); |
| 20799 | |
| 20800 | pctxt->ctxtType = NULL; |
| 20801 | items = (xmlSchemaTreeItemPtr *) con->pending->items; |
| 20802 | nbItems = con->pending->nbItems; |
| 20803 | /* |
| 20804 | * Now that we have parsed *all* the schema document(s) and converted |
| 20805 | * them to schema components, we can resolve references, apply component |
| 20806 | * constraints, create the FSA from the content model, etc. |
| 20807 | */ |
| 20808 | /* |
| 20809 | * Resolve references of.. |
| 20810 | * |
| 20811 | * 1. element declarations: |
| 20812 | * - the type definition |
| 20813 | * - the substitution group affiliation |
no test coverage detected