Home | History | Annotate | Download | only in libxml2

Lines Matching defs:vctxt

623     xmlSchemaValidCtxtPtr vctxt;
1074 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt);
2040 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt;
2044 vctxt->nberrors++;
2045 vctxt->err = error;
2046 channel = vctxt->error;
2048 channel = vctxt->warning;
2050 schannel = vctxt->serror;
2051 data = vctxt->errCtxt;
2059 (vctxt->depth >= 0) &&
2060 (vctxt->inode != NULL)) {
2061 node = vctxt->inode->node;
2067 (vctxt->parserCtxt != NULL) &&
2068 (vctxt->parserCtxt->input != NULL)) {
2069 file = vctxt->parserCtxt->input->filename;
2070 line = vctxt->parserCtxt->input->line;
2071 col = vctxt->parserCtxt->input->col;
2082 if (vctxt->doc != NULL)
2083 file = (const char *) vctxt->doc->URL;
2084 else if ((vctxt->parserCtxt != NULL) &&
2085 (vctxt->parserCtxt->input != NULL))
2086 file = vctxt->parserCtxt->input->filename;
2088 if (vctxt->locFunc != NULL) {
2092 vctxt->locFunc(vctxt->locCtxt, &f, &l);
2099 if ((file == NULL) && (vctxt->filename != NULL))
2100 file = vctxt->filename;
2218 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) actxt;
2222 if (vctxt->inode->nodeType == XML_ATTRIBUTE_NODE) {
2224 vctxt->elemInfos[vctxt->depth];
2236 vctxt->inode->nsName, vctxt->inode->localName));
2380 xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt,
2393 xmlSchemaErr4Line(ACTXT_CAST vctxt, XML_ERR_ERROR,
2396 vctxt->nodeQNames->items[idcNode->nodeQNameID +1],
2397 vctxt->nodeQNames->items[idcNode->nodeQNameID]),
2752 xmlSchemaCustomErr(ACTXT_CAST vctxt, err, NULL, type, msg, NULL, NULL);
2754 #define VERROR_INT(func, msg) xmlSchemaInternalErr(ACTXT_CAST vctxt, func, msg);
4533 * @vctxt: the WXS validation context
9988 xmlSchemaCreatePCtxtOnVCtxt(xmlSchemaValidCtxtPtr vctxt)
9990 if (vctxt->pctxt == NULL) {
9991 if (vctxt->schema != NULL)
9992 vctxt->pctxt =
9993 xmlSchemaNewParserCtxtUseDict("*", vctxt->schema->dict);
9995 vctxt->pctxt = xmlSchemaNewParserCtxt("*");
9996 if (vctxt->pctxt == NULL) {
10002 xmlSchemaSetParserErrors(vctxt->pctxt, vctxt->error,
10003 vctxt->warning, vctxt->errCtxt);
10004 xmlSchemaSetParserStructuredErrors(vctxt->pctxt, vctxt->serror,
10005 vctxt->errCtxt);
12529 if (ctxt->vctxt != NULL) {
12530 xmlSchemaFreeValidCtxt(ctxt->vctxt);
15759 if (ctxt->vctxt == NULL) {
15760 ctxt->vctxt = xmlSchemaNewValidCtxt(NULL);
15761 if (ctxt->vctxt == NULL) {
15770 xmlSchemaSetValidErrors(ctxt->vctxt,
15772 xmlSchemaSetValidStructuredErrors(ctxt->vctxt,
18854 if (pctxt->vctxt == NULL) {
18858 pctxt->vctxt->schema = pctxt->schema;
18864 pctxt->vctxt->schema = NULL;
21427 if (ctxt->vctxt != NULL)
21428 xmlSchemaSetValidErrors(ctxt->vctxt, err, warn, ctx);
21448 if (ctxt->vctxt != NULL)
21449 xmlSchemaSetValidStructuredErrors(ctxt->vctxt, serror, ctx);
21581 * @vctxt: a schema validation context
21593 xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt,
21603 if ((vctxt == NULL) || (schema == NULL))
21606 if (vctxt->pctxt == NULL) {
21611 pctxt = vctxt->pctxt;
21636 xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC,
21684 if ((ret != 0) && (vctxt->err == 0))
21685 vctxt->err = ret;
21686 vctxt->nberrors += pctxt->nberrors;
21689 vctxt->nberrors += pctxt->nberrors;
21699 xmlSchemaGetMetaAttrInfo(xmlSchemaValidCtxtPtr vctxt,
21702 if (vctxt->nbAttrInfos == 0)
21708 for (i = 0; i < vctxt->nbAttrInfos; i++) {
21709 iattr = vctxt->attrInfos[i];
21720 * @vctxt: a schema validation context
21731 xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
21747 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
21750 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
21771 nsname = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
21790 xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC,
21798 location = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
21800 ret = xmlSchemaAssembleByLocation(vctxt, vctxt->schema,
21812 xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt,
21815 if (vctxt->sax != NULL) {
21819 for (i = vctxt->depth; i >= 0; i--) {
21820 if (vctxt->elemInfos[i]->nbNsBindings != 0) {
21821 inode = vctxt->elemInfos[i];
21839 } else if (vctxt->reader != NULL) {
21842 nsName = xmlTextReaderLookupNamespace(vctxt->reader, prefix);
21846 ret = xmlDictLookup(vctxt->dict, nsName, -1);
21855 if ((vctxt->inode->node == NULL) ||
21856 (vctxt->inode->node->doc == NULL)) {
21861 ns = xmlSearchNs(vctxt->inode->node->doc,
21862 vctxt->inode->node, prefix);
21873 xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt,
21882 if (vctxt && (vctxt->schema == NULL)) {
21898 if (vctxt != NULL)
21899 nsName = xmlSchemaLookupNamespace(vctxt, BAD_CAST prefix);
21941 xmlSchemaVAddNodeQName(xmlSchemaValidCtxtPtr vctxt,
21947 lname = xmlDictLookup(vctxt->dict, lname, -1);
21951 nsname = xmlDictLookup(vctxt->dict, nsname, -1);
21955 for (i = 0; i < vctxt->nodeQNames->nbItems; i += 2) {
21956 if ((vctxt->nodeQNames->items [i] == lname) &&
21957 (vctxt->nodeQNames->items[i +1] == nsname))
21962 i = vctxt->nodeQNames->nbItems;
21963 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) lname);
21964 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) nsname);
21984 xmlSchemaValidCtxtPtr vctxt)
21990 xmlSchemaVErrMemory(vctxt,
21998 if (vctxt->aidcs == NULL)
21999 vctxt->aidcs = aidc;
22001 aidc->next = vctxt->aidcs;
22002 vctxt->aidcs = aidc;
22007 if ((vctxt->hasKeyrefs == 0) &&
22009 vctxt->hasKeyrefs = 1;
22019 xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt) {
22022 (xmlHashScanner) xmlSchemaAugmentIDC, vctxt);
22053 * @vctxt: the WXS validation context
22063 xmlSchemaIDCStoreNodeTableItem(xmlSchemaValidCtxtPtr vctxt,
22069 if (vctxt->idcNodes == NULL) {
22070 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *)
22072 if (vctxt->idcNodes == NULL) {
22073 xmlSchemaVErrMemory(vctxt,
22077 vctxt->sizeIdcNodes = 20;
22078 } else if (vctxt->sizeIdcNodes <= vctxt->nbIdcNodes) {
22079 vctxt->sizeIdcNodes *= 2;
22080 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *)
22081 xmlRealloc(vctxt->idcNodes, vctxt->sizeIdcNodes *
22083 if (vctxt->idcNodes == NULL) {
22084 xmlSchemaVErrMemory(vctxt,
22089 vctxt->idcNodes[vctxt->nbIdcNodes++] = item;
22096 * @vctxt: the WXS validation context
22104 xmlSchemaIDCStoreKey(xmlSchemaValidCtxtPtr vctxt,
22110 if (vctxt->idcKeys == NULL) {
22111 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *)
22113 if (vctxt->idcKeys == NULL) {
22114 xmlSchemaVErrMemory(vctxt,
22118 vctxt->sizeIdcKeys = 40;
22119 } else if (vctxt->sizeIdcKeys <= vctxt->nbIdcKeys) {
22120 vctxt->sizeIdcKeys *= 2;
22121 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *)
22122 xmlRealloc(vctxt->idcKeys, vctxt->sizeIdcKeys *
22124 if (vctxt->idcKeys == NULL) {
22125 xmlSchemaVErrMemory(vctxt,
22130 vctxt->idcKeys[vctxt->nbIdcKeys++] = key;
22174 vctxt: the WXS validation context
22184 xmlSchemaIDCAcquireBinding(xmlSchemaValidCtxtPtr vctxt,
22189 ielem = vctxt->elemInfos[matcher->depth];
22216 xmlSchemaIDCAcquireTargetList(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED,
22317 * @vctxt: the WXS validation context
22323 xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt,
22364 if (vctxt->idcMatcherCache != NULL)
22365 matcher->nextCached = vctxt->idcMatcherCache;
22366 vctxt->idcMatcherCache = matcher;
22374 * @vctxt: the WXS validation context
22387 xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt,
22397 if (vctxt->xpathStatePool != NULL) {
22398 sto = vctxt->xpathStatePool;
22399 vctxt->xpathStatePool = sto->next;
22416 if (vctxt->xpathStates != NULL)
22417 sto->next = vctxt->xpathStates;
22418 vctxt->xpathStates = sto;
22437 sto->depth = vctxt->depth;
22451 * @vctxt: the WXS validation context
22460 xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt,
22464 int res, resolved = 0, depth = vctxt->depth;
22466 if (vctxt->xpathStates == NULL)
22476 xmlSchemaFormatQName(&str, vctxt->inode->nsName,
22477 vctxt->inode->localName), depth, nodeType);
22484 first = vctxt->xpathStates;
22497 vctxt->inode->localName, vctxt->inode->nsName);
22500 vctxt->inode->localName, vctxt->inode->nsName);
22541 vctxt->depth);
22556 if (xmlSchemaIDCAddStateObject(vctxt, sto->matcher,
22574 if ((vctxt->inode->flags &
22576 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED;
22586 sto = vctxt->xpathStates;
22594 xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt,
22631 * @vctxt: the WXS validation context
22638 xmlSchemaXPathPop(xmlSchemaValidCtxtPtr vctxt)
22643 if (vctxt->xpathStates == NULL)
22645 sto = vctxt->xpathStates;
22657 * @vctxt: the WXS validation context
22667 xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
22673 xmlSchemaTypePtr type = vctxt->inode->typeDef, simpleType = NULL;
22675 if (vctxt->xpathStates == NULL)
22677 sto = vctxt->xpathStates;
22684 xmlSchemaFormatQName(&str, vctxt->inode->nsName,
22685 vctxt->inode->localName), vctxt->depth);
22745 xmlSchemaCustomErr(ACTXT_CAST vctxt,
22757 if ((key == NULL) && (vctxt->inode->val == NULL)) {
22854 xmlSchemaCustomErr(ACTXT_CAST vctxt,
22900 key->val = vctxt->inode->val;
22901 vctxt->inode->val = NULL;
22905 if (xmlSchemaIDCStoreKey(vctxt, key) == -1) {
22984 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
22986 targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher);
23026 xmlSchemaCustomErr(ACTXT_CAST vctxt,
23030 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23056 if (xmlSchemaIDCStoreNodeTableItem(vctxt, ntItem) == -1) {
23068 ntItem->nodeQNameID = xmlSchemaVAddNodeQName(vctxt,
23069 vctxt->inode->localName, vctxt->inode->nsName);
23081 ntItem->node = vctxt->node;
23082 ntItem->nodeLine = vctxt->inode->nodeLine;
23110 xmlSchemaCustomErr(ACTXT_CAST vctxt,
23138 if (vctxt->xpathStates != sto) {
23147 vctxt->xpathStates = sto->next;
23148 sto->next = vctxt->xpathStatePool;
23152 vctxt->xpathStatePool = sto;
23162 * @vctxt: the WXS validation context
23171 xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt,
23187 (char *) xmlSchemaFormatQName(&str, vctxt->inode->nsName,
23188 vctxt->inode->localName), vctxt->depth);
23192 if (vctxt->inode->idcMatchers != NULL) {
23211 vctxt->inode->hasKeyrefs = 1;
23215 aidc = vctxt->aidcs;
23228 (vctxt->depth < aidc->keyrefDepth))
23229 aidc->keyrefDepth = vctxt->depth;
23235 aidc = vctxt->aidcs;
23249 if (vctxt->idcMatcherCache != NULL) {
23253 matcher = vctxt->idcMatcherCache;
23254 vctxt->idcMatcherCache = matcher->nextCached;
23260 xmlSchemaVErrMemory(vctxt,
23267 vctxt->inode->idcMatchers = matcher;
23273 matcher->depth = vctxt->depth;
23282 if (xmlSchemaIDCAddStateObject(vctxt, matcher,
23292 xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt,
23301 /* vctxt->createIDCNodeTables */
23316 if ((! vctxt->createIDCNodeTables) &&
23318 (matcher->aidc->keyrefDepth > vctxt->depth)))
23326 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
23488 xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt)
23496 bind = vctxt->inode->idcTable;
23502 parTable = &(vctxt->elemInfos[vctxt->depth -1]->idcTable);
23514 if (! vctxt->createIDCNodeTables) {
23515 aidc = vctxt->aidcs;
23519 (aidc->keyrefDepth >= vctxt->depth)) {
23714 if (! vctxt->psviExposeIDCNodeTables) {
23777 * @vctxt: the WXS validation context
23783 xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt)
23788 matcher = vctxt->inode->idcMatchers;
23806 bind = vctxt->inode->idcTable;
23861 xmlSchemaKeyrefErr(vctxt,
23866 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23880 xmlSchemaKeyrefErr(vctxt,
23884 xmlSchemaFormatIDCKeySequence(vctxt, &str,
23905 xmlSchemaGetFreshAttrInfo(xmlSchemaValidCtxtPtr vctxt)
23911 if (vctxt->attrInfos == NULL) {
23912 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *)
23914 vctxt->sizeAttrInfos = 1;
23915 if (vctxt->attrInfos == NULL) {
23916 xmlSchemaVErrMemory(vctxt,
23920 } else if (vctxt->sizeAttrInfos <= vctxt->nbAttrInfos) {
23921 vctxt->sizeAttrInfos++;
23922 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *)
23923 xmlRealloc(vctxt->attrInfos,
23924 vctxt->sizeAttrInfos * sizeof(xmlSchemaAttrInfoPtr));
23925 if (vctxt->attrInfos == NULL) {
23926 xmlSchemaVErrMemory(vctxt,
23931 iattr = vctxt->attrInfos[vctxt->nbAttrInfos++];
23946 xmlSchemaVErrMemory(vctxt, "creating new attribute info", NULL);
23951 vctxt->attrInfos[vctxt->nbAttrInfos++] = iattr;
23957 xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt,
23968 attr = xmlSchemaGetFreshAttrInfo(vctxt);
24015 * @vctxt: the WXS validation context
24019 xmlSchemaClearElemInfo(xmlSchemaValidCtxtPtr vctxt,
24049 xmlSchemaIDCReleaseMatcherList(vctxt, ielem->idcMatchers);
24076 * @vctxt: the schema validation context
24084 xmlSchemaGetFreshElemInfo(xmlSchemaValidCtxtPtr vctxt)
24088 if (vctxt->depth > vctxt->sizeElemInfos) {
24093 if (vctxt->elemInfos == NULL) {
24094 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *)
24096 if (vctxt->elemInfos == NULL) {
24097 xmlSchemaVErrMemory(vctxt,
24101 memset(vctxt->elemInfos, 0, 10 * sizeof(xmlSchemaNodeInfoPtr));
24102 vctxt->sizeElemInfos = 10;
24103 } else if (vctxt->sizeElemInfos <= vctxt->depth) {
24104 int i = vctxt->sizeElemInfos;
24106 vctxt->sizeElemInfos *= 2;
24107 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *)
24108 xmlRealloc(vctxt->elemInfos, vctxt->sizeElemInfos *
24110 if (vctxt->elemInfos == NULL) {
24111 xmlSchemaVErrMemory(vctxt,
24119 for (; i < vctxt->sizeElemInfos; i++)
24120 vctxt->elemInfos[i] = NULL;
24122 info = vctxt->elemInfos[vctxt->depth];
24128 xmlSchemaVErrMemory(vctxt,
24132 vctxt->elemInfos[vctxt->depth] = info;
24142 info->depth = vctxt->depth;
24147 #define ACTIVATE_ATTRIBUTE(item) vctxt->inode = (xmlSchemaNodeInfoPtr) item;
24148 #define ACTIVATE_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth];
24149 #define ACTIVATE_PARENT_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth -1];
24401 xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt,
24431 nsName = xmlSchemaLookupNamespace(vctxt, prefix);
24441 xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL,
24809 xmlSchemaVExpandQName(xmlSchemaValidCtxtPtr vctxt,
24825 xmlSchemaSimpleTypeErr(ACTXT_CAST vctxt,
24840 *localName = xmlDictLookup(vctxt->dict, value, -1);
24842 *localName = xmlDictLookup(vctxt->dict, local, -1);
24846 *nsName = xmlSchemaLookupNamespace(vctxt, prefix);
24854 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24868 xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt,
24897 ret = xmlSchemaVExpandQName(vctxt, iattr->value,
24912 *localType = xmlSchemaGetType(vctxt->schema, local, nsName);
24916 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24923 ret = vctxt->err;
24965 * if ((vctxt->pctxt == NULL) &&
24966 * (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
24970 if (xmlSchemaCheckCOSDerivedOK(ACTXT_CAST vctxt, *localType,
24974 xmlSchemaCustomErr(ACTXT_CAST vctxt,
24984 ret = vctxt->err;
24998 xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt)
25000 xmlSchemaElementPtr elemDecl = vctxt->inode->decl;
25009 return (vctxt->err);
25018 return (vctxt->err);
25025 if (vctxt->nbAttrInfos != 0) {
25032 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25040 ACTXT_CAST vctxt, NULL,
25071 vctxt->inode->flags |=
25081 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25086 ret = xmlSchemaProcessXSIType(vctxt, iattr, &localType,
25098 vctxt->inode->flags |= XML_SCHEMA_ELEM_INFO_LOCAL_TYPE;
25107 (xmlSchemaIDCRegisterMatchers(vctxt, elemDecl) == -1))
25120 vctxt->inode->typeDef = actualType;
25126 xmlSchemaVAttributesSimple(xmlSchemaValidCtxtPtr vctxt)
25138 if (vctxt->nbAttrInfos == 0)
25140 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25141 iattr = vctxt->attrInfos[i];
25144 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25157 xmlSchemaClearAttrInfos(xmlSchemaValidCtxtPtr vctxt)
25162 if (vctxt->nbAttrInfos == 0)
25164 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25165 attr = vctxt->attrInfos[i];
25182 vctxt->nbAttrInfos = 0;
25196 xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt)
25198 xmlSchemaTypePtr type = vctxt->inode->typeDef;
25230 nbAttrs = vctxt->nbAttrInfos;
25240 iattr = vctxt->attrInfos[j];
25293 tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt);
25309 tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt);
25325 if (vctxt->nbAttrInfos == 0)
25336 iattr = vctxt->attrInfos[i];
25379 iattr->decl = xmlSchemaGetAttributeDecl(vctxt->schema,
25445 if (vctxt->nbAttrInfos == 0)
25452 if (vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) {
25453 xmlSchemaNodeInfoPtr ielem = vctxt->elemInfos[vctxt->depth];
25460 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25461 iattr = vctxt->attrInfos[i];
25482 if (vctxt->xpathStates != NULL) {
25486 xpathRes = xmlSchemaXPathEvaluate(vctxt,
25581 ns = xmlNewNs(vctxt->validationRoot,
25603 if (vctxt->value != NULL) {
25607 xmlSchemaFreeValue(vctxt->value);
25608 vctxt->value = NULL;
25635 ACTXT_CAST vctxt,
25640 ACTXT_CAST vctxt,
25722 if (xmlSchemaXPathProcessHistory(vctxt,
25723 vctxt->depth +1) == -1) {
25728 } else if (vctxt->xpathStates != NULL)
25729 xmlSchemaXPathPop(vctxt);
25735 for (i = 0; i < vctxt->nbAttrInfos; i++) {
25736 iattr = vctxt->attrInfos[i];
25747 xmlSchemaCustomErr(ACTXT_CAST vctxt,
25762 xmlSchemaCustomErr(ACTXT_CAST vctxt,
25781 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25784 xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
25801 xmlSchemaValidateElemWildcard(xmlSchemaValidCtxtPtr vctxt,
25804 xmlSchemaWildcardPtr wild = (xmlSchemaWildcardPtr) vctxt->inode->decl;
25827 decl = xmlSchemaGetElem(vctxt->schema,
25828 vctxt->inode->localName, vctxt->inode->nsName);
25830 vctxt->inode->decl = decl;
25839 return (vctxt->err);
25841 if (vctxt->nbAttrInfos != 0) {
25849 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25852 if (xmlSchemaProcessXSIType(vctxt, iattr,
25853 &(vctxt->inode->typeDef), NULL) == -1) {
25870 vctxt->inode->typeDef =
25883 xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt,
25888 xmlSchemaNodeInfoPtr inode = vctxt->inode;
25931 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25936 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25947 xmlSchemaVContentModelCallback(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED,
25975 xmlSchemaValidatorPushElem(xmlSchemaValidCtxtPtr vctxt)
25977 vctxt->inode = xmlSchemaGetFreshElemInfo(vctxt);
25978 if (vctxt->inode == NULL) {
25983 vctxt->nbAttrInfos = 0;
25988 xmlSchemaVCheckINodeDataType(xmlSchemaValidCtxtPtr vctxt,
25995 ACTXT_CAST vctxt, NULL,
25999 ACTXT_CAST vctxt, NULL,
26009 xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
26012 xmlSchemaNodeInfoPtr inode = vctxt->inode;
26014 if (vctxt->nbAttrInfos != 0)
26015 xmlSchemaClearAttrInfos(vctxt);
26022 vctxt->skipDepth = vctxt->depth -1;
26057 vctxt);
26096 xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
26127 if (vctxt->value != NULL) {
26128 xmlSchemaFreeValue(vctxt->value);
26129 vctxt->value = NULL;
26139 ret = xmlSchemaVCheckINodeDataType(vctxt,
26142 ret = xmlSchemaVCheckINodeDataType(vctxt,
26181 ret = xmlSchemaCheckCOSValidDefault(vctxt,
26206 ret = xmlSchemaVCheckINodeDataType(vctxt,
26209 ret = xmlSchemaVCheckINodeDataType(vctxt,
26226 if ((vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) &&
26263 ret = xmlSchemaVCheckINodeDataType(vctxt,
26278 ret = xmlSchemaVCheckINodeDataType(vctxt,
26334 xmlSchemaCustomErr(ACTXT_CAST vctxt,
26357 xmlSchemaCustomErr(ACTXT_CAST vctxt,
26371 if (vctxt->depth < 0) {
26375 if (vctxt->depth == vctxt->skipDepth)
26376 vctxt->skipDepth = -1;
26381 (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1))
26400 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables))
26402 if (xmlSchemaIDCFillNodeTables(vctxt, inode) == -1)
26408 if (vctxt->inode->hasKeyrefs)
26409 if (xmlSchemaCheckCVCIDCKeyRef(vctxt) == -1)
26421 if ((vctxt->depth > 0) &&
26422 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables))
26427 if (xmlSchemaBubbleIDCNodeTables(vctxt) == -1)
26436 xmlSchemaClearElemInfo(vctxt, inode);
26440 if (vctxt->depth == 0) {
26441 vctxt->depth--;
26442 vctxt->inode = NULL;
26448 if (vctxt->aidcs != NULL) {
26449 xmlSchemaIDCAugPtr aidc = vctxt->aidcs;
26451 if (aidc->keyrefDepth == vctxt->depth) {
26462 vctxt->depth--;
26463 vctxt->inode = vctxt->elemInfos[vctxt->depth];
26471 vctxt->err = -1;
26480 xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt)
26486 if (vctxt->depth <= 0) {
26491 pielem = vctxt->elemInfos[vctxt->depth -1];
26518 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
26519 vctxt->inode->localName,
26520 vctxt->inode->nsName);
26522 if (vctxt->inode->decl == NULL) {
26528 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
26531 ret = xmlSchemaProcessXSIType(vctxt, iattr,
26532 &(vctxt->inode->typeDef), NULL);
26553 vctxt->inode->typeDef =
26606 vctxt);
26628 vctxt->inode->localName,
26629 vctxt->inode->nsName,
26630 vctxt->inode);
26635 vctxt->inode->localName, pielem->localName);
26639 vctxt->inode->localName, pielem->localName);
26641 if (vctxt->err == XML_SCHEMAV_INTERNAL) {
26649 xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
26653 ret = vctxt->err;
26682 ret = vctxt->err;
26695 vctxt->skipDepth = vctxt->depth;
26696 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_NOT_EXPECTED;
26706 xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt,
26721 if (INODE_NILLED(vctxt->inode)) {
26730 return (vctxt->err);
26737 if (vctxt->inode->typeDef->contentType ==
26742 return (vctxt->err);
26745 if (vctxt->inode->typeDef->contentType ==
26760 return (vctxt->err);
26772 if ((vctxt->inode->typeDef->contentType == XML_SCHEMA_CONTENT_MIXED) &&
26773 ((vctxt->inode->decl == NULL) ||
26774 (vctxt->inode->decl->value == NULL)))
26777 if (vctxt->inode->value == NULL) {
26786 vctxt->inode->value = value;
26793 vctxt->inode->value = value;
26796 vctxt->inode->flags |=
26805 vctxt->inode->value = BAD_CAST xmlStrndup(value, len);
26807 vctxt->inode->value = BAD_CAST xmlStrdup(value);
26808 vctxt->inode->flags |=
26820 if (vctxt->inode->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) {
26821 vctxt->inode->value = BAD_CAST xmlStrncat(
26822 (xmlChar *) vctxt->inode->value, value, len);
26824 vctxt->inode->value =
26825 BAD_CAST xmlStrncatNew(vctxt->inode->value, value, len);
26826 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES;
26834 xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt)
26838 if ((vctxt->skipDepth != -1) &&
26839 (vctxt->depth >= vctxt->skipDepth)) {
26844 if (vctxt->xsiAssemble) {
26855 ret = xmlSchemaAssembleByXSI(vctxt);
26859 vctxt->skipDepth = 0;
26866 xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt);
26868 if (vctxt->depth > 0) {
26873 ret = xmlSchemaValidateChildElem(vctxt);
26882 if (vctxt->depth == vctxt->skipDepth)
26884 if ((vctxt->inode->decl == NULL) &&
26885 (vctxt->inode->typeDef == NULL)) {
26895 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
26896 vctxt->inode->localName,
26897 vctxt->inode->nsName);
26898 if (vctxt->inode->decl == NULL) {
26907 if (vctxt->inode->decl == NULL)
26910 if (vctxt->inode->decl->type == XML_SCHEMA_TYPE_ANY) {
26915 ret = xmlSchemaValidateElemWildcard(vctxt, &skip);
26925 vctxt->skipDepth = vctxt->depth;
26932 if (vctxt->inode->decl->type != XML_SCHEMA_TYPE_ELEMENT) {
26936 vctxt->inode->decl = NULL;
26943 ret = xmlSchemaValidateElemDecl(vctxt);
26957 if (vctxt->inode->typeDef == NULL) {
26958 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26964 if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) {
26965 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26976 if (vctxt->xpathStates != NULL) {
26977 ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE);
26978 vctxt->inode->appliedXPath = 1;
26988 if (WXS_IS_COMPLEX(vctxt->inode->typeDef)) {
26989 if ((vctxt->nbAttrInfos != 0) ||
26990 (vctxt->inode->typeDef->attrUses != NULL)) {
26992 ret = xmlSchemaVAttributesComplex(vctxt);
26994 } else if (vctxt->nbAttrInfos != 0) {
26996 ret = xmlSchemaVAttributesSimple(vctxt);
27001 if (vctxt->nbAttrInfos != 0)
27002 xmlSchemaClearAttrInfos(vctxt);
27015 vctxt->skipDepth = vctxt->depth;
27023 xmlSchemaVReaderWalk(xmlSchemaValidCtxtPtr vctxt)
27029 vctxt->depth = -1;
27030 ret = xmlTextReaderRead(vctxt->reader);
27035 nodeType = xmlTextReaderNodeType(vctxt->reader);
27038 ret = xmlTextReaderRead(vctxt->reader);
27045 depth = xmlTextReaderDepth(vctxt->reader);
27046 nodeType = xmlTextReaderNodeType(vctxt->reader);
27050 vctxt->depth++;
27051 if (xmlSchemaValidatorPushElem(vctxt) == -1) {
27056 ielem = vctxt->inode;
27057 ielem->localName = xmlTextReaderLocalName(vctxt->reader);
27058 ielem->nsName = xmlTextReaderNamespaceUri(vctxt->reader);
27063 ret = xmlTextReaderIsEmptyElement(vctxt->reader);
27075 vctxt->nbAttrInfos = 0;
27076 ret = xmlTextReaderMoveToFirstAttribute(vctxt->reader);
27088 if (xmlSchemaValidatorPushAttribute(vctxt, NULL,
27089 (const xmlChar *) xmlTextReaderLocalName(vctxt->reader),
27090 xmlTextReaderNamespaceUri(vctxt->reader), 1,
27091 xmlTextReaderValue(vctxt->reader), 1) == -1) {
27097 ret = xmlTextReaderMoveToNextAttribute(vctxt->reader);
27107 ret = xmlTextReaderMoveToElement(vctxt->reader);
27117 ret= xmlSchemaValidateElem(vctxt);
27126 if (vctxt->depth == vctxt->skipDepth) {
27132 ret = xmlTextReaderRead(vctxt->reader);
27133 curDepth = xmlTextReaderDepth(vctxt->reader);
27135 ret = xmlTextReaderRead(vctxt->reader);
27136 curDepth = xmlTextReaderDepth(vctxt->reader);
27159 ret = xmlSchemaValidatorPopElem(vctxt);
27168 if (vctxt->depth >= 0)
27169 ielem = vctxt->inode;
27184 value = xmlTextReaderValue(vctxt->reader);
27185 ret = xmlSchemaVPushText(vctxt, nodeType, BAD_CAST value,
27204 ret = xmlTextReaderRead(vctxt->reader);
27228 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27230 if (vctxt->depth < 0)
27232 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27234 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY)
27235 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY;
27236 if (xmlSchemaVPushText(vctxt, XML_TEXT_NODE, ch, len,
27240 vctxt->err = -1;
27241 xmlStopParser(vctxt->parserCtxt);
27253 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27255 if (vctxt->depth < 0)
27257 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27259 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY)
27260 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY;
27261 if (xmlSchemaVPushText(vctxt, XML_CDATA_SECTION_NODE, ch, len,
27265 vctxt->err = -1;
27266 xmlStopParser(vctxt->parserCtxt);
27274 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27276 if (vctxt->depth < 0)
27278 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27295 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27306 vctxt->depth++;
27307 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27312 if (xmlSchemaValidatorPushElem(vctxt) == -1) {
27317 ielem = vctxt->inode;
27321 ielem->nodeLine = xmlSAX2GetLineNumber(vctxt->parserCtxt);
27342 xmlSchemaVErrMemory(vctxt,
27356 xmlSchemaVErrMemory(vctxt,
27392 ret = xmlSchemaValidatorPushAttribute(vctxt,
27405 ret = xmlSchemaValidateElem(vctxt);
27418 vctxt->err = -1;
27419 xmlStopParser(vctxt->parserCtxt);
27429 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx;
27435 if (vctxt->skipDepth != -1) {
27436 if (vctxt->depth > vctxt->skipDepth) {
27437 vctxt->depth--;
27440 vctxt->skipDepth = -1;
27445 if ((!xmlStrEqual(vctxt->inode->localName, localname)) ||
27446 (!xmlStrEqual(vctxt->inode->nsName, URI))) {
27450 res = xmlSchemaValidatorPopElem(vctxt);
27462 vctxt->err = -1;
27463 xmlStopParser(vctxt->parserCtxt);
27501 * @vctxt: the schema validation context
27508 xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, const char *filename) {
27509 if (vctxt == NULL)
27511 if (vctxt->filename != NULL)
27512 xmlFree(vctxt->filename);
27514 vctxt->filename = (char *) xmlStrdup((const xmlChar *) filename);
27516 vctxt->filename = NULL;
27521 * @vctxt: the schema validation context
27527 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
27529 if (vctxt == NULL)
27537 vctxt->flags = 0;
27538 vctxt->validationRoot = NULL;
27539 vctxt->doc = NULL;
27541 vctxt->reader = NULL;
27543 vctxt->hasKeyrefs = 0;
27545 if (vctxt->value != NULL) {
27546 xmlSchemaFreeValue(vctxt->value);
27547 vctxt->value = NULL;
27552 if (vctxt->aidcs != NULL) {
27553 xmlSchemaIDCAugPtr cur = vctxt->aidcs, next;
27559 vctxt->aidcs = NULL;
27561 if (vctxt->idcMatcherCache != NULL) {
27562 xmlSchemaIDCMatcherPtr matcher = vctxt->idcMatcherCache, tmp;
27569 vctxt->idcMatcherCache = NULL;
27573 if (vctxt->idcNodes != NULL) {
27577 for (i = 0; i < vctxt->nbIdcNodes; i++) {
27578 item = vctxt->idcNodes[i];
27582 xmlFree(vctxt->idcNodes);
27583 vctxt->idcNodes = NULL;
27584 vctxt->nbIdcNodes = 0;
27585 vctxt->sizeIdcNodes = 0;
27590 if (vctxt->xpathStates != NULL) {
27591 xmlSchemaFreeIDCStateObjList(vctxt->xpathStates);
27592 vctxt->xpathStates = NULL;
27597 if (vctxt->nbAttrInfos != 0) {
27598 xmlSchemaClearAttrInfos(vctxt);
27603 if (vctxt->elemInfos != NULL) {
27607 for (i = 0; i < vctxt->sizeElemInfos; i++) {
27608 ei = vctxt->elemInfos[i];
27611 xmlSchemaClearElemInfo(vctxt, ei);
27614 xmlSchemaItemListClear(vctxt->nodeQNames);
27616 xmlDictFree(vctxt->dict);
27621 vctxt->dict = xmlDictCreate();
27623 if (vctxt->filename != NULL) {
27624 xmlFree(vctxt->filename);
27625 vctxt->filename = NULL;
27859 xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
27868 if (vctxt->validationRoot != NULL)
27869 valRoot = vctxt->validationRoot;
27871 valRoot = xmlDocGetRootElement(vctxt->doc);
27877 vctxt->depth = -1;
27878 vctxt->validationRoot = valRoot;
27881 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
27888 vctxt->depth++;
27889 if (xmlSchemaValidatorPushElem(vctxt) == -1)
27891 ielem = vctxt->inode;
27903 vctxt->nbAttrInfos = 0;
27911 ret = xmlSchemaValidatorPushAttribute(vctxt,
27931 ret = xmlSchemaValidateElem(vctxt);
27944 if ((vctxt->skipDepth != -1) &&
27945 (vctxt->depth >= vctxt->skipDepth))
27954 ret = xmlSchemaVPushText(vctxt, node->type, node->content,
27994 if (node != vctxt->inode->node) {
27999 ret = xmlSchemaValidatorPopElem(vctxt);
28026 xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) {
28030 vctxt->err = 0;
28031 vctxt->nberrors = 0;
28032 vctxt->depth = -1;
28033 vctxt->skipDepth = -1;
28034 vctxt->xsiAssemble = 0;
28035 vctxt->hasKeyrefs = 0;
28037 vctxt->createIDCNodeTables = 1;
28039 vctxt->createIDCNodeTables = 0;
28044 if (vctxt->schema == NULL) {
28047 vctxt->xsiAssemble = 1;
28054 if ((vctxt->pctxt == NULL) &&
28055 (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
28057 pctxt = vctxt->pctxt;
28062 vctxt->schema = xmlSchemaNewSchema(pctxt);
28063 if (vctxt->schema == NULL)
28071 pctxt->constructor->mainSchema = vctxt->schema;
28081 xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt);
28087 xmlSchemaPostRun(xmlSchemaValidCtxtPtr vctxt) {
28088 if (vctxt->xsiAssemble) {
28089 if (vctxt->schema != NULL) {
28090 xmlSchemaFree(vctxt->schema);
28091 vctxt->schema = NULL;
28094 xmlSchemaClearValidCtxt(vctxt);
28098 xmlSchemaVStart(xmlSchemaValidCtxtPtr vctxt)
28102 if (xmlSchemaPreRun(vctxt) < 0)
28105 if (vctxt->doc != NULL) {
28109 ret = xmlSchemaVDocWalk(vctxt);
28111 } else if (vctxt->reader != NULL) {
28116 ret = xmlSchemaVReaderWalk(vctxt);
28119 } else if ((vctxt->sax != NULL) && (vctxt->parserCtxt != NULL)) {
28123 ret = xmlParseDocument(vctxt->parserCtxt);
28130 xmlSchemaPostRun(vctxt);
28132 ret = vctxt->err;
28712 * @vctxt: a schema validation context
28723 xmlSchemaValidateSetLocator(xmlSchemaValidCtxtPtr vctxt,
28727 if (vctxt == NULL) return;
28728 vctxt->locFunc = f;
28729 vctxt->locCtxt = ctxt;