| 27940 | } |
| 27941 | |
| 27942 | static int |
| 27943 | xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { |
| 27944 | /* |
| 27945 | * Some initialization. |
| 27946 | */ |
| 27947 | vctxt->err = 0; |
| 27948 | vctxt->nberrors = 0; |
| 27949 | vctxt->depth = -1; |
| 27950 | vctxt->skipDepth = -1; |
| 27951 | vctxt->hasKeyrefs = 0; |
| 27952 | #ifdef ENABLE_IDC_NODE_TABLES_TEST |
| 27953 | vctxt->createIDCNodeTables = 1; |
| 27954 | #else |
| 27955 | vctxt->createIDCNodeTables = 0; |
| 27956 | #endif |
| 27957 | /* |
| 27958 | * Create a schema + parser if necessary. |
| 27959 | */ |
| 27960 | if (vctxt->schema == NULL) { |
| 27961 | xmlSchemaParserCtxtPtr pctxt; |
| 27962 | |
| 27963 | vctxt->xsiAssemble = 1; |
| 27964 | /* |
| 27965 | * If not schema was given then we will create a schema |
| 27966 | * dynamically using XSI schema locations. |
| 27967 | * |
| 27968 | * Create the schema parser context. |
| 27969 | */ |
| 27970 | if ((vctxt->pctxt == NULL) && |
| 27971 | (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1)) |
| 27972 | return (-1); |
| 27973 | pctxt = vctxt->pctxt; |
| 27974 | pctxt->xsiAssemble = 1; |
| 27975 | /* |
| 27976 | * Create the schema. |
| 27977 | */ |
| 27978 | vctxt->schema = xmlSchemaNewSchema(pctxt); |
| 27979 | if (vctxt->schema == NULL) |
| 27980 | return (-1); |
| 27981 | /* |
| 27982 | * Create the schema construction context. |
| 27983 | */ |
| 27984 | pctxt->constructor = xmlSchemaConstructionCtxtCreate(pctxt->dict); |
| 27985 | if (pctxt->constructor == NULL) |
| 27986 | return(-1); |
| 27987 | pctxt->constructor->mainSchema = vctxt->schema; |
| 27988 | /* |
| 27989 | * Take ownership of the constructor to be able to free it. |
| 27990 | */ |
| 27991 | pctxt->ownsConstructor = 1; |
| 27992 | } |
| 27993 | /* |
| 27994 | * Augment the IDC definitions for the main schema and all imported ones |
| 27995 | * NOTE: main schema if the first in the imported list |
| 27996 | */ |
| 27997 | xmlHashScan(vctxt->schema->schemasImports, xmlSchemaAugmentImportedIDC, |
| 27998 | vctxt); |
| 27999 |
no test coverage detected