Home | History | Annotate | Download | only in libxml2

Lines Matching defs:vctxt

623     xmlSchemaValidCtxtPtr vctxt;
1069 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt);
2035 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt;
2038 vctxt->nberrors++;
2039 vctxt->err = error;
2040 channel = vctxt->error;
2042 channel = vctxt->warning;
2044 schannel = vctxt->serror;
2045 data = vctxt->errCtxt;
2053 (vctxt->depth >= 0) &&
2054 (vctxt->inode != NULL)) {
2055 node = vctxt->inode->node;
2061 (vctxt->parserCtxt != NULL) &&
2062 (vctxt->parserCtxt->input != NULL)) {
2063 file = vctxt->parserCtxt->input->filename;
2064 line = vctxt->parserCtxt->input->line;
2075 if (vctxt->doc != NULL)
2076 file = (const char *) vctxt->doc->URL;
2077 else if ((vctxt->parserCtxt != NULL) &&
2078 (vctxt->parserCtxt->input != NULL))
2079 file = vctxt->parserCtxt->input->filename;
2197 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) actxt;
2201 if (vctxt->inode->nodeType == XML_ATTRIBUTE_NODE) {
2203 vctxt->elemInfos[vctxt->depth];
2215 vctxt->inode->nsName, vctxt->inode->localName));
2359 xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt,
2372 xmlSchemaErr4Line(ACTXT_CAST vctxt, XML_ERR_ERROR,
2375 vctxt->nodeQNames->items[idcNode->nodeQNameID +1],
2376 vctxt->nodeQNames->items[idcNode->nodeQNameID]),
2731 xmlSchemaCustomErr(ACTXT_CAST vctxt, err, NULL, type, msg, NULL, NULL);
2733 #define VERROR_INT(func, msg) xmlSchemaInternalErr(ACTXT_CAST vctxt, func, msg);
4512 * @vctxt: the WXS validation context
9967 xmlSchemaCreatePCtxtOnVCtxt(xmlSchemaValidCtxtPtr vctxt)
9969 if (vctxt->pctxt == NULL) {
9970 if (vctxt->schema != NULL)
9971 vctxt->pctxt =
9972 xmlSchemaNewParserCtxtUseDict("*", vctxt->schema->dict);
9974 vctxt->pctxt = xmlSchemaNewParserCtxt("*");
9975 if (vctxt->pctxt == NULL) {
9981 xmlSchemaSetParserErrors(vctxt->pctxt, vctxt->error,
9982 vctxt->warning, vctxt->errCtxt);
9983 xmlSchemaSetParserStructuredErrors(vctxt->pctxt, vctxt->serror,
9984 vctxt->errCtxt);
12508 if (ctxt->vctxt != NULL) {
12509 xmlSchemaFreeValidCtxt(ctxt->vctxt);
15729 if (ctxt->vctxt == NULL) {
15730 ctxt->vctxt = xmlSchemaNewValidCtxt(NULL);
15731 if (ctxt->vctxt == NULL) {
15740 xmlSchemaSetValidErrors(ctxt->vctxt,
15742 xmlSchemaSetValidStructuredErrors(ctxt->vctxt,
18824 if (pctxt->vctxt == NULL) {
18828 pctxt->vctxt->schema = pctxt->schema;
18834 pctxt->vctxt->schema = NULL;
21397 if (ctxt->vctxt != NULL)
21398 xmlSchemaSetValidErrors(ctxt->vctxt, err, warn, ctx);
21418 if (ctxt->vctxt != NULL)
21419 xmlSchemaSetValidStructuredErrors(ctxt->vctxt, serror, ctx);
21551 * @vctxt: a schema validation context
21563 xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt,
21573 if ((vctxt == NULL) || (schema == NULL))
21576 if (vctxt->pctxt == NULL) {
21581 pctxt = vctxt->pctxt;
21606 xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC,
21654 if ((ret != 0) && (vctxt->err == 0))
21655 vctxt->err = ret;
21656 vctxt->nberrors += pctxt->nberrors;
21659 vctxt->nberrors += pctxt->nberrors;
21669 xmlSchemaGetMetaAttrInfo(xmlSchemaValidCtxtPtr vctxt,
21672 if (vctxt->nbAttrInfos == 0)
21678 for (i = 0; i < vctxt->nbAttrInfos; i++) {
21679 iattr = vctxt->attrInfos[i];
21690 * @vctxt: a schema validation context
21701 xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
21717 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
21720 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
21741 nsname = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
21760 xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC,
21768 location = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
21770 ret = xmlSchemaAssembleByLocation(vctxt, vctxt->schema,
21782 xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt,
21785 if (vctxt->sax != NULL) {
21789 for (i = vctxt->depth; i >= 0; i--) {
21790 if (vctxt->elemInfos[i]->nbNsBindings != 0) {
21791 inode = vctxt->elemInfos[i];
21809 } else if (vctxt->reader != NULL) {
21812 nsName = xmlTextReaderLookupNamespace(vctxt->reader, prefix);
21816 ret = xmlDictLookup(vctxt->dict, nsName, -1);
21825 if ((vctxt->inode->node == NULL) ||
21826 (vctxt->inode->node->doc == NULL)) {
21831 ns = xmlSearchNs(vctxt->inode->node->doc,
21832 vctxt->inode->node, prefix);
21843 xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt,
21852 if (vctxt && (vctxt->schema == NULL)) {
21868 if (vctxt != NULL)
21869 nsName = xmlSchemaLookupNamespace(vctxt, BAD_CAST prefix);
21911 xmlSchemaVAddNodeQName(xmlSchemaValidCtxtPtr vctxt,
21917 lname = xmlDictLookup(vctxt->dict, lname, -1);
21921 nsname = xmlDictLookup(vctxt->dict, nsname, -1);
21925 for (i = 0; i < vctxt->nodeQNames->nbItems; i += 2) {
21926 if ((vctxt->nodeQNames->items [i] == lname) &&
21927 (vctxt->nodeQNames->items[i +1] == nsname))
21932 i = vctxt->nodeQNames->nbItems;
21933 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) lname);
21934 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) nsname);
21954 xmlSchemaValidCtxtPtr vctxt)
21960 xmlSchemaVErrMemory(vctxt,
21968 if (vctxt->aidcs == NULL)
21969 vctxt->aidcs = aidc;
21971 aidc->next = vctxt->aidcs;
21972 vctxt->aidcs = aidc;
21977 if ((vctxt->hasKeyrefs == 0) &&
21979 vctxt->hasKeyrefs = 1;
21989 xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt) {
21992 (xmlHashScanner) xmlSchemaAugmentIDC, vctxt);
22023 * @vctxt: the WXS validation context
22033 xmlSchemaIDCStoreNodeTableItem(xmlSchemaValidCtxtPtr vctxt,
22039 if (vctxt->idcNodes == NULL) {
22040 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *)
22042 if (vctxt->idcNodes == NULL) {
22043 xmlSchemaVErrMemory(vctxt,
22047 vctxt->sizeIdcNodes = 20;
22048 } else if (vctxt->sizeIdcNodes <= vctxt->nbIdcNodes) {
22049 vctxt->sizeIdcNodes *= 2;
22050 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *)
22051 xmlRealloc(vctxt->idcNodes, vctxt->sizeIdcNodes *
22053 if (vctxt->idcNodes == NULL) {
22054 xmlSchemaVErrMemory(vctxt,
22059 vctxt->idcNodes[vctxt->nbIdcNodes++] = item;
22066 * @vctxt: the WXS validation context
22074 xmlSchemaIDCStoreKey(xmlSchemaValidCtxtPtr vctxt,
22080 if (vctxt->idcKeys == NULL) {
22081 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *)
22083 if (vctxt->idcKeys == NULL) {
22084 xmlSchemaVErrMemory(vctxt,
22088 vctxt->sizeIdcKeys = 40;
22089 } else if (vctxt->sizeIdcKeys <= vctxt->nbIdcKeys) {
22090 vctxt->sizeIdcKeys *= 2;
22091 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *)
22092 xmlRealloc(vctxt->idcKeys, vctxt->sizeIdcKeys *
22094 if (vctxt->idcKeys == NULL) {
22095 xmlSchemaVErrMemory(vctxt,
22100 vctxt->idcKeys[vctxt->nbIdcKeys++] = key;
22144 * @vctxt: the WXS validation context
22154 xmlSchemaIDCAcquireBinding(xmlSchemaValidCtxtPtr vctxt,
22159 ielem = vctxt->elemInfos[matcher->depth];
22186 xmlSchemaIDCAcquireTargetList(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED,
22287 * @vctxt: the WXS validation context
22293 xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt,
22334 if (vctxt->idcMatcherCache != NULL)
22335 matcher->nextCached = vctxt->idcMatcherCache;
22336 vctxt->idcMatcherCache = matcher;
22344 * @vctxt: the WXS validation context
22357 xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt,
22367 if (vctxt->xpathStatePool != NULL) {
22368 sto = vctxt->xpathStatePool;
22369 vctxt->xpathStatePool = sto->next;
22386 if (vctxt->xpathStates != NULL)
22387 sto->next = vctxt->xpathStates;
22388 vctxt->xpathStates = sto;
22407 sto->depth = vctxt->depth;
22421 * @vctxt: the WXS validation context
22430 xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt,
22434 int res, resolved = 0, depth = vctxt->depth;
22436 if (vctxt->xpathStates == NULL)
22446 xmlSchemaFormatQName(&str, vctxt->inode->nsName,
22447 vctxt->inode->localName), depth, nodeType);
22454 first = vctxt->xpathStates;
22467 vctxt->inode->localName, vctxt->inode->nsName);
22470 vctxt->inode->localName, vctxt->inode->nsName);
22511 vctxt->depth);
22526 if (xmlSchemaIDCAddStateObject(vctxt, sto->matcher,
22544 if ((vctxt->inode->flags &
22546 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED;
22556 sto = vctxt->xpathStates;
22564 xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt,
22601 * @vctxt: the WXS validation context
22608 xmlSchemaXPathPop(xmlSchemaValidCtxtPtr vctxt)
22613 if (vctxt->xpathStates == NULL)
22615 sto = vctxt->xpathStates;
22627 * @vctxt: the WXS validation context
22637 xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
22643 xmlSchemaTypePtr type = vctxt->inode->typeDef, simpleType = NULL;
22645 if (vctxt->xpathStates == NULL)
22647 sto = vctxt->xpathStates;
22654 xmlSchemaFormatQName(&str, vctxt->inode->nsName,
22655 vctxt->inode->localName), vctxt->depth);
22715 xmlSchemaCustomErr(ACTXT_CAST vctxt,
22727 if ((key == NULL) && (vctxt->inode->val == NULL)) {
22824 xmlSchemaCustomErr(ACTXT_CAST vctxt,
22870 key->val = vctxt->inode->val;
22871 vctxt->inode->val = NULL;
22875 if (xmlSchemaIDCStoreKey(vctxt, key) == -1) {
22954 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
22956 targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher);
22996 xmlSchemaCustomErr(ACTXT_CAST vctxt,
23000 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23026 if (xmlSchemaIDCStoreNodeTableItem(vctxt, ntItem) == -1) {
23038 ntItem->nodeQNameID = xmlSchemaVAddNodeQName(vctxt,
23039 vctxt->inode->localName, vctxt->inode->nsName);
23051 ntItem->node = vctxt->node;
23052 ntItem->nodeLine = vctxt->inode->nodeLine;
23080 xmlSchemaCustomErr(ACTXT_CAST vctxt,
23108 if (vctxt->xpathStates != sto) {
23117 vctxt->xpathStates = sto->next;
23118 sto->next = vctxt->xpathStatePool;
23122 vctxt->xpathStatePool = sto;
23132 * @vctxt: the WXS validation context
23141 xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt,
23157 (char *) xmlSchemaFormatQName(&str, vctxt->inode->nsName,
23158 vctxt->inode->localName), vctxt->depth);
23162 if (vctxt->inode->idcMatchers != NULL) {
23181 vctxt->inode->hasKeyrefs = 1;
23185 aidc = vctxt->aidcs;
23198 (vctxt->depth < aidc->keyrefDepth))
23199 aidc->keyrefDepth = vctxt->depth;
23205 aidc = vctxt->aidcs;
23219 if (vctxt->idcMatcherCache != NULL) {
23223 matcher = vctxt->idcMatcherCache;
23224 vctxt->idcMatcherCache = matcher->nextCached;
23230 xmlSchemaVErrMemory(vctxt,
23237 vctxt->inode->idcMatchers = matcher;
23243 matcher->depth = vctxt->depth;
23252 if (xmlSchemaIDCAddStateObject(vctxt, matcher,
23262 xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt,
23271 /* vctxt->createIDCNodeTables */
23286 if ((! vctxt->createIDCNodeTables) &&
23288 (matcher->aidc->keyrefDepth > vctxt->depth)))
23296 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
23458 xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt)
23466 bind = vctxt->inode->idcTable;
23472 parTable = &(vctxt->elemInfos[vctxt->depth -1]->idcTable);
23484 if (! vctxt->createIDCNodeTables) {
23485 aidc = vctxt->aidcs;
23489 (aidc->keyrefDepth >= vctxt->depth)) {
23684 if (! vctxt->psviExposeIDCNodeTables) {
23747 * @vctxt: the WXS validation context
23753 xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt)
23758 matcher = vctxt->inode->idcMatchers;
23776 bind = vctxt->inode->idcTable;
23831 xmlSchemaKeyrefErr(vctxt,
23836 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23850 xmlSchemaKeyrefErr(vctxt,
23854 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23875 xmlSchemaGetFreshAttrInfo(xmlSchemaValidCtxtPtr vctxt)
23881 if (vctxt->attrInfos == NULL) {
23882 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *)
23884 vctxt->sizeAttrInfos = 1;
23885 if (vctxt->attrInfos == NULL) {
23886 xmlSchemaVErrMemory(vctxt,
23890 } else if (vctxt->sizeAttrInfos <= vctxt->nbAttrInfos) {
23891 vctxt->sizeAttrInfos++;
23892 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *)
23893 xmlRealloc(vctxt->attrInfos,
23894 vctxt->sizeAttrInfos * sizeof(xmlSchemaAttrInfoPtr));
23895 if (vctxt->attrInfos == NULL) {
23896 xmlSchemaVErrMemory(vctxt,
23901 iattr = vctxt->attrInfos[vctxt->nbAttrInfos++];
23916 xmlSchemaVErrMemory(vctxt, "creating new attribute info", NULL);
23921 vctxt->attrInfos[vctxt->nbAttrInfos++] = iattr;
23927 xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt,
23938 attr = xmlSchemaGetFreshAttrInfo(vctxt);
23985 * @vctxt: the WXS validation context
23989 xmlSchemaClearElemInfo(xmlSchemaValidCtxtPtr vctxt,
24019 xmlSchemaIDCReleaseMatcherList(vctxt, ielem->idcMatchers);
24046 * @vctxt: the schema validation context
24054 xmlSchemaGetFreshElemInfo(xmlSchemaValidCtxtPtr vctxt)
24058 if (vctxt->depth > vctxt->sizeElemInfos) {
24063 if (vctxt->elemInfos == NULL) {
24064 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *)
24066 if (vctxt->elemInfos == NULL) {
24067 xmlSchemaVErrMemory(vctxt,
24071 memset(vctxt->elemInfos, 0, 10 * sizeof(xmlSchemaNodeInfoPtr));
24072 vctxt->sizeElemInfos = 10;
24073 } else if (vctxt->sizeElemInfos <= vctxt->depth) {
24074 int i = vctxt->sizeElemInfos;
24076 vctxt->sizeElemInfos *= 2;
24077 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *)
24078 xmlRealloc(vctxt->elemInfos, vctxt->sizeElemInfos *
24080 if (vctxt->elemInfos == NULL) {
24081 xmlSchemaVErrMemory(vctxt,
24089 for (; i < vctxt->sizeElemInfos; i++)
24090 vctxt->elemInfos[i] = NULL;
24092 info = vctxt->elemInfos[vctxt->depth];
24098 xmlSchemaVErrMemory(vctxt,
24102 vctxt->elemInfos[vctxt->depth] = info;
24112 info->depth = vctxt->depth;
24117 #define ACTIVATE_ATTRIBUTE(item) vctxt->inode = (xmlSchemaNodeInfoPtr) item;
24118 #define ACTIVATE_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth];
24119 #define ACTIVATE_PARENT_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth -1];
24371 xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt,
24401 nsName = xmlSchemaLookupNamespace(vctxt, prefix);
24411 xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL,
24779 xmlSchemaVExpandQName(xmlSchemaValidCtxtPtr vctxt,
24795 xmlSchemaSimpleTypeErr(ACTXT_CAST vctxt,
24810 *localName = xmlDictLookup(vctxt->dict, value, -1);
24812 *localName = xmlDictLookup(vctxt->dict, local, -1);
24816 *nsName = xmlSchemaLookupNamespace(vctxt, prefix);
24824 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24838 xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt,
24867 ret = xmlSchemaVExpandQName(vctxt, iattr->value,
24882 *localType = xmlSchemaGetType(vctxt->schema, local, nsName);
24886 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24893 ret = vctxt->err;
24935 * if ((vctxt->pctxt == NULL) &&
24936 * (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
24940 if (xmlSchemaCheckCOSDerivedOK(ACTXT_CAST vctxt, *localType,
24944 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24954 ret = vctxt->err;
24968 xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt)
24970 xmlSchemaElementPtr elemDecl = vctxt->inode->decl;
24979 return (vctxt->err);
24988 return (vctxt->err);
24995 if (vctxt->nbAttrInfos != 0) {
25002 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25010 ACTXT_CAST vctxt, NULL,
25041 vctxt->inode->flags |=
25051 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25056 ret = xmlSchemaProcessXSIType(vctxt, iattr, &localType,
25068 vctxt->inode->flags |= XML_SCHEMA_ELEM_INFO_LOCAL_TYPE;
25077 (xmlSchemaIDCRegisterMatchers(vctxt, elemDecl) == -1))
25090 vctxt->inode->typeDef = actualType;
25096 xmlSchemaVAttributesSimple(xmlSchemaValidCtxtPtr vctxt)
25108 if (vctxt->nbAttrInfos == 0)
25110 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25111 iattr = vctxt->attrInfos[i];
25114 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25127 xmlSchemaClearAttrInfos(xmlSchemaValidCtxtPtr vctxt)
25132 if (vctxt->nbAttrInfos == 0)
25134 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25135 attr = vctxt->attrInfos[i];
25152 vctxt->nbAttrInfos = 0;
25166 xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt)
25168 xmlSchemaTypePtr type = vctxt->inode->typeDef;
25200 nbAttrs = vctxt->nbAttrInfos;
25210 iattr = vctxt->attrInfos[j];
25263 tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt);
25279 tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt);
25295 if (vctxt->nbAttrInfos == 0)
25306 iattr = vctxt->attrInfos[i];
25349 iattr->decl = xmlSchemaGetAttributeDecl(vctxt->schema,
25415 if (vctxt->nbAttrInfos == 0)
25422 if (vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) {
25423 xmlSchemaNodeInfoPtr ielem = vctxt->elemInfos[vctxt->depth];
25430 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25431 iattr = vctxt->attrInfos[i];
25452 if (vctxt->xpathStates != NULL) {
25456 xpathRes = xmlSchemaXPathEvaluate(vctxt,
25551 ns = xmlNewNs(vctxt->validationRoot,
25573 if (vctxt->value != NULL) {
25577 xmlSchemaFreeValue(vctxt->value);
25578 vctxt->value = NULL;
25605 ACTXT_CAST vctxt,
25610 ACTXT_CAST vctxt,
25692 if (xmlSchemaXPathProcessHistory(vctxt,
25693 vctxt->depth +1) == -1) {
25698 } else if (vctxt->xpathStates != NULL)
25699 xmlSchemaXPathPop(vctxt);
25705 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25706 iattr = vctxt->attrInfos[i];
25717 xmlSchemaCustomErr(ACTXT_CAST vctxt,
25732 xmlSchemaCustomErr(ACTXT_CAST vctxt,
25751 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25754 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25771 xmlSchemaValidateElemWildcard(xmlSchemaValidCtxtPtr vctxt,
25774 xmlSchemaWildcardPtr wild = (xmlSchemaWildcardPtr) vctxt->inode->decl;
25797 decl = xmlSchemaGetElem(vctxt->schema,
25798 vctxt->inode->localName, vctxt->inode->nsName);
25800 vctxt->inode->decl = decl;
25809 return (vctxt->err);
25811 if (vctxt->nbAttrInfos != 0) {
25819 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25822 if (xmlSchemaProcessXSIType(vctxt, iattr,
25823 &(vctxt->inode->typeDef), NULL) == -1) {
25840 vctxt->inode->typeDef =
25853 xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt,
25858 xmlSchemaNodeInfoPtr inode = vctxt->inode;
25901 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25906 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25917 xmlSchemaVContentModelCallback(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED,
25945 xmlSchemaValidatorPushElem(xmlSchemaValidCtxtPtr vctxt)
25947 vctxt->inode = xmlSchemaGetFreshElemInfo(vctxt);
25948 if (vctxt->inode == NULL) {
25953 vctxt->nbAttrInfos = 0;
25958 xmlSchemaVCheckINodeDataType(xmlSchemaValidCtxtPtr vctxt,
25965 ACTXT_CAST vctxt, NULL,
25969 ACTXT_CAST vctxt, NULL,
25979 xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
25982 xmlSchemaNodeInfoPtr inode = vctxt->inode;
25984 if (vctxt->nbAttrInfos != 0)
25985 xmlSchemaClearAttrInfos(vctxt);
25992 vctxt->skipDepth = vctxt->depth -1;
26027 vctxt);
26052 xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
26080 if (vctxt->value != NULL) {
26081 xmlSchemaFreeValue(vctxt->value);
26082 vctxt->value = NULL;
26092 ret = xmlSchemaVCheckINodeDataType(vctxt,
26095 ret = xmlSchemaVCheckINodeDataType(vctxt,
26134 ret = xmlSchemaCheckCOSValidDefault(vctxt,
26159 ret = xmlSchemaVCheckINodeDataType(vctxt,
26162 ret = xmlSchemaVCheckINodeDataType(vctxt,
26179 if ((vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) &&
26216 ret = xmlSchemaVCheckINodeDataType(vctxt,
26231 ret = xmlSchemaVCheckINodeDataType(vctxt,
26287 xmlSchemaCustomErr(ACTXT_CAST vctxt,
26310 xmlSchemaCustomErr(ACTXT_CAST vctxt,
26324 if (vctxt->depth < 0) {
26328 if (vctxt->depth == vctxt->skipDepth)
26329 vctxt->skipDepth = -1;
26334 (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1))
26353 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables))
26355 if (xmlSchemaIDCFillNodeTables(vctxt, inode) == -1)
26361 if (vctxt->inode->hasKeyrefs)
26362 if (xmlSchemaCheckCVCIDCKeyRef(vctxt) == -1)
26374 if ((vctxt->depth > 0) &&
26375 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables))
26380 if (xmlSchemaBubbleIDCNodeTables(vctxt) == -1)
26389 xmlSchemaClearElemInfo(vctxt, inode);
26393 if (vctxt->depth == 0) {
26394 vctxt->depth--;
26395 vctxt->inode = NULL;
26401 if (vctxt->aidcs != NULL) {
26402 xmlSchemaIDCAugPtr aidc = vctxt->aidcs;
26404 if (aidc->keyrefDepth == vctxt->depth) {
26415 vctxt->depth--;
26416 vctxt->inode = vctxt->elemInfos[vctxt->depth];
26424 vctxt->err = -1;
26433 xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt)
26439 if (vctxt->depth <= 0) {
26444 pielem = vctxt->elemInfos[vctxt->depth -1];
26471 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
26472 vctxt->inode->localName,
26473 vctxt->inode->nsName);
26475 if (vctxt->inode->decl == NULL) {
26481 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
26484 ret = xmlSchemaProcessXSIType(vctxt, iattr,
26485 &(vctxt->inode->typeDef), NULL);
26506 vctxt->inode->typeDef =
26559 vctxt);
26581 vctxt->inode->localName,
26582 vctxt->inode->nsName,
26583 vctxt->inode);
26588 vctxt->inode->localName, pielem->localName);
26592 vctxt->inode->localName, pielem->localName);
26594 if (vctxt->err == XML_SCHEMAV_INTERNAL) {
26602 xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
26606 ret = vctxt->err;
26635 ret = vctxt->err;
26648 vctxt->skipDepth = vctxt->depth;
26649 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_NOT_EXPECTED;
26659 xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt,
26674 if (INODE_NILLED(vctxt->inode)) {
26683 return (vctxt->err);
26690 if (vctxt->inode->typeDef->contentType ==
26695 return (vctxt->err);
26698 if (vctxt->inode->typeDef->contentType ==
26713 return (vctxt->err);
26725 if ((vctxt->inode->typeDef->contentType == XML_SCHEMA_CONTENT_MIXED) &&
26726 ((vctxt->inode->decl == NULL) ||
26727 (vctxt->inode->decl->value == NULL)))
26730 if (vctxt->inode->value == NULL) {
26739 vctxt->inode->value = value;
26746 vctxt->inode->value = value;
26749 vctxt->inode->flags |=
26758 vctxt->inode->value = BAD_CAST xmlStrndup(value, len);
26760 vctxt->inode->value = BAD_CAST xmlStrdup(value);
26761 vctxt->inode->flags |=
26773 if (vctxt->inode->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) {
26774 vctxt->inode->value = BAD_CAST xmlStrncat(
26775 (xmlChar *) vctxt->inode->value, value, len);
26777 vctxt->inode->value =
26778 BAD_CAST xmlStrncatNew(vctxt->inode->value, value, len);
26779 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES;
26787 xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt)
26791 if ((vctxt->skipDepth != -1) &&
26792 (vctxt->depth >= vctxt->skipDepth)) {
26797 if (vctxt->xsiAssemble) {
26808 ret = xmlSchemaAssembleByXSI(vctxt);
26812 vctxt->skipDepth = 0;
26819 xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt);
26821 if (vctxt->depth > 0) {
26826 ret = xmlSchemaValidateChildElem(vctxt);
26835 if (vctxt->depth == vctxt->skipDepth)
26837 if ((vctxt->inode->decl == NULL) &&
26838 (vctxt->inode->typeDef == NULL)) {
26848 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
26849 vctxt->inode->localName,
26850 vctxt->inode->nsName);
26851 if (vctxt->inode->decl == NULL) {
26860 if (vctxt->inode->decl == NULL)
26863 if (vctxt->inode->decl->type == XML_SCHEMA_TYPE_ANY) {
26868 ret = xmlSchemaValidateElemWildcard(vctxt, &skip);
26878 vctxt->skipDepth = vctxt->depth;
26885 if (vctxt->inode->decl->type != XML_SCHEMA_TYPE_ELEMENT) {
26889 vctxt->inode->decl = NULL;
26896 ret = xmlSchemaValidateElemDecl(vctxt);
26910 if (vctxt->inode->typeDef == NULL) {
26911 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26917 if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) {
26918 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26929 if (vctxt->xpathStates != NULL) {
26930 ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE);
26931 vctxt->inode->appliedXPath = 1;
26941 if (WXS_IS_COMPLEX(vctxt->inode->typeDef)) {
26942 if ((vctxt->nbAttrInfos != 0) ||
26943 (vctxt->inode->typeDef->attrUses != NULL)) {
26945 ret = xmlSchemaVAttributesComplex(vctxt);
26947 } else if (vctxt->nbAttrInfos != 0) {
26949 ret = xmlSchemaVAttributesSimple(vctxt);
26954 if (vctxt->nbAttrInfos != 0)
26955 xmlSchemaClearAttrInfos(vctxt);
26968 vctxt->skipDepth = vctxt->depth;
26976 xmlSchemaVReaderWalk(xmlSchemaValidCtxtPtr vctxt)
26982 vctxt->depth = -1;
26983 ret = xmlTextReaderRead(vctxt->reader);
26988 nodeType = xmlTextReaderNodeType(vctxt->reader);
26991 ret = xmlTextReaderRead(vctxt->reader);
26998 depth = xmlTextReaderDepth(vctxt->reader);
26999 nodeType = xmlTextReaderNodeType(vctxt->reader);
27003 vctxt->depth++;
27004 if (xmlSchemaValidatorPushElem(vctxt) == -1) {
27009 ielem = vctxt->inode;
27010 ielem->localName = xmlTextReaderLocalName(vctxt->reader);
27011 ielem->nsName = xmlTextReaderNamespaceUri(vctxt->reader);
27016 ret = xmlTextReaderIsEmptyElement(vctxt->reader);
27028 vctxt->nbAttrInfos = 0;
27029 ret = xmlTextReaderMoveToFirstAttribute(vctxt->reader);
27041 if (xmlSchemaValidatorPushAttribute(vctxt, NULL,
27042 (const xmlChar *) xmlTextReaderLocalName(vctxt->reader),
27043 xmlTextReaderNamespaceUri(vctxt->reader), 1,
27044 xmlTextReaderValue(vctxt->reader), 1) == -1) {
27050 ret = xmlTextReaderMoveToNextAttribute(vctxt->reader);
27060 ret = xmlTextReaderMoveToElement(vctxt->reader);
27070 ret= xmlSchemaValidateElem(vctxt);
27079 if (vctxt->depth == vctxt->skipDepth) {
27085 ret = xmlTextReaderRead(vctxt->reader);
27086 curDepth = xmlTextReaderDepth(vctxt->reader);
27088 ret = xmlTextReaderRead(vctxt->reader);
27089 curDepth = xmlTextReaderDepth(vctxt->reader);
27112 ret = xmlSchemaValidatorPopElem(vctxt);
27121 if (vctxt->depth >= 0)
27122 ielem = vctxt->inode;
27137 value = xmlTextReaderValue(vctxt->reader);
27138 ret = xmlSchemaVPushText(vctxt, nodeType, BAD_CAST value,
27157 ret = xmlTextReaderRead(vctxt->reader);
27181 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27183 if (vctxt->depth < 0)
27185 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27187 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY)
27188 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY;
27189 if (xmlSchemaVPushText(vctxt, XML_TEXT_NODE, ch, len,
27193 vctxt->err = -1;
27194 xmlStopParser(vctxt->parserCtxt);
27206 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27208 if (vctxt->depth < 0)
27210 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27212 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY)
27213 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY;
27214 if (xmlSchemaVPushText(vctxt, XML_CDATA_SECTION_NODE, ch, len,
27218 vctxt->err = -1;
27219 xmlStopParser(vctxt->parserCtxt);
27227 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27229 if (vctxt->depth < 0)
27231 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27248 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27259 vctxt->depth++;
27260 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27265 if (xmlSchemaValidatorPushElem(vctxt) == -1) {
27270 ielem = vctxt->inode;
27274 ielem->nodeLine = xmlSAX2GetLineNumber(vctxt->parserCtxt);
27295 xmlSchemaVErrMemory(vctxt,
27309 xmlSchemaVErrMemory(vctxt,
27345 ret = xmlSchemaValidatorPushAttribute(vctxt,
27358 ret = xmlSchemaValidateElem(vctxt);
27371 vctxt->err = -1;
27372 xmlStopParser(vctxt->parserCtxt);
27382 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27388 if (vctxt->skipDepth != -1) {
27389 if (vctxt->depth > vctxt->skipDepth) {
27390 vctxt->depth--;
27393 vctxt->skipDepth = -1;
27398 if ((!xmlStrEqual(vctxt->inode->localName, localname)) ||
27399 (!xmlStrEqual(vctxt->inode->nsName, URI))) {
27403 res = xmlSchemaValidatorPopElem(vctxt);
27415 vctxt->err = -1;
27416 xmlStopParser(vctxt->parserCtxt);
27460 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
27462 if (vctxt == NULL)
27470 vctxt->flags = 0;
27471 vctxt->validationRoot = NULL;
27472 vctxt->doc = NULL;
27474 vctxt->reader = NULL;
27476 vctxt->hasKeyrefs = 0;
27478 if (vctxt->value != NULL) {
27479 xmlSchemaFreeValue(vctxt->value);
27480 vctxt->value = NULL;
27485 if (vctxt->aidcs != NULL) {
27486 xmlSchemaIDCAugPtr cur = vctxt->aidcs, next;
27492 vctxt->aidcs = NULL;
27494 if (vctxt->idcMatcherCache != NULL) {
27495 xmlSchemaIDCMatcherPtr matcher = vctxt->idcMatcherCache, tmp;
27502 vctxt->idcMatcherCache = NULL;
27506 if (vctxt->idcNodes != NULL) {
27510 for (i = 0; i < vctxt->nbIdcNodes; i++) {
27511 item = vctxt->idcNodes[i];
27515 xmlFree(vctxt->idcNodes);
27516 vctxt->idcNodes = NULL;
27517 vctxt->nbIdcNodes = 0;
27518 vctxt->sizeIdcNodes = 0;
27523 if (vctxt->xpathStates != NULL) {
27524 xmlSchemaFreeIDCStateObjList(vctxt->xpathStates);
27525 vctxt->xpathStates = NULL;
27530 if (vctxt->nbAttrInfos != 0) {
27531 xmlSchemaClearAttrInfos(vctxt);
27536 if (vctxt->elemInfos != NULL) {
27540 for (i = 0; i < vctxt->sizeElemInfos; i++) {
27541 ei = vctxt->elemInfos[i];
27544 xmlSchemaClearElemInfo(vctxt, ei);
27547 xmlSchemaItemListClear(vctxt->nodeQNames);
27549 xmlDictFree(vctxt->dict);
27554 vctxt->dict = xmlDictCreate();
27785 xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
27794 valRoot = xmlDocGetRootElement(vctxt->doc);
27800 vctxt->depth = -1;
27801 vctxt->validationRoot = valRoot;
27804 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27811 vctxt->depth++;
27812 if (xmlSchemaValidatorPushElem(vctxt) == -1)
27814 ielem = vctxt->inode;
27826 vctxt->nbAttrInfos = 0;
27834 ret = xmlSchemaValidatorPushAttribute(vctxt,
27854 ret = xmlSchemaValidateElem(vctxt);
27867 if ((vctxt->skipDepth != -1) &&
27868 (vctxt->depth >= vctxt->skipDepth))
27877 ret = xmlSchemaVPushText(vctxt, node->type, node->content,
27917 if (node != vctxt->inode->node) {
27922 ret = xmlSchemaValidatorPopElem(vctxt);
27949 xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) {
27953 vctxt->err = 0;
27954 vctxt->nberrors = 0;
27955 vctxt->depth = -1;
27956 vctxt->skipDepth = -1;
27957 vctxt->xsiAssemble = 0;
27958 vctxt->hasKeyrefs = 0;
27960 vctxt->createIDCNodeTables = 1;
27962 vctxt->createIDCNodeTables = 0;
27967 if (vctxt->schema == NULL) {
27970 vctxt->xsiAssemble = 1;
27977 if ((vctxt->pctxt == NULL) &&
27978 (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
27980 pctxt = vctxt->pctxt;
27985 vctxt->schema = xmlSchemaNewSchema(pctxt);
27986 if (vctxt->schema == NULL)
27994 pctxt->constructor->mainSchema = vctxt->schema;
28004 xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt);
28010 xmlSchemaPostRun(xmlSchemaValidCtxtPtr vctxt) {
28011 if (vctxt->xsiAssemble) {
28012 if (vctxt->schema != NULL) {
28013 xmlSchemaFree(vctxt->schema);
28014 vctxt->schema = NULL;
28017 xmlSchemaClearValidCtxt(vctxt);
28021 xmlSchemaVStart(xmlSchemaValidCtxtPtr vctxt)
28025 if (xmlSchemaPreRun(vctxt) < 0)
28028 if (vctxt->doc != NULL) {
28032 ret = xmlSchemaVDocWalk(vctxt);
28034 } else if (vctxt->reader != NULL) {
28039 ret = xmlSchemaVReaderWalk(vctxt);
28042 } else if ((vctxt->sax != NULL) && (vctxt->parserCtxt != NULL)) {
28046 ret = xmlParseDocument(vctxt->parserCtxt);
28053 xmlSchemaPostRun(vctxt);
28055 ret = vctxt->err;