Lines Matching full:vctxt
623 xmlSchemaValidCtxtPtr vctxt;
1074 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt);
2040 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt;
2043 vctxt->nberrors++;
2044 vctxt->err = error;
2045 channel = vctxt->error;
2047 channel = vctxt->warning;
2049 schannel = vctxt->serror;
2050 data = vctxt->errCtxt;
2058 (vctxt->depth >= 0) &&
2059 (vctxt->inode != NULL)) {
2060 node = vctxt->inode->node;
2066 (vctxt->parserCtxt != NULL) &&
2067 (vctxt->parserCtxt->input != NULL)) {
2068 file = vctxt->parserCtxt->input->filename;
2069 line = vctxt->parserCtxt->input->line;
2080 if (vctxt->doc != NULL)
2081 file = (const char *) vctxt->doc->URL;
2082 else if ((vctxt->parserCtxt != NULL) &&
2083 (vctxt->parserCtxt->input != NULL))
2084 file = vctxt->parserCtxt->input->filename;
2086 if (vctxt->locFunc != NULL) {
2090 vctxt->locFunc(vctxt->locCtxt, &f, &l);
2097 if ((file == NULL) && (vctxt->filename != NULL))
2098 file = vctxt->filename;
2216 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) actxt;
2220 if (vctxt->inode->nodeType == XML_ATTRIBUTE_NODE) {
2222 vctxt->elemInfos[vctxt->depth];
2234 vctxt->inode->nsName, vctxt->inode->localName));
2378 xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt,
2391 xmlSchemaErr4Line(ACTXT_CAST vctxt, XML_ERR_ERROR,
2394 vctxt->nodeQNames->items[idcNode->nodeQNameID +1],
2395 vctxt->nodeQNames->items[idcNode->nodeQNameID]),
2750 xmlSchemaCustomErr(ACTXT_CAST vctxt, err, NULL, type, msg, NULL, NULL);
2752 #define VERROR_INT(func, msg) xmlSchemaInternalErr(ACTXT_CAST vctxt, func, msg);
4531 * @vctxt: the WXS validation context
9986 xmlSchemaCreatePCtxtOnVCtxt(xmlSchemaValidCtxtPtr vctxt)
9988 if (vctxt->pctxt == NULL) {
9989 if (vctxt->schema != NULL)
9990 vctxt->pctxt =
9991 xmlSchemaNewParserCtxtUseDict("*", vctxt->schema->dict);
9993 vctxt->pctxt = xmlSchemaNewParserCtxt("*");
9994 if (vctxt->pctxt == NULL) {
10000 xmlSchemaSetParserErrors(vctxt->pctxt, vctxt->error,
10001 vctxt->warning, vctxt->errCtxt);
10002 xmlSchemaSetParserStructuredErrors(vctxt->pctxt, vctxt->serror,
10003 vctxt->errCtxt);
12527 if (ctxt->vctxt != NULL) {
12528 xmlSchemaFreeValidCtxt(ctxt->vctxt);
15757 if (ctxt->vctxt == NULL) {
15758 ctxt->vctxt = xmlSchemaNewValidCtxt(NULL);
15759 if (ctxt->vctxt == NULL) {
15768 xmlSchemaSetValidErrors(ctxt->vctxt,
15770 xmlSchemaSetValidStructuredErrors(ctxt->vctxt,
18852 if (pctxt->vctxt == NULL) {
18856 pctxt->vctxt->schema = pctxt->schema;
18862 pctxt->vctxt->schema = NULL;
21425 if (ctxt->vctxt != NULL)
21426 xmlSchemaSetValidErrors(ctxt->vctxt, err, warn, ctx);
21446 if (ctxt->vctxt != NULL)
21447 xmlSchemaSetValidStructuredErrors(ctxt->vctxt, serror, ctx);
21579 * @vctxt: a schema validation context
21591 xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt,
21601 if ((vctxt == NULL) || (schema == NULL))
21604 if (vctxt->pctxt == NULL) {
21609 pctxt = vctxt->pctxt;
21634 xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC,
21682 if ((ret != 0) && (vctxt->err == 0))
21683 vctxt->err = ret;
21684 vctxt->nberrors += pctxt->nberrors;
21687 vctxt->nberrors += pctxt->nberrors;
21697 xmlSchemaGetMetaAttrInfo(xmlSchemaValidCtxtPtr vctxt,
21700 if (vctxt->nbAttrInfos == 0)
21706 for (i = 0; i < vctxt->nbAttrInfos; i++) {
21707 iattr = vctxt->attrInfos[i];
21718 * @vctxt: a schema validation context
21729 xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
21745 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
21748 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
21769 nsname = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
21788 xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC,
21796 location = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
21798 ret = xmlSchemaAssembleByLocation(vctxt, vctxt->schema,
21810 xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt,
21813 if (vctxt->sax != NULL) {
21817 for (i = vctxt->depth; i >= 0; i--) {
21818 if (vctxt->elemInfos[i]->nbNsBindings != 0) {
21819 inode = vctxt->elemInfos[i];
21837 } else if (vctxt->reader != NULL) {
21840 nsName = xmlTextReaderLookupNamespace(vctxt->reader, prefix);
21844 ret = xmlDictLookup(vctxt->dict, nsName, -1);
21853 if ((vctxt->inode->node == NULL) ||
21854 (vctxt->inode->node->doc == NULL)) {
21859 ns = xmlSearchNs(vctxt->inode->node->doc,
21860 vctxt->inode->node, prefix);
21871 xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt,
21880 if (vctxt && (vctxt->schema == NULL)) {
21896 if (vctxt != NULL)
21897 nsName = xmlSchemaLookupNamespace(vctxt, BAD_CAST prefix);
21939 xmlSchemaVAddNodeQName(xmlSchemaValidCtxtPtr vctxt,
21945 lname = xmlDictLookup(vctxt->dict, lname, -1);
21949 nsname = xmlDictLookup(vctxt->dict, nsname, -1);
21953 for (i = 0; i < vctxt->nodeQNames->nbItems; i += 2) {
21954 if ((vctxt->nodeQNames->items [i] == lname) &&
21955 (vctxt->nodeQNames->items[i +1] == nsname))
21960 i = vctxt->nodeQNames->nbItems;
21961 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) lname);
21962 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) nsname);
21982 xmlSchemaValidCtxtPtr vctxt)
21988 xmlSchemaVErrMemory(vctxt,
21996 if (vctxt->aidcs == NULL)
21997 vctxt->aidcs = aidc;
21999 aidc->next = vctxt->aidcs;
22000 vctxt->aidcs = aidc;
22005 if ((vctxt->hasKeyrefs == 0) &&
22007 vctxt->hasKeyrefs = 1;
22017 xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt) {
22020 (xmlHashScanner) xmlSchemaAugmentIDC, vctxt);
22051 * @vctxt: the WXS validation context
22061 xmlSchemaIDCStoreNodeTableItem(xmlSchemaValidCtxtPtr vctxt,
22067 if (vctxt->idcNodes == NULL) {
22068 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *)
22070 if (vctxt->idcNodes == NULL) {
22071 xmlSchemaVErrMemory(vctxt,
22075 vctxt->sizeIdcNodes = 20;
22076 } else if (vctxt->sizeIdcNodes <= vctxt->nbIdcNodes) {
22077 vctxt->sizeIdcNodes *= 2;
22078 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *)
22079 xmlRealloc(vctxt->idcNodes, vctxt->sizeIdcNodes *
22081 if (vctxt->idcNodes == NULL) {
22082 xmlSchemaVErrMemory(vctxt,
22087 vctxt->idcNodes[vctxt->nbIdcNodes++] = item;
22094 * @vctxt: the WXS validation context
22102 xmlSchemaIDCStoreKey(xmlSchemaValidCtxtPtr vctxt,
22108 if (vctxt->idcKeys == NULL) {
22109 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *)
22111 if (vctxt->idcKeys == NULL) {
22112 xmlSchemaVErrMemory(vctxt,
22116 vctxt->sizeIdcKeys = 40;
22117 } else if (vctxt->sizeIdcKeys <= vctxt->nbIdcKeys) {
22118 vctxt->sizeIdcKeys *= 2;
22119 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *)
22120 xmlRealloc(vctxt->idcKeys, vctxt->sizeIdcKeys *
22122 if (vctxt->idcKeys == NULL) {
22123 xmlSchemaVErrMemory(vctxt,
22128 vctxt->idcKeys[vctxt->nbIdcKeys++] = key;
22172 * @vctxt: the WXS validation context
22182 xmlSchemaIDCAcquireBinding(xmlSchemaValidCtxtPtr vctxt,
22187 ielem = vctxt->elemInfos[matcher->depth];
22214 xmlSchemaIDCAcquireTargetList(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED,
22315 * @vctxt: the WXS validation context
22321 xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt,
22362 if (vctxt->idcMatcherCache != NULL)
22363 matcher->nextCached = vctxt->idcMatcherCache;
22364 vctxt->idcMatcherCache = matcher;
22372 * @vctxt: the WXS validation context
22385 xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt,
22395 if (vctxt->xpathStatePool != NULL) {
22396 sto = vctxt->xpathStatePool;
22397 vctxt->xpathStatePool = sto->next;
22414 if (vctxt->xpathStates != NULL)
22415 sto->next = vctxt->xpathStates;
22416 vctxt->xpathStates = sto;
22435 sto->depth = vctxt->depth;
22449 * @vctxt: the WXS validation context
22458 xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt,
22462 int res, resolved = 0, depth = vctxt->depth;
22464 if (vctxt->xpathStates == NULL)
22474 xmlSchemaFormatQName(&str, vctxt->inode->nsName,
22475 vctxt->inode->localName), depth, nodeType);
22482 first = vctxt->xpathStates;
22495 vctxt->inode->localName, vctxt->inode->nsName);
22498 vctxt->inode->localName, vctxt->inode->nsName);
22539 vctxt->depth);
22554 if (xmlSchemaIDCAddStateObject(vctxt, sto->matcher,
22572 if ((vctxt->inode->flags &
22574 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED;
22584 sto = vctxt->xpathStates;
22592 xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt,
22629 * @vctxt: the WXS validation context
22636 xmlSchemaXPathPop(xmlSchemaValidCtxtPtr vctxt)
22641 if (vctxt->xpathStates == NULL)
22643 sto = vctxt->xpathStates;
22655 * @vctxt: the WXS validation context
22665 xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
22671 xmlSchemaTypePtr type = vctxt->inode->typeDef, simpleType = NULL;
22673 if (vctxt->xpathStates == NULL)
22675 sto = vctxt->xpathStates;
22682 xmlSchemaFormatQName(&str, vctxt->inode->nsName,
22683 vctxt->inode->localName), vctxt->depth);
22743 xmlSchemaCustomErr(ACTXT_CAST vctxt,
22755 if ((key == NULL) && (vctxt->inode->val == NULL)) {
22852 xmlSchemaCustomErr(ACTXT_CAST vctxt,
22898 key->val = vctxt->inode->val;
22899 vctxt->inode->val = NULL;
22903 if (xmlSchemaIDCStoreKey(vctxt, key) == -1) {
22982 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
22984 targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher);
23024 xmlSchemaCustomErr(ACTXT_CAST vctxt,
23028 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23054 if (xmlSchemaIDCStoreNodeTableItem(vctxt, ntItem) == -1) {
23066 ntItem->nodeQNameID = xmlSchemaVAddNodeQName(vctxt,
23067 vctxt->inode->localName, vctxt->inode->nsName);
23079 ntItem->node = vctxt->node;
23080 ntItem->nodeLine = vctxt->inode->nodeLine;
23108 xmlSchemaCustomErr(ACTXT_CAST vctxt,
23136 if (vctxt->xpathStates != sto) {
23145 vctxt->xpathStates = sto->next;
23146 sto->next = vctxt->xpathStatePool;
23150 vctxt->xpathStatePool = sto;
23160 * @vctxt: the WXS validation context
23169 xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt,
23185 (char *) xmlSchemaFormatQName(&str, vctxt->inode->nsName,
23186 vctxt->inode->localName), vctxt->depth);
23190 if (vctxt->inode->idcMatchers != NULL) {
23209 vctxt->inode->hasKeyrefs = 1;
23213 aidc = vctxt->aidcs;
23226 (vctxt->depth < aidc->keyrefDepth))
23227 aidc->keyrefDepth = vctxt->depth;
23233 aidc = vctxt->aidcs;
23247 if (vctxt->idcMatcherCache != NULL) {
23251 matcher = vctxt->idcMatcherCache;
23252 vctxt->idcMatcherCache = matcher->nextCached;
23258 xmlSchemaVErrMemory(vctxt,
23265 vctxt->inode->idcMatchers = matcher;
23271 matcher->depth = vctxt->depth;
23280 if (xmlSchemaIDCAddStateObject(vctxt, matcher,
23290 xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt,
23299 /* vctxt->createIDCNodeTables */
23314 if ((! vctxt->createIDCNodeTables) &&
23316 (matcher->aidc->keyrefDepth > vctxt->depth)))
23324 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
23486 xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt)
23494 bind = vctxt->inode->idcTable;
23500 parTable = &(vctxt->elemInfos[vctxt->depth -1]->idcTable);
23512 if (! vctxt->createIDCNodeTables) {
23513 aidc = vctxt->aidcs;
23517 (aidc->keyrefDepth >= vctxt->depth)) {
23712 if (! vctxt->psviExposeIDCNodeTables) {
23775 * @vctxt: the WXS validation context
23781 xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt)
23786 matcher = vctxt->inode->idcMatchers;
23804 bind = vctxt->inode->idcTable;
23859 xmlSchemaKeyrefErr(vctxt,
23864 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23878 xmlSchemaKeyrefErr(vctxt,
23882 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23903 xmlSchemaGetFreshAttrInfo(xmlSchemaValidCtxtPtr vctxt)
23909 if (vctxt->attrInfos == NULL) {
23910 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *)
23912 vctxt->sizeAttrInfos = 1;
23913 if (vctxt->attrInfos == NULL) {
23914 xmlSchemaVErrMemory(vctxt,
23918 } else if (vctxt->sizeAttrInfos <= vctxt->nbAttrInfos) {
23919 vctxt->sizeAttrInfos++;
23920 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *)
23921 xmlRealloc(vctxt->attrInfos,
23922 vctxt->sizeAttrInfos * sizeof(xmlSchemaAttrInfoPtr));
23923 if (vctxt->attrInfos == NULL) {
23924 xmlSchemaVErrMemory(vctxt,
23929 iattr = vctxt->attrInfos[vctxt->nbAttrInfos++];
23944 xmlSchemaVErrMemory(vctxt, "creating new attribute info", NULL);
23949 vctxt->attrInfos[vctxt->nbAttrInfos++] = iattr;
23955 xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt,
23966 attr = xmlSchemaGetFreshAttrInfo(vctxt);
24013 * @vctxt: the WXS validation context
24017 xmlSchemaClearElemInfo(xmlSchemaValidCtxtPtr vctxt,
24047 xmlSchemaIDCReleaseMatcherList(vctxt, ielem->idcMatchers);
24074 * @vctxt: the schema validation context
24082 xmlSchemaGetFreshElemInfo(xmlSchemaValidCtxtPtr vctxt)
24086 if (vctxt->depth > vctxt->sizeElemInfos) {
24091 if (vctxt->elemInfos == NULL) {
24092 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *)
24094 if (vctxt->elemInfos == NULL) {
24095 xmlSchemaVErrMemory(vctxt,
24099 memset(vctxt->elemInfos, 0, 10 * sizeof(xmlSchemaNodeInfoPtr));
24100 vctxt->sizeElemInfos = 10;
24101 } else if (vctxt->sizeElemInfos <= vctxt->depth) {
24102 int i = vctxt->sizeElemInfos;
24104 vctxt->sizeElemInfos *= 2;
24105 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *)
24106 xmlRealloc(vctxt->elemInfos, vctxt->sizeElemInfos *
24108 if (vctxt->elemInfos == NULL) {
24109 xmlSchemaVErrMemory(vctxt,
24117 for (; i < vctxt->sizeElemInfos; i++)
24118 vctxt->elemInfos[i] = NULL;
24120 info = vctxt->elemInfos[vctxt->depth];
24126 xmlSchemaVErrMemory(vctxt,
24130 vctxt->elemInfos[vctxt->depth] = info;
24140 info->depth = vctxt->depth;
24145 #define ACTIVATE_ATTRIBUTE(item) vctxt->inode = (xmlSchemaNodeInfoPtr) item;
24146 #define ACTIVATE_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth];
24147 #define ACTIVATE_PARENT_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth -1];
24399 xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt,
24429 nsName = xmlSchemaLookupNamespace(vctxt, prefix);
24439 xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL,
24807 xmlSchemaVExpandQName(xmlSchemaValidCtxtPtr vctxt,
24823 xmlSchemaSimpleTypeErr(ACTXT_CAST vctxt,
24838 *localName = xmlDictLookup(vctxt->dict, value, -1);
24840 *localName = xmlDictLookup(vctxt->dict, local, -1);
24844 *nsName = xmlSchemaLookupNamespace(vctxt, prefix);
24852 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24866 xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt,
24895 ret = xmlSchemaVExpandQName(vctxt, iattr->value,
24910 *localType = xmlSchemaGetType(vctxt->schema, local, nsName);
24914 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24921 ret = vctxt->err;
24963 * if ((vctxt->pctxt == NULL) &&
24964 * (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
24968 if (xmlSchemaCheckCOSDerivedOK(ACTXT_CAST vctxt, *localType,
24972 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24982 ret = vctxt->err;
24996 xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt)
24998 xmlSchemaElementPtr elemDecl = vctxt->inode->decl;
25007 return (vctxt->err);
25016 return (vctxt->err);
25023 if (vctxt->nbAttrInfos != 0) {
25030 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25038 ACTXT_CAST vctxt, NULL,
25069 vctxt->inode->flags |=
25079 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25084 ret = xmlSchemaProcessXSIType(vctxt, iattr, &localType,
25096 vctxt->inode->flags |= XML_SCHEMA_ELEM_INFO_LOCAL_TYPE;
25105 (xmlSchemaIDCRegisterMatchers(vctxt, elemDecl) == -1))
25118 vctxt->inode->typeDef = actualType;
25124 xmlSchemaVAttributesSimple(xmlSchemaValidCtxtPtr vctxt)
25136 if (vctxt->nbAttrInfos == 0)
25138 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25139 iattr = vctxt->attrInfos[i];
25142 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25155 xmlSchemaClearAttrInfos(xmlSchemaValidCtxtPtr vctxt)
25160 if (vctxt->nbAttrInfos == 0)
25162 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25163 attr = vctxt->attrInfos[i];
25180 vctxt->nbAttrInfos = 0;
25194 xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt)
25196 xmlSchemaTypePtr type = vctxt->inode->typeDef;
25228 nbAttrs = vctxt->nbAttrInfos;
25238 iattr = vctxt->attrInfos[j];
25291 tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt);
25307 tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt);
25323 if (vctxt->nbAttrInfos == 0)
25334 iattr = vctxt->attrInfos[i];
25377 iattr->decl = xmlSchemaGetAttributeDecl(vctxt->schema,
25443 if (vctxt->nbAttrInfos == 0)
25450 if (vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) {
25451 xmlSchemaNodeInfoPtr ielem = vctxt->elemInfos[vctxt->depth];
25458 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25459 iattr = vctxt->attrInfos[i];
25480 if (vctxt->xpathStates != NULL) {
25484 xpathRes = xmlSchemaXPathEvaluate(vctxt,
25579 ns = xmlNewNs(vctxt->validationRoot,
25601 if (vctxt->value != NULL) {
25605 xmlSchemaFreeValue(vctxt->value);
25606 vctxt->value = NULL;
25633 ACTXT_CAST vctxt,
25638 ACTXT_CAST vctxt,
25720 if (xmlSchemaXPathProcessHistory(vctxt,
25721 vctxt->depth +1) == -1) {
25726 } else if (vctxt->xpathStates != NULL)
25727 xmlSchemaXPathPop(vctxt);
25733 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25734 iattr = vctxt->attrInfos[i];
25745 xmlSchemaCustomErr(ACTXT_CAST vctxt,
25760 xmlSchemaCustomErr(ACTXT_CAST vctxt,
25779 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25782 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25799 xmlSchemaValidateElemWildcard(xmlSchemaValidCtxtPtr vctxt,
25802 xmlSchemaWildcardPtr wild = (xmlSchemaWildcardPtr) vctxt->inode->decl;
25825 decl = xmlSchemaGetElem(vctxt->schema,
25826 vctxt->inode->localName, vctxt->inode->nsName);
25828 vctxt->inode->decl = decl;
25837 return (vctxt->err);
25839 if (vctxt->nbAttrInfos != 0) {
25847 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25850 if (xmlSchemaProcessXSIType(vctxt, iattr,
25851 &(vctxt->inode->typeDef), NULL) == -1) {
25868 vctxt->inode->typeDef =
25881 xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt,
25886 xmlSchemaNodeInfoPtr inode = vctxt->inode;
25929 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25934 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25945 xmlSchemaVContentModelCallback(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED,
25973 xmlSchemaValidatorPushElem(xmlSchemaValidCtxtPtr vctxt)
25975 vctxt->inode = xmlSchemaGetFreshElemInfo(vctxt);
25976 if (vctxt->inode == NULL) {
25981 vctxt->nbAttrInfos = 0;
25986 xmlSchemaVCheckINodeDataType(xmlSchemaValidCtxtPtr vctxt,
25993 ACTXT_CAST vctxt, NULL,
25997 ACTXT_CAST vctxt, NULL,
26007 xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
26010 xmlSchemaNodeInfoPtr inode = vctxt->inode;
26012 if (vctxt->nbAttrInfos != 0)
26013 xmlSchemaClearAttrInfos(vctxt);
26020 vctxt->skipDepth = vctxt->depth -1;
26055 vctxt);
26094 xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
26125 if (vctxt->value != NULL) {
26126 xmlSchemaFreeValue(vctxt->value);
26127 vctxt->value = NULL;
26137 ret = xmlSchemaVCheckINodeDataType(vctxt,
26140 ret = xmlSchemaVCheckINodeDataType(vctxt,
26179 ret = xmlSchemaCheckCOSValidDefault(vctxt,
26204 ret = xmlSchemaVCheckINodeDataType(vctxt,
26207 ret = xmlSchemaVCheckINodeDataType(vctxt,
26224 if ((vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) &&
26261 ret = xmlSchemaVCheckINodeDataType(vctxt,
26276 ret = xmlSchemaVCheckINodeDataType(vctxt,
26332 xmlSchemaCustomErr(ACTXT_CAST vctxt,
26355 xmlSchemaCustomErr(ACTXT_CAST vctxt,
26369 if (vctxt->depth < 0) {
26373 if (vctxt->depth == vctxt->skipDepth)
26374 vctxt->skipDepth = -1;
26379 (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1))
26398 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables))
26400 if (xmlSchemaIDCFillNodeTables(vctxt, inode) == -1)
26406 if (vctxt->inode->hasKeyrefs)
26407 if (xmlSchemaCheckCVCIDCKeyRef(vctxt) == -1)
26419 if ((vctxt->depth > 0) &&
26420 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables))
26425 if (xmlSchemaBubbleIDCNodeTables(vctxt) == -1)
26434 xmlSchemaClearElemInfo(vctxt, inode);
26438 if (vctxt->depth == 0) {
26439 vctxt->depth--;
26440 vctxt->inode = NULL;
26446 if (vctxt->aidcs != NULL) {
26447 xmlSchemaIDCAugPtr aidc = vctxt->aidcs;
26449 if (aidc->keyrefDepth == vctxt->depth) {
26460 vctxt->depth--;
26461 vctxt->inode = vctxt->elemInfos[vctxt->depth];
26469 vctxt->err = -1;
26478 xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt)
26484 if (vctxt->depth <= 0) {
26489 pielem = vctxt->elemInfos[vctxt->depth -1];
26516 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
26517 vctxt->inode->localName,
26518 vctxt->inode->nsName);
26520 if (vctxt->inode->decl == NULL) {
26526 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
26529 ret = xmlSchemaProcessXSIType(vctxt, iattr,
26530 &(vctxt->inode->typeDef), NULL);
26551 vctxt->inode->typeDef =
26604 vctxt);
26626 vctxt->inode->localName,
26627 vctxt->inode->nsName,
26628 vctxt->inode);
26633 vctxt->inode->localName, pielem->localName);
26637 vctxt->inode->localName, pielem->localName);
26639 if (vctxt->err == XML_SCHEMAV_INTERNAL) {
26647 xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
26651 ret = vctxt->err;
26680 ret = vctxt->err;
26693 vctxt->skipDepth = vctxt->depth;
26694 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_NOT_EXPECTED;
26704 xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt,
26719 if (INODE_NILLED(vctxt->inode)) {
26728 return (vctxt->err);
26735 if (vctxt->inode->typeDef->contentType ==
26740 return (vctxt->err);
26743 if (vctxt->inode->typeDef->contentType ==
26758 return (vctxt->err);
26770 if ((vctxt->inode->typeDef->contentType == XML_SCHEMA_CONTENT_MIXED) &&
26771 ((vctxt->inode->decl == NULL) ||
26772 (vctxt->inode->decl->value == NULL)))
26775 if (vctxt->inode->value == NULL) {
26784 vctxt->inode->value = value;
26791 vctxt->inode->value = value;
26794 vctxt->inode->flags |=
26803 vctxt->inode->value = BAD_CAST xmlStrndup(value, len);
26805 vctxt->inode->value = BAD_CAST xmlStrdup(value);
26806 vctxt->inode->flags |=
26818 if (vctxt->inode->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) {
26819 vctxt->inode->value = BAD_CAST xmlStrncat(
26820 (xmlChar *) vctxt->inode->value, value, len);
26822 vctxt->inode->value =
26823 BAD_CAST xmlStrncatNew(vctxt->inode->value, value, len);
26824 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES;
26832 xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt)
26836 if ((vctxt->skipDepth != -1) &&
26837 (vctxt->depth >= vctxt->skipDepth)) {
26842 if (vctxt->xsiAssemble) {
26853 ret = xmlSchemaAssembleByXSI(vctxt);
26857 vctxt->skipDepth = 0;
26864 xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt);
26866 if (vctxt->depth > 0) {
26871 ret = xmlSchemaValidateChildElem(vctxt);
26880 if (vctxt->depth == vctxt->skipDepth)
26882 if ((vctxt->inode->decl == NULL) &&
26883 (vctxt->inode->typeDef == NULL)) {
26893 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
26894 vctxt->inode->localName,
26895 vctxt->inode->nsName);
26896 if (vctxt->inode->decl == NULL) {
26905 if (vctxt->inode->decl == NULL)
26908 if (vctxt->inode->decl->type == XML_SCHEMA_TYPE_ANY) {
26913 ret = xmlSchemaValidateElemWildcard(vctxt, &skip);
26923 vctxt->skipDepth = vctxt->depth;
26930 if (vctxt->inode->decl->type != XML_SCHEMA_TYPE_ELEMENT) {
26934 vctxt->inode->decl = NULL;
26941 ret = xmlSchemaValidateElemDecl(vctxt);
26955 if (vctxt->inode->typeDef == NULL) {
26956 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26962 if (vctxt
26963 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26974 if (vctxt->xpathStates != NULL) {
26975 ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE);
26976 vctxt->inode->appliedXPath = 1;
26986 if (WXS_IS_COMPLEX(vctxt->inode->typeDef)) {
26987 if ((vctxt->nbAttrInfos != 0) ||
26988 (vctxt->inode->typeDef->attrUses != NULL)) {
26990 ret = xmlSchemaVAttributesComplex(vctxt);
26992 } else if (vctxt->nbAttrInfos != 0) {
26994 ret = xmlSchemaVAttributesSimple(vctxt);
26999 if (vctxt->nbAttrInfos != 0)
27000 xmlSchemaClearAttrInfos(vctxt);
27013 vctxt->skipDepth = vctxt->depth;
27021 xmlSchemaVReaderWalk(xmlSchemaValidCtxtPtr vctxt)
27027 vctxt->depth = -1;
27028 ret = xmlTextReaderRead(vctxt->reader);
27033 nodeType = xmlTextReaderNodeType(vctxt->reader);
27036 ret = xmlTextReaderRead(vctxt->reader);
27043 depth = xmlTextReaderDepth(vctxt->reader);
27044 nodeType = xmlTextReaderNodeType(vctxt->reader);
27048 vctxt->depth++;
27049 if (xmlSchemaValidatorPushElem(vctxt) == -1) {
27054 ielem = vctxt->inode;
27055 ielem->localName = xmlTextReaderLocalName(vctxt->reader);
27056 ielem->nsName = xmlTextReaderNamespaceUri(vctxt->reader);
27061 ret = xmlTextReaderIsEmptyElement(vctxt->reader);
27073 vctxt->nbAttrInfos = 0;
27074 ret = xmlTextReaderMoveToFirstAttribute(vctxt->reader);
27086 if (xmlSchemaValidatorPushAttribute(vctxt, NULL,
27087 (const xmlChar *) xmlTextReaderLocalName(vctxt->reader),
27088 xmlTextReaderNamespaceUri(vctxt->reader), 1,
27089 xmlTextReaderValue(vctxt->reader), 1) == -1) {
27095 ret = xmlTextReaderMoveToNextAttribute(vctxt->reader);
27105 ret = xmlTextReaderMoveToElement(vctxt->reader);
27115 ret= xmlSchemaValidateElem(vctxt);
27124 if (vctxt->depth == vctxt->skipDepth) {
27130 ret = xmlTextReaderRead(vctxt->reader);
27131 curDepth = xmlTextReaderDepth(vctxt->reader);
27133 ret = xmlTextReaderRead(vctxt->reader);
27134 curDepth = xmlTextReaderDepth(vctxt->reader);
27157 ret = xmlSchemaValidatorPopElem(vctxt);
27166 if (vctxt->depth >= 0)
27167 ielem = vctxt->inode;
27182 value = xmlTextReaderValue(vctxt->reader);
27183 ret = xmlSchemaVPushText(vctxt, nodeType, BAD_CAST value,
27202 ret = xmlTextReaderRead(vctxt->reader);
27226 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27228 if (vctxt->depth < 0)
27230 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27232 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY)
27233 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY;
27234 if (xmlSchemaVPushText(vctxt, XML_TEXT_NODE, ch, len,
27238 vctxt->err = -1;
27239 xmlStopParser(vctxt->parserCtxt);
27251 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27253 if (vctxt->depth < 0)
27255 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27257 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY)
27258 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY;
27259 if (xmlSchemaVPushText(vctxt, XML_CDATA_SECTION_NODE, ch, len,
27263 vctxt->err = -1;
27264 xmlStopParser(vctxt->parserCtxt);
27272 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27274 if (vctxt->depth < 0)
27276 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27293 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27304 vctxt->depth++;
27305 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27310 if (xmlSchemaValidatorPushElem(vctxt) == -1) {
27315 ielem = vctxt->inode;
27319 ielem->nodeLine = xmlSAX2GetLineNumber(vctxt->parserCtxt);
27340 xmlSchemaVErrMemory(vctxt,
27354 xmlSchemaVErrMemory(vctxt,
27390 ret = xmlSchemaValidatorPushAttribute(vctxt,
27403 ret = xmlSchemaValidateElem(vctxt);
27416 vctxt->err = -1;
27417 xmlStopParser(vctxt->parserCtxt);
27427 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27433 if (vctxt->skipDepth != -1) {
27434 if (vctxt->depth > vctxt->skipDepth) {
27435 vctxt->depth--;
27438 vctxt->skipDepth = -1;
27443 if ((!xmlStrEqual(vctxt->inode->localName, localname)) ||
27444 (!xmlStrEqual(vctxt->inode->nsName, URI))) {
27448 res = xmlSchemaValidatorPopElem(vctxt);
27460 vctxt->err = -1;
27461 xmlStopParser(vctxt->parserCtxt);
27499 * @vctxt: the schema validation context
27506 xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, const char *filename) {
27507 if (vctxt == NULL)
27509 if (vctxt->filename != NULL)
27510 xmlFree(vctxt->filename);
27512 vctxt->filename = (char *) xmlStrdup((const xmlChar *) filename);
27514 vctxt->filename = NULL;
27519 * @vctxt: the schema validation context
27525 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
27527 if (vctxt == NULL)
27535 vctxt->flags = 0;
27536 vctxt->validationRoot = NULL;
27537 vctxt->doc = NULL;
27539 vctxt->reader = NULL;
27541 vctxt->hasKeyrefs = 0;
27543 if (vctxt->value != NULL) {
27544 xmlSchemaFreeValue(vctxt->value);
27545 vctxt->value = NULL;
27550 if (vctxt->aidcs != NULL) {
27551 xmlSchemaIDCAugPtr cur = vctxt->aidcs, next;
27557 vctxt->aidcs = NULL;
27559 if (vctxt->idcMatcherCache != NULL) {
27560 xmlSchemaIDCMatcherPtr matcher = vctxt->idcMatcherCache, tmp;
27567 vctxt->idcMatcherCache = NULL;
27571 if (vctxt->idcNodes != NULL) {
27575 for (i = 0; i < vctxt->nbIdcNodes; i++) {
27576 item = vctxt->idcNodes[i];
27580 xmlFree(vctxt->idcNodes);
27581 vctxt->idcNodes = NULL;
27582 vctxt->nbIdcNodes = 0;
27583 vctxt->sizeIdcNodes = 0;
27588 if (vctxt->xpathStates != NULL) {
27589 xmlSchemaFreeIDCStateObjList(vctxt->xpathStates);
27590 vctxt->xpathStates = NULL;
27595 if (vctxt->nbAttrInfos != 0) {
27596 xmlSchemaClearAttrInfos(vctxt);
27601 if (vctxt->elemInfos != NULL) {
27605 for (i = 0; i < vctxt->sizeElemInfos; i++) {
27606 ei = vctxt->elemInfos[i];
27609 xmlSchemaClearElemInfo(vctxt, ei);
27612 xmlSchemaItemListClear(vctxt->nodeQNames);
27614 xmlDictFree(vctxt->dict);
27619 vctxt->dict = xmlDictCreate();
27621 if (vctxt->filename != NULL) {
27622 xmlFree(vctxt->filename);
27623 vctxt->filename = NULL;
27857 xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
27866 if (vctxt->validationRoot != NULL)
27867 valRoot = vctxt->validationRoot;
27869 valRoot = xmlDocGetRootElement(vctxt->doc);
27875 vctxt->depth = -1;
27876 vctxt->validationRoot = valRoot;
27879 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27886 vctxt->depth++;
27887 if (xmlSchemaValidatorPushElem(vctxt) == -1)
27889 ielem = vctxt->inode;
27901 vctxt->nbAttrInfos = 0;
27909 ret = xmlSchemaValidatorPushAttribute(vctxt,
27929 ret = xmlSchemaValidateElem(vctxt);
27942 if ((vctxt->skipDepth != -1) &&
27943 (vctxt->depth >= vctxt->skipDepth))
27952 ret = xmlSchemaVPushText(vctxt, node->type, node->content,
27992 if (node != vctxt->inode->node) {
27997 ret = xmlSchemaValidatorPopElem(vctxt);
28024 xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) {
28028 vctxt->err = 0;
28029 vctxt->nberrors = 0;
28030 vctxt->depth = -1;
28031 vctxt->skipDepth = -1;
28032 vctxt->xsiAssemble = 0;
28033 vctxt->hasKeyrefs = 0;
28035 vctxt->createIDCNodeTables = 1;
28037 vctxt->createIDCNodeTables = 0;
28042 if (vctxt->schema == NULL) {
28045 vctxt->xsiAssemble = 1;
28052 if ((vctxt->pctxt == NULL) &&
28053 (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
28055 pctxt = vctxt->pctxt;
28060 vctxt->schema = xmlSchemaNewSchema(pctxt);
28061 if (vctxt->schema == NULL)
28069 pctxt->constructor->mainSchema = vctxt->schema;
28079 xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt);
28085 xmlSchemaPostRun(xmlSchemaValidCtxtPtr vctxt) {
28086 if (vctxt->xsiAssemble) {
28087 if (vctxt->schema != NULL) {
28088 xmlSchemaFree(vctxt->schema);
28089 vctxt->schema = NULL;
28092 xmlSchemaClearValidCtxt(vctxt);
28096 xmlSchemaVStart(xmlSchemaValidCtxtPtr vctxt)
28100 if (xmlSchemaPreRun(vctxt) < 0)
28103 if (vctxt->doc != NULL) {
28107 ret = xmlSchemaVDocWalk(vctxt);
28109 } else if (vctxt->reader != NULL) {
28114 ret = xmlSchemaVReaderWalk(vctxt);
28117 } else if ((vctxt->sax != NULL) && (vctxt->parserCtxt != NULL)) {
28121 ret = xmlParseDocument(vctxt->parserCtxt);
28128 xmlSchemaPostRun(vctxt);
28130 ret = vctxt->err;
28710 * @vctxt: a schema validation context
28721 xmlSchemaValidateSetLocator(xmlSchemaValidCtxtPtr vctxt,
28725 if (vctxt == NULL) return;
28726 vctxt->locFunc = f;
28727 vctxt->locCtxt = ctxt;