Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: third_party/libxml/src/xmlschemas.c

Issue 1193533007: Upgrade to libxml 2.9.2 and libxslt 1.1.28 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: to numbered version, update readme Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * schemas.c : implementation of the XML Schema handling and 2 * schemas.c : implementation of the XML Schema handling and
3 * schema validity checking 3 * schema validity checking
4 * 4 *
5 * See Copyright for the status of this software. 5 * See Copyright for the status of this software.
6 * 6 *
7 * Daniel Veillard <veillard@redhat.com> 7 * Daniel Veillard <veillard@redhat.com>
8 */ 8 */
9 9
10 /* 10 /*
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 /* #define ENABLE_IDC_NODE_TABLES_TEST */ 101 /* #define ENABLE_IDC_NODE_TABLES_TEST */
102 102
103 #define DUMP_CONTENT_MODEL 103 #define DUMP_CONTENT_MODEL
104 104
105 #ifdef LIBXML_READER_ENABLED 105 #ifdef LIBXML_READER_ENABLED
106 /* #define XML_SCHEMA_READER_ENABLED */ 106 /* #define XML_SCHEMA_READER_ENABLED */
107 #endif 107 #endif
108 108
109 #define UNBOUNDED (1 << 30) 109 #define UNBOUNDED (1 << 30)
110 #define TODO » » » » » » » » \ 110 #define TODO» » » » » » » » \
111 xmlGenericError(xmlGenericErrorContext, \ 111 xmlGenericError(xmlGenericErrorContext, \
112 "Unimplemented block at %s:%d\n", \ 112 "Unimplemented block at %s:%d\n", \
113 __FILE__, __LINE__); 113 __FILE__, __LINE__);
114 114
115 #define XML_SCHEMAS_NO_NAMESPACE (const xmlChar *) "##" 115 #define XML_SCHEMAS_NO_NAMESPACE (const xmlChar *) "##"
116 116
117 /* 117 /*
118 * The XML Schemas namespaces 118 * The XML Schemas namespaces
119 */ 119 */
120 static const xmlChar *xmlSchemaNs = (const xmlChar *) 120 static const xmlChar *xmlSchemaNs = (const xmlChar *)
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 xmlSchemaValidityWarningFunc warning; /* the callback in case of warning */ 968 xmlSchemaValidityWarningFunc warning; /* the callback in case of warning */
969 xmlStructuredErrorFunc serror; 969 xmlStructuredErrorFunc serror;
970 970
971 xmlSchemaPtr schema; /* The schema in use */ 971 xmlSchemaPtr schema; /* The schema in use */
972 xmlDocPtr doc; 972 xmlDocPtr doc;
973 xmlParserInputBufferPtr input; 973 xmlParserInputBufferPtr input;
974 xmlCharEncoding enc; 974 xmlCharEncoding enc;
975 xmlSAXHandlerPtr sax; 975 xmlSAXHandlerPtr sax;
976 xmlParserCtxtPtr parserCtxt; 976 xmlParserCtxtPtr parserCtxt;
977 void *user_data; /* TODO: What is this for? */ 977 void *user_data; /* TODO: What is this for? */
978 char *filename;
978 979
979 int err; 980 int err;
980 int nberrors; 981 int nberrors;
981 982
982 xmlNodePtr node; 983 xmlNodePtr node;
983 xmlNodePtr cur; 984 xmlNodePtr cur;
984 /* xmlSchemaTypePtr type; */ 985 /* xmlSchemaTypePtr type; */
985 986
986 xmlRegExecCtxtPtr regexp; 987 xmlRegExecCtxtPtr regexp;
987 xmlSchemaValPtr value; 988 xmlSchemaValPtr value;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1022
1022 xmlSchemaAttrInfoPtr *attrInfos; 1023 xmlSchemaAttrInfoPtr *attrInfos;
1023 int nbAttrInfos; 1024 int nbAttrInfos;
1024 int sizeAttrInfos; 1025 int sizeAttrInfos;
1025 1026
1026 int skipDepth; 1027 int skipDepth;
1027 xmlSchemaItemListPtr nodeQNames; 1028 xmlSchemaItemListPtr nodeQNames;
1028 int hasKeyrefs; 1029 int hasKeyrefs;
1029 int createIDCNodeTables; 1030 int createIDCNodeTables;
1030 int psviExposeIDCNodeTables; 1031 int psviExposeIDCNodeTables;
1032
1033 /* Locator for error reporting in streaming mode */
1034 xmlSchemaValidityLocatorFunc locFunc;
1035 void *locCtxt;
1031 }; 1036 };
1032 1037
1033 /** 1038 /**
1034 * xmlSchemaSubstGroup: 1039 * xmlSchemaSubstGroup:
1035 * 1040 *
1036 * 1041 *
1037 */ 1042 */
1038 typedef struct _xmlSchemaSubstGroup xmlSchemaSubstGroup; 1043 typedef struct _xmlSchemaSubstGroup xmlSchemaSubstGroup;
1039 typedef xmlSchemaSubstGroup *xmlSchemaSubstGroupPtr; 1044 typedef xmlSchemaSubstGroup *xmlSchemaSubstGroupPtr;
1040 struct _xmlSchemaSubstGroup { 1045 struct _xmlSchemaSubstGroup {
1041 xmlSchemaElementPtr head; 1046 xmlSchemaElementPtr head;
1042 xmlSchemaItemListPtr members; 1047 xmlSchemaItemListPtr members;
1043 }; 1048 };
1044 1049
1045 /************************************************************************ 1050 /************************************************************************
1046 * » » » » » » » » » * 1051 *» » » » » » » » » *
1047 * » » » Some predeclarations» » » » * 1052 *» » » Some predeclarations» » » » *
1048 * » » » » » » » » » * 1053 *» » » » » » » » » *
1049 ************************************************************************/ 1054 ************************************************************************/
1050 1055
1051 static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt, 1056 static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt,
1052 xmlSchemaPtr schema, 1057 xmlSchemaPtr schema,
1053 xmlNodePtr node); 1058 xmlNodePtr node);
1054 static int xmlSchemaParseRedefine(xmlSchemaParserCtxtPtr ctxt, 1059 static int xmlSchemaParseRedefine(xmlSchemaParserCtxtPtr ctxt,
1055 xmlSchemaPtr schema, 1060 xmlSchemaPtr schema,
1056 xmlNodePtr node); 1061 xmlNodePtr node);
1057 static int 1062 static int
1058 xmlSchemaTypeFixup(xmlSchemaTypePtr type, 1063 xmlSchemaTypeFixup(xmlSchemaTypePtr type,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 xmlSchemaParserCtxtPtr ctxt); 1096 xmlSchemaParserCtxtPtr ctxt);
1092 static void 1097 static void
1093 xmlSchemaComponentListFree(xmlSchemaItemListPtr list); 1098 xmlSchemaComponentListFree(xmlSchemaItemListPtr list);
1094 static xmlSchemaQNameRefPtr 1099 static xmlSchemaQNameRefPtr
1095 xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, 1100 xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt,
1096 xmlSchemaPtr schema, 1101 xmlSchemaPtr schema,
1097 xmlNodePtr node); 1102 xmlNodePtr node);
1098 1103
1099 /************************************************************************ 1104 /************************************************************************
1100 * * 1105 * *
1101 * » » » Helper functions» » » * 1106 *» » » Helper functions» » » *
1102 * * 1107 * *
1103 ************************************************************************/ 1108 ************************************************************************/
1104 1109
1105 /** 1110 /**
1106 * xmlSchemaItemTypeToStr: 1111 * xmlSchemaItemTypeToStr:
1107 * @type: the type of the schema item 1112 * @type: the type of the schema item
1108 * 1113 *
1109 * Returns the component name of a schema item. 1114 * Returns the component name of a schema item.
1110 */ 1115 */
1111 static const xmlChar * 1116 static const xmlChar *
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 return (BAD_CAST "invalid process contents"); 1464 return (BAD_CAST "invalid process contents");
1460 } 1465 }
1461 } 1466 }
1462 1467
1463 /** 1468 /**
1464 * xmlSchemaGetCanonValueWhtspExt: 1469 * xmlSchemaGetCanonValueWhtspExt:
1465 * @val: the precomputed value 1470 * @val: the precomputed value
1466 * @retValue: the returned value 1471 * @retValue: the returned value
1467 * @ws: the whitespace type of the value 1472 * @ws: the whitespace type of the value
1468 * 1473 *
1469 * Get a the cononical representation of the value. 1474 * Get a the canonical representation of the value.
1470 * The caller has to free the returned retValue. 1475 * The caller has to free the returned retValue.
1471 * 1476 *
1472 * Returns 0 if the value could be built and -1 in case of 1477 * Returns 0 if the value could be built and -1 in case of
1473 * API errors or if the value type is not supported yet. 1478 * API errors or if the value type is not supported yet.
1474 */ 1479 */
1475 static int 1480 static int
1476 xmlSchemaGetCanonValueWhtspExt(xmlSchemaValPtr val, 1481 xmlSchemaGetCanonValueWhtspExt(xmlSchemaValPtr val,
1477 xmlSchemaWhitespaceValueType ws, 1482 xmlSchemaWhitespaceValueType ws,
1478 xmlChar **retValue) 1483 xmlChar **retValue)
1479 { 1484 {
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 if (found) 1834 if (found)
1830 break; 1835 break;
1831 type = type->baseType; 1836 type = type->baseType;
1832 } while ((type != NULL) && (type->type != XML_SCHEMA_TYPE_BASIC)); 1837 } while ((type != NULL) && (type->type != XML_SCHEMA_TYPE_BASIC));
1833 1838
1834 return ((const xmlChar *) *buf); 1839 return ((const xmlChar *) *buf);
1835 } 1840 }
1836 1841
1837 /************************************************************************ 1842 /************************************************************************
1838 * * 1843 * *
1839 * » » » Error functions»» » » * 1844 *» » » Error functions»» » » *
1840 * * 1845 * *
1841 ************************************************************************/ 1846 ************************************************************************/
1842 1847
1843 #if 0 1848 #if 0
1844 static void 1849 static void
1845 xmlSchemaErrMemory(const char *msg) 1850 xmlSchemaErrMemory(const char *msg)
1846 { 1851 {
1847 __xmlSimpleError(XML_FROM_SCHEMASP, XML_ERR_NO_MEMORY, NULL, NULL, 1852 __xmlSimpleError(XML_FROM_SCHEMASP, XML_ERR_NO_MEMORY, NULL, NULL,
1848 msg); 1853 msg);
1849 } 1854 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 } 1972 }
1968 __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP, 1973 __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP,
1969 error, XML_ERR_ERROR, NULL, 0, 1974 error, XML_ERR_ERROR, NULL, 0,
1970 (const char *) strData1, (const char *) strData2, 1975 (const char *) strData1, (const char *) strData2,
1971 (const char *) strData3, 0, 0, msg, str1, str2, 1976 (const char *) strData3, 0, 0, msg, str1, str2,
1972 str3, str4, str5); 1977 str3, str4, str5);
1973 } 1978 }
1974 1979
1975 /************************************************************************ 1980 /************************************************************************
1976 * * 1981 * *
1977 * » » » Allround error functions» » » * 1982 *» » » Allround error functions» » » *
1978 * * 1983 * *
1979 ************************************************************************/ 1984 ************************************************************************/
1980 1985
1981 /** 1986 /**
1982 * xmlSchemaVTypeErrMemory: 1987 * xmlSchemaVTypeErrMemory:
1983 * @node: a context node 1988 * @node: a context node
1984 * @extra: extra informations 1989 * @extra: extra informations
1985 * 1990 *
1986 * Handle an out of memory condition 1991 * Handle an out of memory condition
1987 */ 1992 */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 const xmlChar *str3, const xmlChar *str4) 2032 const xmlChar *str3, const xmlChar *str4)
2028 { 2033 {
2029 xmlStructuredErrorFunc schannel = NULL; 2034 xmlStructuredErrorFunc schannel = NULL;
2030 xmlGenericErrorFunc channel = NULL; 2035 xmlGenericErrorFunc channel = NULL;
2031 void *data = NULL; 2036 void *data = NULL;
2032 2037
2033 if (ctxt != NULL) { 2038 if (ctxt != NULL) {
2034 if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) { 2039 if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
2035 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt; 2040 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt;
2036 const char *file = NULL; 2041 const char *file = NULL;
2042 int col = 0;
2037 if (errorLevel != XML_ERR_WARNING) { 2043 if (errorLevel != XML_ERR_WARNING) {
2038 vctxt->nberrors++; 2044 vctxt->nberrors++;
2039 vctxt->err = error; 2045 vctxt->err = error;
2040 channel = vctxt->error; 2046 channel = vctxt->error;
2041 } else { 2047 } else {
2042 channel = vctxt->warning; 2048 channel = vctxt->warning;
2043 } 2049 }
2044 schannel = vctxt->serror; 2050 schannel = vctxt->serror;
2045 data = vctxt->errCtxt; 2051 data = vctxt->errCtxt;
2046 2052
2047 /* 2053 /*
2048 * Error node. If we specify a line number, then 2054 * Error node. If we specify a line number, then
2049 * do not channel any node to the error function. 2055 * do not channel any node to the error function.
2050 */ 2056 */
2051 if (line == 0) { 2057 if (line == 0) {
2052 if ((node == NULL) && 2058 if ((node == NULL) &&
2053 (vctxt->depth >= 0) && 2059 (vctxt->depth >= 0) &&
2054 (vctxt->inode != NULL)) { 2060 (vctxt->inode != NULL)) {
2055 node = vctxt->inode->node; 2061 node = vctxt->inode->node;
2056 } 2062 }
2057 /* 2063 /*
2058 * Get filename and line if no node-tree. 2064 * Get filename and line if no node-tree.
2059 */ 2065 */
2060 if ((node == NULL) && 2066 if ((node == NULL) &&
2061 (vctxt->parserCtxt != NULL) && 2067 (vctxt->parserCtxt != NULL) &&
2062 (vctxt->parserCtxt->input != NULL)) { 2068 (vctxt->parserCtxt->input != NULL)) {
2063 file = vctxt->parserCtxt->input->filename; 2069 file = vctxt->parserCtxt->input->filename;
2064 line = vctxt->parserCtxt->input->line; 2070 line = vctxt->parserCtxt->input->line;
2071 col = vctxt->parserCtxt->input->col;
2065 } 2072 }
2066 } else { 2073 } else {
2067 /* 2074 /*
2068 * Override the given node's (if any) position 2075 * Override the given node's (if any) position
2069 * and channel only the given line number. 2076 * and channel only the given line number.
2070 */ 2077 */
2071 node = NULL; 2078 node = NULL;
2072 /* 2079 /*
2073 * Get filename. 2080 * Get filename.
2074 */ 2081 */
2075 if (vctxt->doc != NULL) 2082 if (vctxt->doc != NULL)
2076 file = (const char *) vctxt->doc->URL; 2083 file = (const char *) vctxt->doc->URL;
2077 else if ((vctxt->parserCtxt != NULL) && 2084 else if ((vctxt->parserCtxt != NULL) &&
2078 (vctxt->parserCtxt->input != NULL)) 2085 (vctxt->parserCtxt->input != NULL))
2079 file = vctxt->parserCtxt->input->filename; 2086 file = vctxt->parserCtxt->input->filename;
2080 } 2087 }
2088 if (vctxt->locFunc != NULL) {
2089 if ((file == NULL) || (line == 0)) {
2090 unsigned long l;
2091 const char *f;
2092 vctxt->locFunc(vctxt->locCtxt, &f, &l);
2093 if (file == NULL)
2094 file = f;
2095 if (line == 0)
2096 line = (int) l;
2097 }
2098 }
2099 if ((file == NULL) && (vctxt->filename != NULL))
2100 file = vctxt->filename;
2101
2081 __xmlRaiseError(schannel, channel, data, ctxt, 2102 __xmlRaiseError(schannel, channel, data, ctxt,
2082 node, XML_FROM_SCHEMASV, 2103 node, XML_FROM_SCHEMASV,
2083 error, errorLevel, file, line, 2104 error, errorLevel, file, line,
2084 (const char *) str1, (const char *) str2, 2105 (const char *) str1, (const char *) str2,
2085 » » (const char *) str3, 0, 0, msg, str1, str2, str3, str4); 2106 » » (const char *) str3, 0, col, msg, str1, str2, str3, str4);
2086 2107
2087 } else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) { 2108 } else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) {
2088 xmlSchemaParserCtxtPtr pctxt = (xmlSchemaParserCtxtPtr) ctxt; 2109 xmlSchemaParserCtxtPtr pctxt = (xmlSchemaParserCtxtPtr) ctxt;
2089 if (errorLevel != XML_ERR_WARNING) { 2110 if (errorLevel != XML_ERR_WARNING) {
2090 pctxt->nberrors++; 2111 pctxt->nberrors++;
2091 pctxt->err = error; 2112 pctxt->err = error;
2092 channel = pctxt->error; 2113 channel = pctxt->error;
2093 } else { 2114 } else {
2094 channel = pctxt->warning; 2115 channel = pctxt->warning;
2095 } 2116 }
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 } else { 3213 } else {
3193 xmlSchemaPErr2(ctxt, ownerElem, child, error, 3214 xmlSchemaPErr2(ctxt, ownerElem, child, error,
3194 "%s: The content is not valid.\n", 3215 "%s: The content is not valid.\n",
3195 BAD_CAST des, NULL); 3216 BAD_CAST des, NULL);
3196 } 3217 }
3197 } 3218 }
3198 FREE_AND_NULL(des) 3219 FREE_AND_NULL(des)
3199 } 3220 }
3200 3221
3201 /************************************************************************ 3222 /************************************************************************
3202 * » » » » » » » » » * 3223 *» » » » » » » » » *
3203 * » » » Streamable error functions * 3224 *» » » Streamable error functions *
3204 * » » » » » » » » » * 3225 *» » » » » » » » » *
3205 ************************************************************************/ 3226 ************************************************************************/
3206 3227
3207 3228
3208 3229
3209 3230
3210 /************************************************************************ 3231 /************************************************************************
3211 * » » » » » » » » » * 3232 *» » » » » » » » » *
3212 * » » » Validation helper functions» » » * 3233 *» » » Validation helper functions» » » *
3213 * » » » » » » » » » * 3234 *» » » » » » » » » *
3214 ************************************************************************/ 3235 ************************************************************************/
3215 3236
3216 3237
3217 /************************************************************************ 3238 /************************************************************************
3218 * » » » » » » » » » * 3239 *» » » » » » » » » *
3219 * » » » Allocation functions» » » » * 3240 *» » » Allocation functions» » » » *
3220 * » » » » » » » » » * 3241 *» » » » » » » » » *
3221 ************************************************************************/ 3242 ************************************************************************/
3222 3243
3223 /** 3244 /**
3224 * xmlSchemaNewSchemaForParserCtxt: 3245 * xmlSchemaNewSchemaForParserCtxt:
3225 * @ctxt: a schema validation context 3246 * @ctxt: a schema validation context
3226 * 3247 *
3227 * Allocate a new Schema structure. 3248 * Allocate a new Schema structure.
3228 * 3249 *
3229 * Returns the newly allocated structure or NULL in case or error 3250 * Returns the newly allocated structure or NULL in case or error
3230 */ 3251 */
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 } 4149 }
4129 if (schema->annot != NULL) 4150 if (schema->annot != NULL)
4130 xmlSchemaFreeAnnot(schema->annot); 4151 xmlSchemaFreeAnnot(schema->annot);
4131 /* Never free the doc here, since this will be done by the buckets. */ 4152 /* Never free the doc here, since this will be done by the buckets. */
4132 4153
4133 xmlDictFree(schema->dict); 4154 xmlDictFree(schema->dict);
4134 xmlFree(schema); 4155 xmlFree(schema);
4135 } 4156 }
4136 4157
4137 /************************************************************************ 4158 /************************************************************************
4138 * » » » » » » » » » * 4159 *» » » » » » » » » *
4139 * » » » Debug functions»» » » » * 4160 *» » » Debug functions»» » » » *
4140 * » » » » » » » » » * 4161 *» » » » » » » » » *
4141 ************************************************************************/ 4162 ************************************************************************/
4142 4163
4143 #ifdef LIBXML_OUTPUT_ENABLED 4164 #ifdef LIBXML_OUTPUT_ENABLED
4144 4165
4145 static void 4166 static void
4146 xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output); /* forward */ 4167 xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output); /* forward */
4147 4168
4148 /** 4169 /**
4149 * xmlSchemaElementDump: 4170 * xmlSchemaElementDump:
4150 * @elem: an element 4171 * @elem: an element
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
4580 } 4601 }
4581 } 4602 }
4582 bind = bind->next; 4603 bind = bind->next;
4583 } while (bind != NULL); 4604 } while (bind != NULL);
4584 } 4605 }
4585 #endif /* DEBUG_IDC */ 4606 #endif /* DEBUG_IDC */
4586 #endif /* LIBXML_OUTPUT_ENABLED */ 4607 #endif /* LIBXML_OUTPUT_ENABLED */
4587 4608
4588 /************************************************************************ 4609 /************************************************************************
4589 * * 4610 * *
4590 * » » » Utilities» » » » » * 4611 *» » » Utilities» » » » » *
4591 * * 4612 * *
4592 ************************************************************************/ 4613 ************************************************************************/
4593 4614
4594 /** 4615 /**
4595 * xmlSchemaGetPropNode: 4616 * xmlSchemaGetPropNode:
4596 * @node: the element node 4617 * @node: the element node
4597 * @name: the name of the attribute 4618 * @name: the name of the attribute
4598 * 4619 *
4599 * Seeks an attribute with a name of @name in 4620 * Seeks an attribute with a name of @name in
4600 * no namespace. 4621 * no namespace.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
4685 4706
4686 val = xmlGetNoNsProp(node, BAD_CAST name); 4707 val = xmlGetNoNsProp(node, BAD_CAST name);
4687 if (val == NULL) 4708 if (val == NULL)
4688 return(NULL); 4709 return(NULL);
4689 ret = xmlDictLookup(ctxt->dict, val, -1); 4710 ret = xmlDictLookup(ctxt->dict, val, -1);
4690 xmlFree(val); 4711 xmlFree(val);
4691 return(ret); 4712 return(ret);
4692 } 4713 }
4693 4714
4694 /************************************************************************ 4715 /************************************************************************
4695 * » » » » » » » » » * 4716 *» » » » » » » » » *
4696 * » » » Parsing functions» » » » * 4717 *» » » Parsing functions» » » » *
4697 * » » » » » » » » » * 4718 *» » » » » » » » » *
4698 ************************************************************************/ 4719 ************************************************************************/
4699 4720
4700 #define WXS_FIND_GLOBAL_ITEM(slot) \ 4721 #define WXS_FIND_GLOBAL_ITEM(slot) \
4701 if (xmlStrEqual(nsName, schema->targetNamespace)) { \ 4722 if (xmlStrEqual(nsName, schema->targetNamespace)) { \
4702 ret = xmlHashLookup(schema->slot, name); \ 4723 ret = xmlHashLookup(schema->slot, name); \
4703 if (ret != NULL) goto exit; \ 4724 if (ret != NULL) goto exit; \
4704 } \ 4725 } \
4705 if (xmlHashSize(schema->schemasImports) > 1) { \ 4726 if (xmlHashSize(schema->schemasImports) > 1) { \
4706 xmlSchemaImportPtr import; \ 4727 xmlSchemaImportPtr import; \
4707 if (nsName == NULL) \ 4728 if (nsName == NULL) \
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
4959 case XML_SCHEMA_TYPE_ELEMENT: 4980 case XML_SCHEMA_TYPE_ELEMENT:
4960 return ((xmlSchemaBasicItemPtr) xmlSchemaGetElem(schema, 4981 return ((xmlSchemaBasicItemPtr) xmlSchemaGetElem(schema,
4961 name, targetNs)); 4982 name, targetNs));
4962 default: 4983 default:
4963 TODO 4984 TODO
4964 return (NULL); 4985 return (NULL);
4965 } 4986 }
4966 } 4987 }
4967 4988
4968 /************************************************************************ 4989 /************************************************************************
4969 * » » » » » » » » » * 4990 *» » » » » » » » » *
4970 * » » » Parsing functions» » » » * 4991 *» » » Parsing functions» » » » *
4971 * » » » » » » » » » * 4992 *» » » » » » » » » *
4972 ************************************************************************/ 4993 ************************************************************************/
4973 4994
4974 #define IS_BLANK_NODE(n) \ 4995 #define IS_BLANK_NODE(n) \
4975 (((n)->type == XML_TEXT_NODE) && (xmlSchemaIsBlank((n)->content, -1))) 4996 (((n)->type == XML_TEXT_NODE) && (xmlSchemaIsBlank((n)->content, -1)))
4976 4997
4977 /** 4998 /**
4978 * xmlSchemaIsBlank: 4999 * xmlSchemaIsBlank:
4979 * @str: a string 5000 * @str: a string
4980 * @len: the length of the string or -1 5001 * @len: the length of the string or -1
4981 * 5002 *
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
5736 if (substGroup == NULL) 5757 if (substGroup == NULL)
5737 substGroup = xmlSchemaSubstGroupAdd(pctxt, head); 5758 substGroup = xmlSchemaSubstGroupAdd(pctxt, head);
5738 if (substGroup == NULL) 5759 if (substGroup == NULL)
5739 return(-1); 5760 return(-1);
5740 if (xmlSchemaItemListAdd(substGroup->members, member) == -1) 5761 if (xmlSchemaItemListAdd(substGroup->members, member) == -1)
5741 return(-1); 5762 return(-1);
5742 return(0); 5763 return(0);
5743 } 5764 }
5744 5765
5745 /************************************************************************ 5766 /************************************************************************
5746 * » » » » » » » » » * 5767 *» » » » » » » » » *
5747 * Utilities for parsing * 5768 * Utilities for parsing *
5748 * » » » » » » » » » * 5769 *» » » » » » » » » *
5749 ************************************************************************/ 5770 ************************************************************************/
5750 5771
5751 /** 5772 /**
5752 * xmlSchemaPValAttrNodeQNameValue: 5773 * xmlSchemaPValAttrNodeQNameValue:
5753 * @ctxt: a schema parser context 5774 * @ctxt: a schema parser context
5754 * @schema: the schema context 5775 * @schema: the schema context
5755 * @ownerDes: the designation of the parent element 5776 * @ownerDes: the designation of the parent element
5756 * @ownerItem: the parent as a schema object 5777 * @ownerItem: the parent as a schema object
5757 * @value: the QName value 5778 * @value: the QName value
5758 * @local: the resulting local part if found, the attribute value otherwise 5779 * @local: the resulting local part if found, the attribute value otherwise
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5932 5953
5933 /* 5954 /*
5934 * TODO: Use xmlSchemaStrip here; it's not exported at this 5955 * TODO: Use xmlSchemaStrip here; it's not exported at this
5935 * moment. 5956 * moment.
5936 */ 5957 */
5937 strip = xmlSchemaCollapseString(value); 5958 strip = xmlSchemaCollapseString(value);
5938 if (strip != NULL) { 5959 if (strip != NULL) {
5939 xmlFree((xmlChar *) value); 5960 xmlFree((xmlChar *) value);
5940 value = strip; 5961 value = strip;
5941 } 5962 }
5942 » res = xmlAddID(NULL, attr->doc, value, attr); 5963 » res = xmlAddID(NULL, attr->doc, value, attr);
5943 if (res == NULL) { 5964 if (res == NULL) {
5944 ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; 5965 ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE;
5945 xmlSchemaPSimpleTypeErr(ctxt, 5966 xmlSchemaPSimpleTypeErr(ctxt,
5946 XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, 5967 XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
5947 NULL, (xmlNodePtr) attr, 5968 NULL, (xmlNodePtr) attr,
5948 xmlSchemaGetBuiltInType(XML_SCHEMAS_ID), 5969 xmlSchemaGetBuiltInType(XML_SCHEMAS_ID),
5949 NULL, NULL, "Duplicate value '%s' of simple " 5970 NULL, NULL, "Duplicate value '%s' of simple "
5950 "type 'xs:ID'", value, NULL); 5971 "type 'xs:ID'", value, NULL);
5951 } else 5972 } else
5952 attr->atype = XML_ATTRIBUTE_ID; 5973 attr->atype = XML_ATTRIBUTE_ID;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
6113 xmlSchemaPGetBoolNodeValue(xmlSchemaParserCtxtPtr ctxt, 6134 xmlSchemaPGetBoolNodeValue(xmlSchemaParserCtxtPtr ctxt,
6114 xmlSchemaBasicItemPtr ownerItem, 6135 xmlSchemaBasicItemPtr ownerItem,
6115 xmlNodePtr node) 6136 xmlNodePtr node)
6116 { 6137 {
6117 xmlChar *value = NULL; 6138 xmlChar *value = NULL;
6118 int res = 0; 6139 int res = 0;
6119 6140
6120 value = xmlNodeGetContent(node); 6141 value = xmlNodeGetContent(node);
6121 /* 6142 /*
6122 * 3.2.2.1 Lexical representation 6143 * 3.2.2.1 Lexical representation
6123 * An instance of a datatype that is defined as �boolean� 6144 * An instance of a datatype that is defined as `boolean`
6124 * can have the following legal literals {true, false, 1, 0}. 6145 * can have the following legal literals {true, false, 1, 0}.
6125 */ 6146 */
6126 if (xmlStrEqual(BAD_CAST value, BAD_CAST "true")) 6147 if (xmlStrEqual(BAD_CAST value, BAD_CAST "true"))
6127 res = 1; 6148 res = 1;
6128 else if (xmlStrEqual(BAD_CAST value, BAD_CAST "false")) 6149 else if (xmlStrEqual(BAD_CAST value, BAD_CAST "false"))
6129 res = 0; 6150 res = 0;
6130 else if (xmlStrEqual(BAD_CAST value, BAD_CAST "1")) 6151 else if (xmlStrEqual(BAD_CAST value, BAD_CAST "1"))
6131 res = 1; 6152 res = 1;
6132 else if (xmlStrEqual(BAD_CAST value, BAD_CAST "0")) 6153 else if (xmlStrEqual(BAD_CAST value, BAD_CAST "0"))
6133 res = 0; 6154 res = 0;
(...skipping 27 matching lines...) Expand all
6161 xmlNodePtr node, 6182 xmlNodePtr node,
6162 const char *name, int def) 6183 const char *name, int def)
6163 { 6184 {
6164 const xmlChar *val; 6185 const xmlChar *val;
6165 6186
6166 val = xmlSchemaGetProp(ctxt, node, name); 6187 val = xmlSchemaGetProp(ctxt, node, name);
6167 if (val == NULL) 6188 if (val == NULL)
6168 return (def); 6189 return (def);
6169 /* 6190 /*
6170 * 3.2.2.1 Lexical representation 6191 * 3.2.2.1 Lexical representation
6171 * An instance of a datatype that is defined as �boolean� 6192 * An instance of a datatype that is defined as `boolean`
6172 * can have the following legal literals {true, false, 1, 0}. 6193 * can have the following legal literals {true, false, 1, 0}.
6173 */ 6194 */
6174 if (xmlStrEqual(val, BAD_CAST "true")) 6195 if (xmlStrEqual(val, BAD_CAST "true"))
6175 def = 1; 6196 def = 1;
6176 else if (xmlStrEqual(val, BAD_CAST "false")) 6197 else if (xmlStrEqual(val, BAD_CAST "false"))
6177 def = 0; 6198 def = 0;
6178 else if (xmlStrEqual(val, BAD_CAST "1")) 6199 else if (xmlStrEqual(val, BAD_CAST "1"))
6179 def = 1; 6200 def = 1;
6180 else if (xmlStrEqual(val, BAD_CAST "0")) 6201 else if (xmlStrEqual(val, BAD_CAST "0"))
6181 def = 0; 6202 def = 0;
6182 else { 6203 else {
6183 xmlSchemaPSimpleTypeErr(ctxt, 6204 xmlSchemaPSimpleTypeErr(ctxt,
6184 XML_SCHEMAP_INVALID_BOOLEAN, 6205 XML_SCHEMAP_INVALID_BOOLEAN,
6185 NULL, 6206 NULL,
6186 (xmlNodePtr) xmlSchemaGetPropNode(node, name), 6207 (xmlNodePtr) xmlSchemaGetPropNode(node, name),
6187 xmlSchemaGetBuiltInType(XML_SCHEMAS_BOOLEAN), 6208 xmlSchemaGetBuiltInType(XML_SCHEMAS_BOOLEAN),
6188 NULL, val, NULL, NULL, NULL); 6209 NULL, val, NULL, NULL, NULL);
6189 } 6210 }
6190 return (def); 6211 return (def);
6191 } 6212 }
6192 6213
6193 /************************************************************************ 6214 /************************************************************************
6194 * » » » » » » » » » * 6215 *» » » » » » » » » *
6195 * Shema extraction from an Infoset * 6216 * Shema extraction from an Infoset *
6196 * » » » » » » » » » * 6217 *» » » » » » » » » *
6197 ************************************************************************/ 6218 ************************************************************************/
6198 static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr 6219 static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr
6199 ctxt, xmlSchemaPtr schema, 6220 ctxt, xmlSchemaPtr schema,
6200 xmlNodePtr node, 6221 xmlNodePtr node,
6201 int topLevel); 6222 int topLevel);
6202 static xmlSchemaTypePtr xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr 6223 static xmlSchemaTypePtr xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr
6203 ctxt, 6224 ctxt,
6204 xmlSchemaPtr schema, 6225 xmlSchemaPtr schema,
6205 xmlNodePtr node, 6226 xmlNodePtr node,
6206 int topLevel); 6227 int topLevel);
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
7691 */ 7712 */
7692 if (pctxt->isRedefine && pctxt->redef && 7713 if (pctxt->isRedefine && pctxt->redef &&
7693 (pctxt->redef->item->type == 7714 (pctxt->redef->item->type ==
7694 XML_SCHEMA_TYPE_ATTRIBUTEGROUP) && 7715 XML_SCHEMA_TYPE_ATTRIBUTEGROUP) &&
7695 (ref == pctxt->redef->refName) && 7716 (ref == pctxt->redef->refName) &&
7696 (refNs == pctxt->redef->refTargetNs)) 7717 (refNs == pctxt->redef->refTargetNs))
7697 { 7718 {
7698 /* 7719 /*
7699 * SPEC src-redefine: 7720 * SPEC src-redefine:
7700 * (7.1) "If it has an <attributeGroup> among its contents 7721 * (7.1) "If it has an <attributeGroup> among its contents
7701 » * the �actual value� of whose ref [attribute] is the same 7722 » * the `actual value` of whose ref [attribute] is the same
7702 » * as the �actual value� of its own name attribute plus 7723 » * as the `actual value` of its own name attribute plus
7703 * target namespace, then it must have exactly one such group." 7724 * target namespace, then it must have exactly one such group."
7704 */ 7725 */
7705 if (pctxt->redefCounter != 0) { 7726 if (pctxt->redefCounter != 0) {
7706 xmlChar *str = NULL; 7727 xmlChar *str = NULL;
7707 7728
7708 xmlSchemaCustomErr(ACTXT_CAST pctxt, 7729 xmlSchemaCustomErr(ACTXT_CAST pctxt,
7709 XML_SCHEMAP_SRC_REDEFINE, node, NULL, 7730 XML_SCHEMAP_SRC_REDEFINE, node, NULL,
7710 "The redefining attribute group definition " 7731 "The redefining attribute group definition "
7711 "'%s' must not contain more than one " 7732 "'%s' must not contain more than one "
7712 "reference to the redefined definition", 7733 "reference to the redefined definition",
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
8220 "allocating a 'selector' of an identity-constraint definition", 8241 "allocating a 'selector' of an identity-constraint definition",
8221 NULL); 8242 NULL);
8222 return (NULL); 8243 return (NULL);
8223 } 8244 }
8224 memset(item, 0, sizeof(xmlSchemaIDCSelect)); 8245 memset(item, 0, sizeof(xmlSchemaIDCSelect));
8225 /* 8246 /*
8226 * Attribute "xpath" (mandatory). 8247 * Attribute "xpath" (mandatory).
8227 */ 8248 */
8228 attr = xmlSchemaGetPropNode(node, "xpath"); 8249 attr = xmlSchemaGetPropNode(node, "xpath");
8229 if (attr == NULL) { 8250 if (attr == NULL) {
8230 » xmlSchemaPMissingAttrErr(ctxt, 8251 » xmlSchemaPMissingAttrErr(ctxt,
8231 XML_SCHEMAP_S4S_ATTR_MISSING, 8252 XML_SCHEMAP_S4S_ATTR_MISSING,
8232 NULL, node, 8253 NULL, node,
8233 "name", NULL); 8254 "name", NULL);
8234 } else { 8255 } else {
8235 item->xpath = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); 8256 item->xpath = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
8236 /* 8257 /*
8237 * URGENT TODO: "field"s have an other syntax than "selector"s. 8258 * URGENT TODO: "field"s have an other syntax than "selector"s.
8238 */ 8259 */
8239 8260
8240 if (xmlSchemaCheckCSelectorXPath(ctxt, idc, item, attr, 8261 if (xmlSchemaCheckCSelectorXPath(ctxt, idc, item, attr,
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
8841 if ((ctxt == NULL) || (schema == NULL) || (node == NULL)) 8862 if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
8842 return (-1); 8863 return (-1);
8843 /* Not a component, don't create it. */ 8864 /* Not a component, don't create it. */
8844 type = ctxt->ctxtType; 8865 type = ctxt->ctxtType;
8845 /* 8866 /*
8846 * Mark the simple type as being of variety "union". 8867 * Mark the simple type as being of variety "union".
8847 */ 8868 */
8848 type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION; 8869 type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION;
8849 /* 8870 /*
8850 * SPEC (Base type) (2) "If the <list> or <union> alternative is chosen, 8871 * SPEC (Base type) (2) "If the <list> or <union> alternative is chosen,
8851 * then the �simple ur-type definition�." 8872 * then the `simple ur-type definition`."
8852 */ 8873 */
8853 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); 8874 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE);
8854 /* 8875 /*
8855 * Check for illegal attributes. 8876 * Check for illegal attributes.
8856 */ 8877 */
8857 attr = node->properties; 8878 attr = node->properties;
8858 while (attr != NULL) { 8879 while (attr != NULL) {
8859 if (attr->ns == NULL) { 8880 if (attr->ns == NULL) {
8860 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && 8881 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) &&
8861 (!xmlStrEqual(attr->name, BAD_CAST "memberTypes"))) { 8882 (!xmlStrEqual(attr->name, BAD_CAST "memberTypes"))) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
9009 if ((ctxt == NULL) || (schema == NULL) || (node == NULL)) 9030 if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
9010 return (NULL); 9031 return (NULL);
9011 /* Not a component, don't create it. */ 9032 /* Not a component, don't create it. */
9012 type = ctxt->ctxtType; 9033 type = ctxt->ctxtType;
9013 /* 9034 /*
9014 * Mark the type as being of variety "list". 9035 * Mark the type as being of variety "list".
9015 */ 9036 */
9016 type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST; 9037 type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
9017 /* 9038 /*
9018 * SPEC (Base type) (2) "If the <list> or <union> alternative is chosen, 9039 * SPEC (Base type) (2) "If the <list> or <union> alternative is chosen,
9019 * then the �simple ur-type definition�." 9040 * then the `simple ur-type definition`."
9020 */ 9041 */
9021 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); 9042 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE);
9022 /* 9043 /*
9023 * Check for illegal attributes. 9044 * Check for illegal attributes.
9024 */ 9045 */
9025 attr = node->properties; 9046 attr = node->properties;
9026 while (attr != NULL) { 9047 while (attr != NULL) {
9027 if (attr->ns == NULL) { 9048 if (attr->ns == NULL) {
9028 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && 9049 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) &&
9029 (!xmlStrEqual(attr->name, BAD_CAST "itemType"))) { 9050 (!xmlStrEqual(attr->name, BAD_CAST "itemType"))) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
9154 return(NULL); 9175 return(NULL);
9155 } 9176 }
9156 biType = xmlSchemaGetPredefinedType(attrValue, xmlSchemaNs); 9177 biType = xmlSchemaGetPredefinedType(attrValue, xmlSchemaNs);
9157 if (biType != NULL) 9178 if (biType != NULL)
9158 return (biType); 9179 return (biType);
9159 } 9180 }
9160 } 9181 }
9161 } 9182 }
9162 /* 9183 /*
9163 * TargetNamespace: 9184 * TargetNamespace:
9164 * SPEC "The �actual value� of the targetNamespace [attribute] 9185 * SPEC "The `actual value` of the targetNamespace [attribute]
9165 * of the <schema> ancestor element information item if present, 9186 * of the <schema> ancestor element information item if present,
9166 * otherwise �absent�. 9187 * otherwise `absent`.
9167 */ 9188 */
9168 if (topLevel == 0) { 9189 if (topLevel == 0) {
9169 #ifdef ENABLE_NAMED_LOCALS 9190 #ifdef ENABLE_NAMED_LOCALS
9170 char buf[40]; 9191 char buf[40];
9171 #endif 9192 #endif
9172 /* 9193 /*
9173 * Parse as local simple type definition. 9194 * Parse as local simple type definition.
9174 */ 9195 */
9175 #ifdef ENABLE_NAMED_LOCALS 9196 #ifdef ENABLE_NAMED_LOCALS
9176 snprintf(buf, 39, "#ST%d", ctxt->counter++ + 1); 9197 snprintf(buf, 39, "#ST%d", ctxt->counter++ + 1);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
9291 child = child->next; 9312 child = child->next;
9292 } 9313 }
9293 if (child != NULL) { 9314 if (child != NULL) {
9294 xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, 9315 xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED,
9295 NULL, node, child, NULL, 9316 NULL, node, child, NULL,
9296 "(annotation?, (restriction | list | union))"); 9317 "(annotation?, (restriction | list | union))");
9297 } 9318 }
9298 /* 9319 /*
9299 * REDEFINE: SPEC src-redefine (5) 9320 * REDEFINE: SPEC src-redefine (5)
9300 * "Within the [children], each <simpleType> must have a 9321 * "Within the [children], each <simpleType> must have a
9301 * <restriction> among its [children] ... the �actual value� of whose 9322 * <restriction> among its [children] ... the `actual value` of whose
9302 * base [attribute] must be the same as the �actual value� of its own 9323 * base [attribute] must be the same as the `actual value` of its own
9303 * name attribute plus target namespace;" 9324 * name attribute plus target namespace;"
9304 */ 9325 */
9305 if (topLevel && ctxt->isRedefine && (! hasRestriction)) { 9326 if (topLevel && ctxt->isRedefine && (! hasRestriction)) {
9306 xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE, 9327 xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE,
9307 NULL, node, "This is a redefinition, thus the " 9328 NULL, node, "This is a redefinition, thus the "
9308 "<simpleType> must have a <restriction> child", NULL); 9329 "<simpleType> must have a <restriction> child", NULL);
9309 } 9330 }
9310 9331
9311 ctxt->ctxtType = oldCtxtType; 9332 ctxt->ctxtType = oldCtxtType;
9312 return (type); 9333 return (type);
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
10376 schemaLocation, NULL); 10397 schemaLocation, NULL);
10377 goto exit; 10398 goto exit;
10378 } 10399 }
10379 } 10400 }
10380 } 10401 }
10381 10402
10382 if (WXS_IS_BUCKET_IMPMAIN(type)) { 10403 if (WXS_IS_BUCKET_IMPMAIN(type)) {
10383 /* 10404 /*
10384 * Given that the schemaLocation [attribute] is only a hint, it is open 10405 * Given that the schemaLocation [attribute] is only a hint, it is open
10385 * to applications to ignore all but the first <import> for a given 10406 * to applications to ignore all but the first <import> for a given
10386 » * namespace, regardless of the �actual value� of schemaLocation, but 10407 » * namespace, regardless of the `actual value` of schemaLocation, but
10387 * such a strategy risks missing useful information when new 10408 * such a strategy risks missing useful information when new
10388 * schemaLocations are offered. 10409 * schemaLocations are offered.
10389 * 10410 *
10390 * We will use the first <import> that comes with a location. 10411 * We will use the first <import> that comes with a location.
10391 * Further <import>s *with* a location, will result in an error. 10412 * Further <import>s *with* a location, will result in an error.
10392 * TODO: Better would be to just report a warning here, but 10413 * TODO: Better would be to just report a warning here, but
10393 * we'll try it this way until someone complains. 10414 * we'll try it this way until someone complains.
10394 * 10415 *
10395 * Schema Document Location Strategy: 10416 * Schema Document Location Strategy:
10396 * 3 Based on the namespace name, identify an existing schema document, 10417 * 3 Based on the namespace name, identify an existing schema document,
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
10729 return (pctxt->err); 10750 return (pctxt->err);
10730 } 10751 }
10731 10752
10732 if (xmlSchemaPValAttr(pctxt, NULL, node, 10753 if (xmlSchemaPValAttr(pctxt, NULL, node,
10733 "schemaLocation", xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), 10754 "schemaLocation", xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI),
10734 &schemaLocation) != 0) { 10755 &schemaLocation) != 0) {
10735 xmlSchemaPSimpleTypeErr(pctxt, 10756 xmlSchemaPSimpleTypeErr(pctxt,
10736 XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, 10757 XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
10737 NULL, node, 10758 NULL, node,
10738 xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), 10759 xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI),
10739 » NULL, namespaceName, NULL, NULL, NULL); 10760 » NULL, schemaLocation, NULL, NULL, NULL);
10740 return (pctxt->err); 10761 return (pctxt->err);
10741 } 10762 }
10742 /* 10763 /*
10743 * And now for the children... 10764 * And now for the children...
10744 */ 10765 */
10745 child = node->children; 10766 child = node->children;
10746 if (IS_SCHEMA(child, "annotation")) { 10767 if (IS_SCHEMA(child, "annotation")) {
10747 /* 10768 /*
10748 * the annotation here is simply discarded ... 10769 * the annotation here is simply discarded ...
10749 * TODO: really? 10770 * TODO: really?
(...skipping 10 matching lines...) Expand all
10760 * Apply additional constraints. 10781 * Apply additional constraints.
10761 * 10782 *
10762 * Note that it is important to use the original @targetNamespace 10783 * Note that it is important to use the original @targetNamespace
10763 * (or none at all), to rule out imports of schemas _with_ a 10784 * (or none at all), to rule out imports of schemas _with_ a
10764 * @targetNamespace if the importing schema is a chameleon schema 10785 * @targetNamespace if the importing schema is a chameleon schema
10765 * (with no @targetNamespace). 10786 * (with no @targetNamespace).
10766 */ 10787 */
10767 thisTargetNamespace = WXS_BUCKET(pctxt)->origTargetNamespace; 10788 thisTargetNamespace = WXS_BUCKET(pctxt)->origTargetNamespace;
10768 if (namespaceName != NULL) { 10789 if (namespaceName != NULL) {
10769 /* 10790 /*
10770 » * 1.1 If the namespace [attribute] is present, then its �actual value� 10791 » * 1.1 If the namespace [attribute] is present, then its `actual value`
10771 » * must not match the �actual value� of the enclosing <schema>'s 10792 » * must not match the `actual value` of the enclosing <schema>'s
10772 * targetNamespace [attribute]. 10793 * targetNamespace [attribute].
10773 */ 10794 */
10774 if (xmlStrEqual(thisTargetNamespace, namespaceName)) { 10795 if (xmlStrEqual(thisTargetNamespace, namespaceName)) {
10775 xmlSchemaPCustomErr(pctxt, 10796 xmlSchemaPCustomErr(pctxt,
10776 XML_SCHEMAP_SRC_IMPORT_1_1, 10797 XML_SCHEMAP_SRC_IMPORT_1_1,
10777 NULL, node, 10798 NULL, node,
10778 "The value of the attribute 'namespace' must not match " 10799 "The value of the attribute 'namespace' must not match "
10779 "the target namespace '%s' of the importing schema", 10800 "the target namespace '%s' of the importing schema",
10780 thisTargetNamespace); 10801 thisTargetNamespace);
10781 return (pctxt->err); 10802 return (pctxt->err);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
10962 * a schema document. 10983 * a schema document.
10963 */ 10984 */
10964 if ((bucket == NULL) || (bucket->doc == NULL)) { 10985 if ((bucket == NULL) || (bucket->doc == NULL)) {
10965 if (type == XML_SCHEMA_SCHEMA_INCLUDE) { 10986 if (type == XML_SCHEMA_SCHEMA_INCLUDE) {
10966 /* 10987 /*
10967 * WARNING for <include>: 10988 * WARNING for <include>:
10968 * We will raise an error if the schema cannot be located 10989 * We will raise an error if the schema cannot be located
10969 * for inclusions, since the that was the feedback from the 10990 * for inclusions, since the that was the feedback from the
10970 * schema people. I.e. the following spec piece will *not* be 10991 * schema people. I.e. the following spec piece will *not* be
10971 * satisfied: 10992 * satisfied:
10972 » * SPEC src-include: "It is not an error for the �actual value� of th e 10993 » * SPEC src-include: "It is not an error for the `actual value` of th e
10973 * schemaLocation [attribute] to fail to resolve it all, in which 10994 * schemaLocation [attribute] to fail to resolve it all, in which
10974 * case no corresponding inclusion is performed. 10995 * case no corresponding inclusion is performed.
10975 * So do we need a warning report here?" 10996 * So do we need a warning report here?"
10976 */ 10997 */
10977 res = XML_SCHEMAP_SRC_INCLUDE; 10998 res = XML_SCHEMAP_SRC_INCLUDE;
10978 xmlSchemaCustomErr(ACTXT_CAST pctxt, res, 10999 xmlSchemaCustomErr(ACTXT_CAST pctxt, res,
10979 node, NULL, 11000 node, NULL,
10980 "Failed to load the document '%s' for inclusion", 11001 "Failed to load the document '%s' for inclusion",
10981 schemaLocation, NULL); 11002 schemaLocation, NULL);
10982 } else { 11003 } else {
10983 /* 11004 /*
10984 * NOTE: This was changed to raise an error even if no redefinitions 11005 * NOTE: This was changed to raise an error even if no redefinitions
10985 * are specified. 11006 * are specified.
10986 * 11007 *
10987 * SPEC src-redefine (1) 11008 * SPEC src-redefine (1)
10988 * "If there are any element information items among the [children] 11009 * "If there are any element information items among the [children]
10989 » * other than <annotation> then the �actual value� of the 11010 » * other than <annotation> then the `actual value` of the
10990 * schemaLocation [attribute] must successfully resolve." 11011 * schemaLocation [attribute] must successfully resolve."
10991 * TODO: Ask the WG if a the location has always to resolve 11012 * TODO: Ask the WG if a the location has always to resolve
10992 * here as well! 11013 * here as well!
10993 */ 11014 */
10994 res = XML_SCHEMAP_SRC_REDEFINE; 11015 res = XML_SCHEMAP_SRC_REDEFINE;
10995 xmlSchemaCustomErr(ACTXT_CAST pctxt, res, 11016 xmlSchemaCustomErr(ACTXT_CAST pctxt, res,
10996 node, NULL, 11017 node, NULL,
10997 "Failed to load the document '%s' for redefinition", 11018 "Failed to load the document '%s' for redefinition",
10998 schemaLocation, NULL); 11019 schemaLocation, NULL);
10999 } 11020 }
11000 } else { 11021 } else {
11001 /* 11022 /*
11002 * Check targetNamespace sanity before parsing the new schema. 11023 * Check targetNamespace sanity before parsing the new schema.
11003 * TODO: Note that we won't check further content if the 11024 * TODO: Note that we won't check further content if the
11004 * targetNamespace was bad. 11025 * targetNamespace was bad.
11005 */ 11026 */
11006 if (bucket->origTargetNamespace != NULL) { 11027 if (bucket->origTargetNamespace != NULL) {
11007 /* 11028 /*
11008 * SPEC src-include (2.1) 11029 * SPEC src-include (2.1)
11009 » * "SII has a targetNamespace [attribute], and its �actual 11030 » * "SII has a targetNamespace [attribute], and its `actual
11010 » * value� is identical to the �actual value� of the targetNamespace 11031 » * value` is identical to the `actual value` of the targetNamespace
11011 » * [attribute] of SII� (which must have such an [attribute])." 11032 » * [attribute] of SII' (which must have such an [attribute])."
11012 */ 11033 */
11013 if (pctxt->targetNamespace == NULL) { 11034 if (pctxt->targetNamespace == NULL) {
11014 xmlSchemaCustomErr(ACTXT_CAST pctxt, 11035 xmlSchemaCustomErr(ACTXT_CAST pctxt,
11015 XML_SCHEMAP_SRC_INCLUDE, 11036 XML_SCHEMAP_SRC_INCLUDE,
11016 node, NULL, 11037 node, NULL,
11017 "The target namespace of the included/redefined schema " 11038 "The target namespace of the included/redefined schema "
11018 "'%s' has to be absent, since the including/redefining " 11039 "'%s' has to be absent, since the including/redefining "
11019 "schema has no target namespace", 11040 "schema has no target namespace",
11020 schemaLocation, NULL); 11041 schemaLocation, NULL);
11021 goto exit_error; 11042 goto exit_error;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
11349 part && part->children) 11370 part && part->children)
11350 { 11371 {
11351 if ((xmlSchemaGetQNameRefName(part->children) == 11372 if ((xmlSchemaGetQNameRefName(part->children) ==
11352 ctxt->redef->refName) && 11373 ctxt->redef->refName) &&
11353 (xmlSchemaGetQNameRefTargetNs(part->children) == 11374 (xmlSchemaGetQNameRefTargetNs(part->children) ==
11354 ctxt->redef->refTargetNs)) 11375 ctxt->redef->refTargetNs))
11355 { 11376 {
11356 /* 11377 /*
11357 * SPEC src-redefine: 11378 * SPEC src-redefine:
11358 * (6.1) "If it has a <group> among its contents at 11379 * (6.1) "If it has a <group> among its contents at
11359 » » » * some level the �actual value� of whose ref 11380 » » » * some level the `actual value` of whose ref
11360 » » » * [attribute] is the same as the �actual value� of 11381 » » » * [attribute] is the same as the `actual value` of
11361 * its own name attribute plus target namespace, then 11382 * its own name attribute plus target namespace, then
11362 * all of the following must be true:" 11383 * all of the following must be true:"
11363 * (6.1.1) "It must have exactly one such group." 11384 * (6.1.1) "It must have exactly one such group."
11364 */ 11385 */
11365 if (ctxt->redefCounter != 0) { 11386 if (ctxt->redefCounter != 0) {
11366 xmlChar *str = NULL; 11387 xmlChar *str = NULL;
11367 11388
11368 xmlSchemaCustomErr(ACTXT_CAST ctxt, 11389 xmlSchemaCustomErr(ACTXT_CAST ctxt,
11369 XML_SCHEMAP_SRC_REDEFINE, child, NULL, 11390 XML_SCHEMAP_SRC_REDEFINE, child, NULL,
11370 "The redefining model group definition " 11391 "The redefining model group definition "
11371 "'%s' must not contain more than one " 11392 "'%s' must not contain more than one "
11372 "reference to the redefined definition", 11393 "reference to the redefined definition",
11373 xmlSchemaFormatQName(&str, 11394 xmlSchemaFormatQName(&str,
11374 ctxt->redef->refTargetNs, 11395 ctxt->redef->refTargetNs,
11375 ctxt->redef->refName), 11396 ctxt->redef->refName),
11376 NULL); 11397 NULL);
11377 FREE_AND_NULL(str) 11398 FREE_AND_NULL(str)
11378 part = NULL; 11399 part = NULL;
11379 } else if (((WXS_PARTICLE(part))->minOccurs != 1) || 11400 } else if (((WXS_PARTICLE(part))->minOccurs != 1) ||
11380 ((WXS_PARTICLE(part))->maxOccurs != 1)) 11401 ((WXS_PARTICLE(part))->maxOccurs != 1))
11381 { 11402 {
11382 xmlChar *str = NULL; 11403 xmlChar *str = NULL;
11383 /* 11404 /*
11384 * SPEC src-redefine: 11405 * SPEC src-redefine:
11385 » » » * (6.1.2) "The �actual value� of both that 11406 » » » * (6.1.2) "The `actual value` of both that
11386 * group's minOccurs and maxOccurs [attribute] 11407 * group's minOccurs and maxOccurs [attribute]
11387 » » » * must be 1 (or �absent�). 11408 » » » * must be 1 (or `absent`).
11388 */ 11409 */
11389 xmlSchemaCustomErr(ACTXT_CAST ctxt, 11410 xmlSchemaCustomErr(ACTXT_CAST ctxt,
11390 XML_SCHEMAP_SRC_REDEFINE, child, NULL, 11411 XML_SCHEMAP_SRC_REDEFINE, child, NULL,
11391 "The redefining model group definition " 11412 "The redefining model group definition "
11392 "'%s' must not contain a reference to the " 11413 "'%s' must not contain a reference to the "
11393 "redefined definition with a " 11414 "redefined definition with a "
11394 "maxOccurs/minOccurs other than 1", 11415 "maxOccurs/minOccurs other than 1",
11395 xmlSchemaFormatQName(&str, 11416 xmlSchemaFormatQName(&str,
11396 ctxt->redef->refTargetNs, 11417 ctxt->redef->refTargetNs,
11397 ctxt->redef->refName), 11418 ctxt->redef->refName),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
11491 xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); 11512 xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id");
11492 /* 11513 /*
11493 * Attribute 11514 * Attribute
11494 */ 11515 */
11495 /* 11516 /*
11496 * Extract the base type. The "base" attribute is mandatory if inside 11517 * Extract the base type. The "base" attribute is mandatory if inside
11497 * a complex type or if redefining. 11518 * a complex type or if redefining.
11498 * 11519 *
11499 * SPEC (1.2) "...otherwise (<restriction> has no <simpleType> " 11520 * SPEC (1.2) "...otherwise (<restriction> has no <simpleType> "
11500 * among its [children]), the simple type definition which is 11521 * among its [children]), the simple type definition which is
11501 * the {content type} of the type definition �resolved� to by 11522 * the {content type} of the type definition `resolved` to by
11502 * the �actual value� of the base [attribute]" 11523 * the `actual value` of the base [attribute]"
11503 */ 11524 */
11504 if (xmlSchemaPValAttrQName(ctxt, schema, NULL, node, "base", 11525 if (xmlSchemaPValAttrQName(ctxt, schema, NULL, node, "base",
11505 &(type->baseNs), &(type->base)) == 0) 11526 &(type->baseNs), &(type->base)) == 0)
11506 { 11527 {
11507 if ((type->base == NULL) && (type->type == XML_SCHEMA_TYPE_COMPLEX)) { 11528 if ((type->base == NULL) && (type->type == XML_SCHEMA_TYPE_COMPLEX)) {
11508 xmlSchemaPMissingAttrErr(ctxt, 11529 xmlSchemaPMissingAttrErr(ctxt,
11509 XML_SCHEMAP_S4S_ATTR_MISSING, 11530 XML_SCHEMAP_S4S_ATTR_MISSING,
11510 NULL, node, "base", NULL); 11531 NULL, node, "base", NULL);
11511 } else if ((ctxt->isRedefine) && 11532 } else if ((ctxt->isRedefine) &&
11512 (type->flags & XML_SCHEMAS_TYPE_GLOBAL)) 11533 (type->flags & XML_SCHEMAS_TYPE_GLOBAL))
11513 { 11534 {
11514 if (type->base == NULL) { 11535 if (type->base == NULL) {
11515 xmlSchemaPMissingAttrErr(ctxt, 11536 xmlSchemaPMissingAttrErr(ctxt,
11516 XML_SCHEMAP_S4S_ATTR_MISSING, 11537 XML_SCHEMAP_S4S_ATTR_MISSING,
11517 NULL, node, "base", NULL); 11538 NULL, node, "base", NULL);
11518 } else if ((! xmlStrEqual(type->base, type->name)) || 11539 } else if ((! xmlStrEqual(type->base, type->name)) ||
11519 (! xmlStrEqual(type->baseNs, type->targetNamespace))) 11540 (! xmlStrEqual(type->baseNs, type->targetNamespace)))
11520 { 11541 {
11521 xmlChar *str1 = NULL, *str2 = NULL; 11542 xmlChar *str1 = NULL, *str2 = NULL;
11522 /* 11543 /*
11523 * REDEFINE: SPEC src-redefine (5) 11544 * REDEFINE: SPEC src-redefine (5)
11524 * "Within the [children], each <simpleType> must have a 11545 * "Within the [children], each <simpleType> must have a
11525 » » * <restriction> among its [children] ... the �actual value� of 11546 » » * <restriction> among its [children] ... the `actual value` of
11526 » » * whose base [attribute] must be the same as the �actual value� 11547 » » * whose base [attribute] must be the same as the `actual value`
11527 * of its own name attribute plus target namespace;" 11548 * of its own name attribute plus target namespace;"
11528 */ 11549 */
11529 xmlSchemaPCustomErrExt(ctxt, XML_SCHEMAP_SRC_REDEFINE, 11550 xmlSchemaPCustomErrExt(ctxt, XML_SCHEMAP_SRC_REDEFINE,
11530 NULL, node, "This is a redefinition, but the QName " 11551 NULL, node, "This is a redefinition, but the QName "
11531 "value '%s' of the 'base' attribute does not match the " 11552 "value '%s' of the 'base' attribute does not match the "
11532 "type's designation '%s'", 11553 "type's designation '%s'",
11533 xmlSchemaFormatQName(&str1, type->baseNs, type->base), 11554 xmlSchemaFormatQName(&str1, type->baseNs, type->base),
11534 xmlSchemaFormatQName(&str2, type->targetNamespace, 11555 xmlSchemaFormatQName(&str2, type->targetNamespace,
11535 type->name), NULL); 11556 type->name), NULL);
11536 FREE_AND_NULL(str1); 11557 FREE_AND_NULL(str1);
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
12277 xmlSchemaParseComplexContent(ctxt, schema, child, 12298 xmlSchemaParseComplexContent(ctxt, schema, child,
12278 &hasRestrictionOrExtension); 12299 &hasRestrictionOrExtension);
12279 child = child->next; 12300 child = child->next;
12280 } else { 12301 } else {
12281 /* 12302 /*
12282 * E.g <complexType><sequence>... or <complexType><attribute>... etc. 12303 * E.g <complexType><sequence>... or <complexType><attribute>... etc.
12283 * 12304 *
12284 * SPEC 12305 * SPEC
12285 * "...the third alternative (neither <simpleContent> nor 12306 * "...the third alternative (neither <simpleContent> nor
12286 * <complexContent>) is chosen. This case is understood as shorthand 12307 * <complexContent>) is chosen. This case is understood as shorthand
12287 » * for complex content restricting the �ur-type definition�, and the 12308 » * for complex content restricting the `ur-type definition`, and the
12288 * details of the mappings should be modified as necessary. 12309 * details of the mappings should be modified as necessary.
12289 */ 12310 */
12290 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); 12311 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE);
12291 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION; 12312 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
12292 /* 12313 /*
12293 * Parse model groups. 12314 * Parse model groups.
12294 */ 12315 */
12295 if (IS_SCHEMA(child, "all")) { 12316 if (IS_SCHEMA(child, "all")) {
12296 type->subtypes = (xmlSchemaTypePtr) 12317 type->subtypes = (xmlSchemaTypePtr)
12297 xmlSchemaParseModelGroup(ctxt, schema, child, 12318 xmlSchemaParseModelGroup(ctxt, schema, child,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
12346 xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE, 12367 xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE,
12347 NULL, node, "This is a redefinition, thus the " 12368 NULL, node, "This is a redefinition, thus the "
12348 "<complexType> must have a <restriction> or <extension> " 12369 "<complexType> must have a <restriction> or <extension> "
12349 "grand-child", NULL); 12370 "grand-child", NULL);
12350 } 12371 }
12351 ctxt->ctxtType = ctxtType; 12372 ctxt->ctxtType = ctxtType;
12352 return (type); 12373 return (type);
12353 } 12374 }
12354 12375
12355 /************************************************************************ 12376 /************************************************************************
12356 * » » » » » » » » » * 12377 *» » » » » » » » » *
12357 * » » » Validating using Schemas» » » * 12378 *» » » Validating using Schemas» » » *
12358 * » » » » » » » » » * 12379 *» » » » » » » » » *
12359 ************************************************************************/ 12380 ************************************************************************/
12360 12381
12361 /************************************************************************ 12382 /************************************************************************
12362 * » » » » » » » » » * 12383 *» » » » » » » » » *
12363 * » » » Reading/Writing Schemas»» » » * 12384 *» » » Reading/Writing Schemas»» » » *
12364 * » » » » » » » » » * 12385 *» » » » » » » » » *
12365 ************************************************************************/ 12386 ************************************************************************/
12366 12387
12367 #if 0 /* Will be enabled if it is clear what options are needed. */ 12388 #if 0 /* Will be enabled if it is clear what options are needed. */
12368 /** 12389 /**
12369 * xmlSchemaParserCtxtSetOptions: 12390 * xmlSchemaParserCtxtSetOptions:
12370 * @ctxt: a schema parser context 12391 * @ctxt: a schema parser context
12371 * @options: a combination of xmlSchemaParserOption 12392 * @options: a combination of xmlSchemaParserOption
12372 * 12393 *
12373 * Sets the options to be used during the parse. 12394 * Sets the options to be used during the parse.
12374 * 12395 *
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
12931 ret = 1; 12952 ret = 1;
12932 } 12953 }
12933 } else { 12954 } else {
12934 sub = particle->children->children; 12955 sub = particle->children->children;
12935 while (sub != NULL) { 12956 while (sub != NULL) {
12936 tmp2 = xmlSchemaBuildAContentModel(pctxt, 12957 tmp2 = xmlSchemaBuildAContentModel(pctxt,
12937 (xmlSchemaParticlePtr) sub); 12958 (xmlSchemaParticlePtr) sub);
12938 if (tmp2 != 1) ret = 0; 12959 if (tmp2 != 1) ret = 0;
12939 sub = sub->next; 12960 sub = sub->next;
12940 } 12961 }
12962
12963 /*
12964 * epsilon needed to block previous trans from
12965 * being allowed to enter back from another
12966 * construct
12967 */
12968 pctxt->state = xmlAutomataNewEpsilon(pctxt->am,
12969 pctxt->state, NULL);
12970
12941 if (particle->minOccurs == 0) { 12971 if (particle->minOccurs == 0) {
12942 xmlAutomataNewEpsilon(pctxt->am, oldstate, 12972 xmlAutomataNewEpsilon(pctxt->am, oldstate,
12943 pctxt->state); 12973 pctxt->state);
12944 ret = 1; 12974 ret = 1;
12945 } 12975 }
12946 } 12976 }
12947 } 12977 }
12948 break; 12978 break;
12949 } 12979 }
12950 case XML_SCHEMA_TYPE_CHOICE:{ 12980 case XML_SCHEMA_TYPE_CHOICE:{
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
13176 { 13206 {
13177 if ((ctxt == NULL) || (elemDecl == NULL) || 13207 if ((ctxt == NULL) || (elemDecl == NULL) ||
13178 ((elemDecl != NULL) && 13208 ((elemDecl != NULL) &&
13179 (elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_RESOLVED))) 13209 (elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_RESOLVED)))
13180 return; 13210 return;
13181 elemDecl->flags |= XML_SCHEMAS_ELEM_INTERNAL_RESOLVED; 13211 elemDecl->flags |= XML_SCHEMAS_ELEM_INTERNAL_RESOLVED;
13182 13212
13183 if ((elemDecl->subtypes == NULL) && (elemDecl->namedType != NULL)) { 13213 if ((elemDecl->subtypes == NULL) && (elemDecl->namedType != NULL)) {
13184 xmlSchemaTypePtr type; 13214 xmlSchemaTypePtr type;
13185 13215
13186 » /* (type definition) ... otherwise the type definition �resolved� 13216 » /* (type definition) ... otherwise the type definition `resolved`
13187 » * to by the �actual value� of the type [attribute] ... 13217 » * to by the `actual value` of the type [attribute] ...
13188 */ 13218 */
13189 type = xmlSchemaGetType(ctxt->schema, elemDecl->namedType, 13219 type = xmlSchemaGetType(ctxt->schema, elemDecl->namedType,
13190 elemDecl->namedTypeNs); 13220 elemDecl->namedTypeNs);
13191 if (type == NULL) { 13221 if (type == NULL) {
13192 xmlSchemaPResCompAttrErr(ctxt, 13222 xmlSchemaPResCompAttrErr(ctxt,
13193 XML_SCHEMAP_SRC_RESOLVE, 13223 XML_SCHEMAP_SRC_RESOLVE,
13194 WXS_BASIC_CAST elemDecl, elemDecl->node, 13224 WXS_BASIC_CAST elemDecl, elemDecl->node,
13195 "type", elemDecl->namedType, elemDecl->namedTypeNs, 13225 "type", elemDecl->namedType, elemDecl->namedTypeNs,
13196 XML_SCHEMA_TYPE_BASIC, "type definition"); 13226 XML_SCHEMA_TYPE_BASIC, "type definition");
13197 } else 13227 } else
(...skipping 17 matching lines...) Expand all
13215 } else { 13245 } else {
13216 xmlSchemaResolveElementReferences(substHead, ctxt); 13246 xmlSchemaResolveElementReferences(substHead, ctxt);
13217 /* 13247 /*
13218 * Set the "substitution group affiliation". 13248 * Set the "substitution group affiliation".
13219 * NOTE that now we use the "refDecl" field for this. 13249 * NOTE that now we use the "refDecl" field for this.
13220 */ 13250 */
13221 WXS_SUBST_HEAD(elemDecl) = substHead; 13251 WXS_SUBST_HEAD(elemDecl) = substHead;
13222 /* 13252 /*
13223 * The type definitions is set to: 13253 * The type definitions is set to:
13224 * SPEC "...the {type definition} of the element 13254 * SPEC "...the {type definition} of the element
13225 » * declaration �resolved� to by the �actual value� 13255 » * declaration `resolved` to by the `actual value`
13226 * of the substitutionGroup [attribute], if present" 13256 * of the substitutionGroup [attribute], if present"
13227 */ 13257 */
13228 if (elemDecl->subtypes == NULL) 13258 if (elemDecl->subtypes == NULL)
13229 elemDecl->subtypes = substHead->subtypes; 13259 elemDecl->subtypes = substHead->subtypes;
13230 } 13260 }
13231 } 13261 }
13232 /* 13262 /*
13233 * SPEC "The definition of anyType serves as the default type definition 13263 * SPEC "The definition of anyType serves as the default type definition
13234 * for element declarations whose XML representation does not specify one." 13264 * for element declarations whose XML representation does not specify one."
13235 */ 13265 */
(...skipping 17 matching lines...) Expand all
13253 static int 13283 static int
13254 xmlSchemaResolveUnionMemberTypes(xmlSchemaParserCtxtPtr ctxt, 13284 xmlSchemaResolveUnionMemberTypes(xmlSchemaParserCtxtPtr ctxt,
13255 xmlSchemaTypePtr type) 13285 xmlSchemaTypePtr type)
13256 { 13286 {
13257 13287
13258 xmlSchemaTypeLinkPtr link, lastLink, newLink; 13288 xmlSchemaTypeLinkPtr link, lastLink, newLink;
13259 xmlSchemaTypePtr memberType; 13289 xmlSchemaTypePtr memberType;
13260 13290
13261 /* 13291 /*
13262 * SPEC (1) "If the <union> alternative is chosen, then [Definition:] 13292 * SPEC (1) "If the <union> alternative is chosen, then [Definition:]
13263 * define the explicit members as the type definitions �resolved� 13293 * define the explicit members as the type definitions `resolved`
13264 * to by the items in the �actual value� of the memberTypes [attribute], 13294 * to by the items in the `actual value` of the memberTypes [attribute],
13265 * if any, followed by the type definitions corresponding to the 13295 * if any, followed by the type definitions corresponding to the
13266 * <simpleType>s among the [children] of <union>, if any." 13296 * <simpleType>s among the [children] of <union>, if any."
13267 */ 13297 */
13268 /* 13298 /*
13269 * Resolve references. 13299 * Resolve references.
13270 */ 13300 */
13271 link = type->memberTypes; 13301 link = type->memberTypes;
13272 lastLink = NULL; 13302 lastLink = NULL;
13273 while (link != NULL) { 13303 while (link != NULL) {
13274 const xmlChar *name, *nsName; 13304 const xmlChar *name, *nsName;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
13549 completeWild->nsSet = NULL; 13579 completeWild->nsSet = NULL;
13550 } 13580 }
13551 if (completeWild->negNsSet != NULL) { 13581 if (completeWild->negNsSet != NULL) {
13552 xmlFree(completeWild->negNsSet); 13582 xmlFree(completeWild->negNsSet);
13553 completeWild->negNsSet = NULL; 13583 completeWild->negNsSet = NULL;
13554 } 13584 }
13555 } 13585 }
13556 return (0); 13586 return (0);
13557 } 13587 }
13558 /* 13588 /*
13559 * 3 If both O1 and O2 are sets of (namespace names or �absent�), 13589 * 3 If both O1 and O2 are sets of (namespace names or `absent`),
13560 * then the union of those sets must be the value. 13590 * then the union of those sets must be the value.
13561 */ 13591 */
13562 if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { 13592 if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) {
13563 int found; 13593 int found;
13564 xmlSchemaWildcardNsPtr start; 13594 xmlSchemaWildcardNsPtr start;
13565 13595
13566 cur = curWild->nsSet; 13596 cur = curWild->nsSet;
13567 start = completeWild->nsSet; 13597 start = completeWild->nsSet;
13568 while (cur != NULL) { 13598 while (cur != NULL) {
13569 found = 0; 13599 found = 0;
(...skipping 13 matching lines...) Expand all
13583 tmp->next = completeWild->nsSet; 13613 tmp->next = completeWild->nsSet;
13584 completeWild->nsSet = tmp; 13614 completeWild->nsSet = tmp;
13585 } 13615 }
13586 cur = cur->next; 13616 cur = cur->next;
13587 } 13617 }
13588 13618
13589 return(0); 13619 return(0);
13590 } 13620 }
13591 /* 13621 /*
13592 * 4 If the two are negations of different values (namespace names 13622 * 4 If the two are negations of different values (namespace names
13593 * or �absent�), then a pair of not and �absent� must be the value. 13623 * or `absent`), then a pair of not and `absent` must be the value.
13594 */ 13624 */
13595 if ((completeWild->negNsSet != NULL) && 13625 if ((completeWild->negNsSet != NULL) &&
13596 (curWild->negNsSet != NULL) && 13626 (curWild->negNsSet != NULL) &&
13597 (completeWild->negNsSet->value != curWild->negNsSet->value)) { 13627 (completeWild->negNsSet->value != curWild->negNsSet->value)) {
13598 completeWild->negNsSet->value = NULL; 13628 completeWild->negNsSet->value = NULL;
13599 13629
13600 return(0); 13630 return(0);
13601 } 13631 }
13602 /* 13632 /*
13603 * 5. 13633 * 5.
(...skipping 21 matching lines...) Expand all
13625 else if (cur->value == curB->value) 13655 else if (cur->value == curB->value)
13626 nsFound = 1; 13656 nsFound = 1;
13627 if (nsFound && absentFound) 13657 if (nsFound && absentFound)
13628 break; 13658 break;
13629 cur = cur->next; 13659 cur = cur->next;
13630 } 13660 }
13631 13661
13632 if (nsFound && absentFound) { 13662 if (nsFound && absentFound) {
13633 /* 13663 /*
13634 * 5.1 If the set S includes both the negated namespace 13664 * 5.1 If the set S includes both the negated namespace
13635 » * name and �absent�, then any must be the value. 13665 » * name and `absent`, then any must be the value.
13636 */ 13666 */
13637 completeWild->any = 1; 13667 completeWild->any = 1;
13638 if (completeWild->nsSet != NULL) { 13668 if (completeWild->nsSet != NULL) {
13639 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); 13669 xmlSchemaFreeWildcardNsSet(completeWild->nsSet);
13640 completeWild->nsSet = NULL; 13670 completeWild->nsSet = NULL;
13641 } 13671 }
13642 if (completeWild->negNsSet != NULL) { 13672 if (completeWild->negNsSet != NULL) {
13643 xmlFree(completeWild->negNsSet); 13673 xmlFree(completeWild->negNsSet);
13644 completeWild->negNsSet = NULL; 13674 completeWild->negNsSet = NULL;
13645 } 13675 }
13646 } else if (nsFound && (!absentFound)) { 13676 } else if (nsFound && (!absentFound)) {
13647 /* 13677 /*
13648 * 5.2 If the set S includes the negated namespace name 13678 * 5.2 If the set S includes the negated namespace name
13649 » * but not �absent�, then a pair of not and �absent� must 13679 » * but not `absent`, then a pair of not and `absent` must
13650 * be the value. 13680 * be the value.
13651 */ 13681 */
13652 if (completeWild->nsSet != NULL) { 13682 if (completeWild->nsSet != NULL) {
13653 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); 13683 xmlSchemaFreeWildcardNsSet(completeWild->nsSet);
13654 completeWild->nsSet = NULL; 13684 completeWild->nsSet = NULL;
13655 } 13685 }
13656 if (completeWild->negNsSet == NULL) { 13686 if (completeWild->negNsSet == NULL) {
13657 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); 13687 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt);
13658 if (completeWild->negNsSet == NULL) 13688 if (completeWild->negNsSet == NULL)
13659 return (-1); 13689 return (-1);
13660 } 13690 }
13661 completeWild->negNsSet->value = NULL; 13691 completeWild->negNsSet->value = NULL;
13662 } else if ((!nsFound) && absentFound) { 13692 } else if ((!nsFound) && absentFound) {
13663 /* 13693 /*
13664 » * 5.3 If the set S includes �absent� but not the negated 13694 » * 5.3 If the set S includes `absent` but not the negated
13665 * namespace name, then the union is not expressible. 13695 * namespace name, then the union is not expressible.
13666 */ 13696 */
13667 xmlSchemaPErr(ctxt, completeWild->node, 13697 xmlSchemaPErr(ctxt, completeWild->node,
13668 XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, 13698 XML_SCHEMAP_UNION_NOT_EXPRESSIBLE,
13669 "The union of the wilcard is not expressible.\n", 13699 "The union of the wilcard is not expressible.\n",
13670 NULL, NULL); 13700 NULL, NULL);
13671 return(XML_SCHEMAP_UNION_NOT_EXPRESSIBLE); 13701 return(XML_SCHEMAP_UNION_NOT_EXPRESSIBLE);
13672 } else if ((!nsFound) && (!absentFound)) { 13702 } else if ((!nsFound) && (!absentFound)) {
13673 /* 13703 /*
13674 * 5.4 If the set S does not include either the negated namespace 13704 * 5.4 If the set S does not include either the negated namespace
13675 » * name or �absent�, then whichever of O1 or O2 is a pair of not 13705 » * name or `absent`, then whichever of O1 or O2 is a pair of not
13676 * and a namespace name must be the value. 13706 * and a namespace name must be the value.
13677 */ 13707 */
13678 if (completeWild->negNsSet == NULL) { 13708 if (completeWild->negNsSet == NULL) {
13679 if (completeWild->nsSet != NULL) { 13709 if (completeWild->nsSet != NULL) {
13680 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); 13710 xmlSchemaFreeWildcardNsSet(completeWild->nsSet);
13681 completeWild->nsSet = NULL; 13711 completeWild->nsSet = NULL;
13682 } 13712 }
13683 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); 13713 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt);
13684 if (completeWild->negNsSet == NULL) 13714 if (completeWild->negNsSet == NULL)
13685 return (-1); 13715 return (-1);
(...skipping 13 matching lines...) Expand all
13699 (completeWild->nsSet != NULL))) { 13729 (completeWild->nsSet != NULL))) {
13700 13730
13701 if (completeWild->nsSet != NULL) { 13731 if (completeWild->nsSet != NULL) {
13702 cur = completeWild->nsSet; 13732 cur = completeWild->nsSet;
13703 } else { 13733 } else {
13704 cur = curWild->nsSet; 13734 cur = curWild->nsSet;
13705 } 13735 }
13706 while (cur != NULL) { 13736 while (cur != NULL) {
13707 if (cur->value == NULL) { 13737 if (cur->value == NULL) {
13708 /* 13738 /*
13709 » » * 6.1 If the set S includes �absent�, then any must be the 13739 » » * 6.1 If the set S includes `absent`, then any must be the
13710 * value. 13740 * value.
13711 */ 13741 */
13712 completeWild->any = 1; 13742 completeWild->any = 1;
13713 if (completeWild->nsSet != NULL) { 13743 if (completeWild->nsSet != NULL) {
13714 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); 13744 xmlSchemaFreeWildcardNsSet(completeWild->nsSet);
13715 completeWild->nsSet = NULL; 13745 completeWild->nsSet = NULL;
13716 } 13746 }
13717 if (completeWild->negNsSet != NULL) { 13747 if (completeWild->negNsSet != NULL) {
13718 xmlFree(completeWild->negNsSet); 13748 xmlFree(completeWild->negNsSet);
13719 completeWild->negNsSet = NULL; 13749 completeWild->negNsSet = NULL;
13720 } 13750 }
13721 return (0); 13751 return (0);
13722 } 13752 }
13723 cur = cur->next; 13753 cur = cur->next;
13724 } 13754 }
13725 if (completeWild->negNsSet == NULL) { 13755 if (completeWild->negNsSet == NULL) {
13726 /* 13756 /*
13727 » * 6.2 If the set S does not include �absent�, then a pair of not 13757 » * 6.2 If the set S does not include `absent`, then a pair of not
13728 » * and �absent� must be the value. 13758 » * and `absent` must be the value.
13729 */ 13759 */
13730 if (completeWild->nsSet != NULL) { 13760 if (completeWild->nsSet != NULL) {
13731 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); 13761 xmlSchemaFreeWildcardNsSet(completeWild->nsSet);
13732 completeWild->nsSet = NULL; 13762 completeWild->nsSet = NULL;
13733 } 13763 }
13734 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); 13764 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt);
13735 if (completeWild->negNsSet == NULL) 13765 if (completeWild->negNsSet == NULL)
13736 return (-1); 13766 return (-1);
13737 completeWild->negNsSet->value = NULL; 13767 completeWild->negNsSet->value = NULL;
13738 } 13768 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
13801 /* 13831 /*
13802 * 2 If either O1 or O2 is any, then the other must be the value. 13832 * 2 If either O1 or O2 is any, then the other must be the value.
13803 */ 13833 */
13804 if ((completeWild->any != curWild->any) && (completeWild->any)) { 13834 if ((completeWild->any != curWild->any) && (completeWild->any)) {
13805 if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1) 13835 if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1)
13806 return(-1); 13836 return(-1);
13807 return(0); 13837 return(0);
13808 } 13838 }
13809 /* 13839 /*
13810 * 3 If either O1 or O2 is a pair of not and a value (a namespace 13840 * 3 If either O1 or O2 is a pair of not and a value (a namespace
13811 * name or �absent�) and the other is a set of (namespace names or 13841 * name or `absent`) and the other is a set of (namespace names or
13812 * �absent�), then that set, minus the negated value if it was in 13842 * `absent`), then that set, minus the negated value if it was in
13813 * the set, minus �absent� if it was in the set, must be the value. 13843 * the set, minus `absent` if it was in the set, must be the value.
13814 */ 13844 */
13815 if (((completeWild->negNsSet != NULL) && (curWild->nsSet != NULL)) || 13845 if (((completeWild->negNsSet != NULL) && (curWild->nsSet != NULL)) ||
13816 ((curWild->negNsSet != NULL) && (completeWild->nsSet != NULL))) { 13846 ((curWild->negNsSet != NULL) && (completeWild->nsSet != NULL))) {
13817 const xmlChar *neg; 13847 const xmlChar *neg;
13818 13848
13819 if (completeWild->nsSet == NULL) { 13849 if (completeWild->nsSet == NULL) {
13820 neg = completeWild->negNsSet->value; 13850 neg = completeWild->negNsSet->value;
13821 if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1) 13851 if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1)
13822 return(-1); 13852 return(-1);
13823 } else 13853 } else
(...skipping 28 matching lines...) Expand all
13852 break; 13882 break;
13853 } 13883 }
13854 prev = cur; 13884 prev = cur;
13855 cur = cur->next; 13885 cur = cur->next;
13856 } 13886 }
13857 } 13887 }
13858 13888
13859 return(0); 13889 return(0);
13860 } 13890 }
13861 /* 13891 /*
13862 * 4 If both O1 and O2 are sets of (namespace names or �absent�), 13892 * 4 If both O1 and O2 are sets of (namespace names or `absent`),
13863 * then the intersection of those sets must be the value. 13893 * then the intersection of those sets must be the value.
13864 */ 13894 */
13865 if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { 13895 if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) {
13866 int found; 13896 int found;
13867 13897
13868 cur = completeWild->nsSet; 13898 cur = completeWild->nsSet;
13869 prev = NULL; 13899 prev = NULL;
13870 while (cur != NULL) { 13900 while (cur != NULL) {
13871 found = 0; 13901 found = 0;
13872 curB = curWild->nsSet; 13902 curB = curWild->nsSet;
(...skipping 29 matching lines...) Expand all
13902 (completeWild->negNsSet->value != NULL) && 13932 (completeWild->negNsSet->value != NULL) &&
13903 (curWild->negNsSet->value != NULL)) { 13933 (curWild->negNsSet->value != NULL)) {
13904 13934
13905 xmlSchemaPErr(ctxt, completeWild->node, XML_SCHEMAP_INTERSECTION_NOT_EXP RESSIBLE, 13935 xmlSchemaPErr(ctxt, completeWild->node, XML_SCHEMAP_INTERSECTION_NOT_EXP RESSIBLE,
13906 "The intersection of the wilcard is not expressible.\n", 13936 "The intersection of the wilcard is not expressible.\n",
13907 NULL, NULL); 13937 NULL, NULL);
13908 return(XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE); 13938 return(XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE);
13909 } 13939 }
13910 /* 13940 /*
13911 * 6 If the one is a negation of a namespace name and the other 13941 * 6 If the one is a negation of a namespace name and the other
13912 * is a negation of �absent�, then the one which is the negation 13942 * is a negation of `absent`, then the one which is the negation
13913 * of a namespace name must be the value. 13943 * of a namespace name must be the value.
13914 */ 13944 */
13915 if ((completeWild->negNsSet != NULL) && (curWild->negNsSet != NULL) && 13945 if ((completeWild->negNsSet != NULL) && (curWild->negNsSet != NULL) &&
13916 (completeWild->negNsSet->value != curWild->negNsSet->value) && 13946 (completeWild->negNsSet->value != curWild->negNsSet->value) &&
13917 (completeWild->negNsSet->value == NULL)) { 13947 (completeWild->negNsSet->value == NULL)) {
13918 completeWild->negNsSet->value = curWild->negNsSet->value; 13948 completeWild->negNsSet->value = curWild->negNsSet->value;
13919 } 13949 }
13920 return(0); 13950 return(0);
13921 } 13951 }
13922 13952
(...skipping 11 matching lines...) Expand all
13934 static int 13964 static int
13935 xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub, 13965 xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub,
13936 xmlSchemaWildcardPtr super) 13966 xmlSchemaWildcardPtr super)
13937 { 13967 {
13938 /* 13968 /*
13939 * 1 super must be any. 13969 * 1 super must be any.
13940 */ 13970 */
13941 if (super->any) 13971 if (super->any)
13942 return (0); 13972 return (0);
13943 /* 13973 /*
13944 * 2.1 sub must be a pair of not and a namespace name or �absent�. 13974 * 2.1 sub must be a pair of not and a namespace name or `absent`.
13945 * 2.2 super must be a pair of not and the same value. 13975 * 2.2 super must be a pair of not and the same value.
13946 */ 13976 */
13947 if ((sub->negNsSet != NULL) && 13977 if ((sub->negNsSet != NULL) &&
13948 (super->negNsSet != NULL) && 13978 (super->negNsSet != NULL) &&
13949 (sub->negNsSet->value == super->negNsSet->value)) 13979 (sub->negNsSet->value == super->negNsSet->value))
13950 return (0); 13980 return (0);
13951 /* 13981 /*
13952 * 3.1 sub must be a set whose members are either namespace names or �absent� . 13982 * 3.1 sub must be a set whose members are either namespace names or `absent` .
13953 */ 13983 */
13954 if (sub->nsSet != NULL) { 13984 if (sub->nsSet != NULL) {
13955 /* 13985 /*
13956 * 3.2.1 super must be the same set or a superset thereof. 13986 * 3.2.1 super must be the same set or a superset thereof.
13957 */ 13987 */
13958 if (super->nsSet != NULL) { 13988 if (super->nsSet != NULL) {
13959 xmlSchemaWildcardNsPtr cur, curB; 13989 xmlSchemaWildcardNsPtr cur, curB;
13960 int found = 0; 13990 int found = 0;
13961 13991
13962 cur = sub->nsSet; 13992 cur = sub->nsSet;
(...skipping 10 matching lines...) Expand all
13973 if (!found) 14003 if (!found)
13974 return (1); 14004 return (1);
13975 cur = cur->next; 14005 cur = cur->next;
13976 } 14006 }
13977 if (found) 14007 if (found)
13978 return (0); 14008 return (0);
13979 } else if (super->negNsSet != NULL) { 14009 } else if (super->negNsSet != NULL) {
13980 xmlSchemaWildcardNsPtr cur; 14010 xmlSchemaWildcardNsPtr cur;
13981 /* 14011 /*
13982 * 3.2.2 super must be a pair of not and a namespace name or 14012 * 3.2.2 super must be a pair of not and a namespace name or
13983 » * �absent� and that value must not be in sub's set. 14013 » * `absent` and that value must not be in sub's set.
13984 */ 14014 */
13985 cur = sub->nsSet; 14015 cur = sub->nsSet;
13986 while (cur != NULL) { 14016 while (cur != NULL) {
13987 if (cur->value == super->negNsSet->value) 14017 if (cur->value == super->negNsSet->value)
13988 return (1); 14018 return (1);
13989 cur = cur->next; 14019 cur = cur->next;
13990 } 14020 }
13991 return (0); 14021 return (0);
13992 } 14022 }
13993 } 14023 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
14135 } else if (xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST pctxt, 14165 } else if (xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST pctxt,
14136 WXS_ATTRUSE_TYPEDEF(cur), 14166 WXS_ATTRUSE_TYPEDEF(cur),
14137 WXS_ATTRUSE_TYPEDEF(bcur), 0) != 0) 14167 WXS_ATTRUSE_TYPEDEF(bcur), 0) != 0)
14138 { 14168 {
14139 xmlChar *strA = NULL, *strB = NULL, *strC = NULL; 14169 xmlChar *strA = NULL, *strB = NULL, *strC = NULL;
14140 14170
14141 /* 14171 /*
14142 * SPEC (2.1.2) "R's {attribute declaration}'s 14172 * SPEC (2.1.2) "R's {attribute declaration}'s
14143 * {type definition} must be validly derived from 14173 * {type definition} must be validly derived from
14144 * B's {type definition} given the empty set as 14174 * B's {type definition} given the empty set as
14145 » » » * defined in Type Derivation OK (Simple) (�3.14.6)." 14175 » » » * defined in Type Derivation OK (Simple) ($3.14.6)."
14146 */ 14176 */
14147 xmlSchemaPAttrUseErr4(pctxt, 14177 xmlSchemaPAttrUseErr4(pctxt,
14148 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, 14178 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2,
14149 WXS_ITEM_NODE(item), item, cur, 14179 WXS_ITEM_NODE(item), item, cur,
14150 "The attribute declaration's %s " 14180 "The attribute declaration's %s "
14151 "is not validly derived from " 14181 "is not validly derived from "
14152 "the corresponding %s of the " 14182 "the corresponding %s of the "
14153 "attribute declaration in the %s %s", 14183 "attribute declaration in the %s %s",
14154 xmlSchemaGetComponentDesignation(&strA, 14184 xmlSchemaGetComponentDesignation(&strA,
14155 WXS_ATTRUSE_TYPEDEF(cur)), 14185 WXS_ATTRUSE_TYPEDEF(cur)),
(...skipping 11 matching lines...) Expand all
14167 * 2.1.3 [Definition:] Let the effective value 14197 * 2.1.3 [Definition:] Let the effective value
14168 * constraint of an attribute use be its {value 14198 * constraint of an attribute use be its {value
14169 * constraint}, if present, otherwise its {attribute 14199 * constraint}, if present, otherwise its {attribute
14170 * declaration}'s {value constraint} . 14200 * declaration}'s {value constraint} .
14171 */ 14201 */
14172 xmlSchemaGetEffectiveValueConstraint(bcur, 14202 xmlSchemaGetEffectiveValueConstraint(bcur,
14173 &effFixed, &bEffValue, NULL); 14203 &effFixed, &bEffValue, NULL);
14174 /* 14204 /*
14175 * 2.1.3 ... one of the following must be true 14205 * 2.1.3 ... one of the following must be true
14176 * 14206 *
14177 » » » * 2.1.3.1 B's �effective value constraint� is 14207 » » » * 2.1.3.1 B's `effective value constraint` is
14178 » » » * �absent� or default. 14208 » » » * `absent` or default.
14179 */ 14209 */
14180 if ((bEffValue != NULL) && 14210 if ((bEffValue != NULL) &&
14181 (effFixed == 1)) { 14211 (effFixed == 1)) {
14182 const xmlChar *rEffValue = NULL; 14212 const xmlChar *rEffValue = NULL;
14183 14213
14184 xmlSchemaGetEffectiveValueConstraint(bcur, 14214 xmlSchemaGetEffectiveValueConstraint(bcur,
14185 &effFixed, &rEffValue, NULL); 14215 &effFixed, &rEffValue, NULL);
14186 /* 14216 /*
14187 » » » * 2.1.3.2 R's �effective value constraint� is 14217 » » » * 2.1.3.2 R's `effective value constraint` is
14188 * fixed with the same string as B's. 14218 * fixed with the same string as B's.
14189 * MAYBE TODO: Compare the computed values. 14219 * MAYBE TODO: Compare the computed values.
14190 * Hmm, it says "same string" so 14220 * Hmm, it says "same string" so
14191 * string-equality might really be sufficient. 14221 * string-equality might really be sufficient.
14192 */ 14222 */
14193 if ((effFixed == 0) || 14223 if ((effFixed == 0) ||
14194 (! WXS_ARE_DEFAULT_STR_EQUAL(rEffValue, bEffValu e))) 14224 (! WXS_ARE_DEFAULT_STR_EQUAL(rEffValue, bEffValu e)))
14195 { 14225 {
14196 xmlChar *str = NULL; 14226 xmlChar *str = NULL;
14197 14227
(...skipping 13 matching lines...) Expand all
14211 } 14241 }
14212 } 14242 }
14213 break; 14243 break;
14214 } 14244 }
14215 } 14245 }
14216 not_found: 14246 not_found:
14217 if (!found) { 14247 if (!found) {
14218 /* 14248 /*
14219 * (2.2) "otherwise the {base type definition} must have an 14249 * (2.2) "otherwise the {base type definition} must have an
14220 * {attribute wildcard} and the {target namespace} of the 14250 * {attribute wildcard} and the {target namespace} of the
14221 » » * R's {attribute declaration} must be �valid� with respect 14251 » » * R's {attribute declaration} must be `valid` with respect
14222 * to that wildcard, as defined in Wildcard allows Namespace 14252 * to that wildcard, as defined in Wildcard allows Namespace
14223 » » * Name (�3.10.4)." 14253 » » * Name ($3.10.4)."
14224 */ 14254 */
14225 if ((baseWild == NULL) || 14255 if ((baseWild == NULL) ||
14226 (xmlSchemaCheckCVCWildcardNamespace(baseWild, 14256 (xmlSchemaCheckCVCWildcardNamespace(baseWild,
14227 (WXS_ATTRUSE_DECL(cur))->targetNamespace) != 0)) 14257 (WXS_ATTRUSE_DECL(cur))->targetNamespace) != 0))
14228 { 14258 {
14229 xmlChar *str = NULL; 14259 xmlChar *str = NULL;
14230 14260
14231 xmlSchemaPAttrUseErr4(pctxt, 14261 xmlSchemaPAttrUseErr4(pctxt,
14232 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, 14262 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2,
14233 WXS_ITEM_NODE(item), item, cur, 14263 WXS_ITEM_NODE(item), item, cur,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
14311 FREE_AND_NULL(str); 14341 FREE_AND_NULL(str);
14312 return(pctxt->err); 14342 return(pctxt->err);
14313 } else if ((baseWild->any == 0) && 14343 } else if ((baseWild->any == 0) &&
14314 xmlSchemaCheckCOSNSSubset(wild, baseWild)) 14344 xmlSchemaCheckCOSNSSubset(wild, baseWild))
14315 { 14345 {
14316 xmlChar *str = NULL; 14346 xmlChar *str = NULL;
14317 /* 14347 /*
14318 * (4.2) "The complex type definition's {attribute wildcard}'s 14348 * (4.2) "The complex type definition's {attribute wildcard}'s
14319 * {namespace constraint} must be a subset of the {base type 14349 * {namespace constraint} must be a subset of the {base type
14320 * definition}'s {attribute wildcard}'s {namespace constraint}, 14350 * definition}'s {attribute wildcard}'s {namespace constraint},
14321 » * as defined by Wildcard Subset (�3.10.6)." 14351 » * as defined by Wildcard Subset ($3.10.6)."
14322 */ 14352 */
14323 xmlSchemaCustomErr4(ACTXT_CAST pctxt, 14353 xmlSchemaCustomErr4(ACTXT_CAST pctxt,
14324 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, 14354 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2,
14325 NULL, item, 14355 NULL, item,
14326 "The attribute wildcard is not a valid " 14356 "The attribute wildcard is not a valid "
14327 "subset of the wildcard in the %s %s '%s'", 14357 "subset of the wildcard in the %s %s '%s'",
14328 WXS_ACTION_STR(action), 14358 WXS_ACTION_STR(action),
14329 WXS_ITEM_TYPE_NAME(baseItem), 14359 WXS_ITEM_TYPE_NAME(baseItem),
14330 xmlSchemaGetComponentQName(&str, baseItem), 14360 xmlSchemaGetComponentQName(&str, baseItem),
14331 NULL); 14361 NULL);
14332 FREE_AND_NULL(str); 14362 FREE_AND_NULL(str);
14333 return(pctxt->err); 14363 return(pctxt->err);
14334 } 14364 }
14335 » /* 4.3 Unless the {base type definition} is the �ur-type 14365 » /* 4.3 Unless the {base type definition} is the `ur-type
14336 » * definition�, the complex type definition's {attribute 14366 » * definition`, the complex type definition's {attribute
14337 * wildcard}'s {process contents} must be identical to or 14367 * wildcard}'s {process contents} must be identical to or
14338 * stronger than the {base type definition}'s {attribute 14368 * stronger than the {base type definition}'s {attribute
14339 * wildcard}'s {process contents}, where strict is stronger 14369 * wildcard}'s {process contents}, where strict is stronger
14340 * than lax is stronger than skip. 14370 * than lax is stronger than skip.
14341 */ 14371 */
14342 if ((! WXS_IS_ANYTYPE(baseItem)) && 14372 if ((! WXS_IS_ANYTYPE(baseItem)) &&
14343 (wild->processContents < baseWild->processContents)) { 14373 (wild->processContents < baseWild->processContents)) {
14344 xmlChar *str = NULL; 14374 xmlChar *str = NULL;
14345 xmlSchemaCustomErr4(ACTXT_CAST pctxt, 14375 xmlSchemaCustomErr4(ACTXT_CAST pctxt,
14346 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, 14376 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
14512 * TODO: We could shrink the size of the array 14542 * TODO: We could shrink the size of the array
14513 * to fit the actual number of items. 14543 * to fit the actual number of items.
14514 */ 14544 */
14515 } 14545 }
14516 /* 14546 /*
14517 * Compute the complete wildcard. 14547 * Compute the complete wildcard.
14518 */ 14548 */
14519 if (WXS_IS_EXTENSION(type)) { 14549 if (WXS_IS_EXTENSION(type)) {
14520 if (baseType->attributeWildcard != NULL) { 14550 if (baseType->attributeWildcard != NULL) {
14521 /* 14551 /*
14522 » * (3.2.2.1) "If the �base wildcard� is non-�absent�, then 14552 » * (3.2.2.1) "If the `base wildcard` is non-`absent`, then
14523 * the appropriate case among the following:" 14553 * the appropriate case among the following:"
14524 */ 14554 */
14525 if (type->attributeWildcard != NULL) { 14555 if (type->attributeWildcard != NULL) {
14526 /* 14556 /*
14527 * Union the complete wildcard with the base wildcard. 14557 * Union the complete wildcard with the base wildcard.
14528 * SPEC {attribute wildcard} 14558 * SPEC {attribute wildcard}
14529 * (3.2.2.1.2) "otherwise a wildcard whose {process contents} 14559 * (3.2.2.1.2) "otherwise a wildcard whose {process contents}
14530 » » * and {annotation} are those of the �complete wildcard�, 14560 » » * and {annotation} are those of the `complete wildcard`,
14531 * and whose {namespace constraint} is the intensional union 14561 * and whose {namespace constraint} is the intensional union
14532 » » * of the {namespace constraint} of the �complete wildcard� 14562 » » * of the {namespace constraint} of the `complete wildcard`
14533 » » * and of the �base wildcard�, as defined in Attribute 14563 » » * and of the `base wildcard`, as defined in Attribute
14534 » » * Wildcard Union (�3.10.6)." 14564 » » * Wildcard Union ($3.10.6)."
14535 */ 14565 */
14536 if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard, 14566 if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard,
14537 baseType->attributeWildcard) == -1) 14567 baseType->attributeWildcard) == -1)
14538 goto exit_failure; 14568 goto exit_failure;
14539 } else { 14569 } else {
14540 /* 14570 /*
14541 » » * (3.2.2.1.1) "If the �complete wildcard� is �absent�, 14571 » » * (3.2.2.1.1) "If the `complete wildcard` is `absent`,
14542 » » * then the �base wildcard�." 14572 » » * then the `base wildcard`."
14543 */ 14573 */
14544 type->attributeWildcard = baseType->attributeWildcard; 14574 type->attributeWildcard = baseType->attributeWildcard;
14545 } 14575 }
14546 } else { 14576 } else {
14547 /* 14577 /*
14548 » * (3.2.2.2) "otherwise (the �base wildcard� is �absent�) the 14578 » * (3.2.2.2) "otherwise (the `base wildcard` is `absent`) the
14549 » * �complete wildcard" 14579 » * `complete wildcard`"
14550 * NOOP 14580 * NOOP
14551 */ 14581 */
14552 } 14582 }
14553 } else { 14583 } else {
14554 /* 14584 /*
14555 * SPEC {attribute wildcard} 14585 * SPEC {attribute wildcard}
14556 * (3.1) "If the <restriction> alternative is chosen, then the 14586 * (3.1) "If the <restriction> alternative is chosen, then the
14557 » * �complete wildcard�;" 14587 » * `complete wildcard`;"
14558 * NOOP 14588 * NOOP
14559 */ 14589 */
14560 } 14590 }
14561 14591
14562 return (0); 14592 return (0);
14563 14593
14564 exit_failure: 14594 exit_failure:
14565 return(-1); 14595 return(-1);
14566 } 14596 }
14567 14597
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
14796 if (xmlSchemaTypeFixup(baseType, actxt) == -1) 14826 if (xmlSchemaTypeFixup(baseType, actxt) == -1)
14797 return(-1); 14827 return(-1);
14798 if ((subset & SUBSET_RESTRICTION) || 14828 if ((subset & SUBSET_RESTRICTION) ||
14799 (xmlSchemaTypeFinalContains(type->baseType, 14829 (xmlSchemaTypeFinalContains(type->baseType,
14800 XML_SCHEMAS_TYPE_FINAL_RESTRICTION))) { 14830 XML_SCHEMAS_TYPE_FINAL_RESTRICTION))) {
14801 return (XML_SCHEMAP_COS_ST_DERIVED_OK_2_1); 14831 return (XML_SCHEMAP_COS_ST_DERIVED_OK_2_1);
14802 } 14832 }
14803 /* 2.2 */ 14833 /* 2.2 */
14804 if (type->baseType == baseType) { 14834 if (type->baseType == baseType) {
14805 /* 14835 /*
14806 » * 2.2.1 D's �base type definition� is B. 14836 » * 2.2.1 D's `base type definition` is B.
14807 */ 14837 */
14808 return (0); 14838 return (0);
14809 } 14839 }
14810 /* 14840 /*
14811 * 2.2.2 D's �base type definition� is not the �ur-type definition� 14841 * 2.2.2 D's `base type definition` is not the `ur-type definition`
14812 * and is validly derived from B given the subset, as defined by this 14842 * and is validly derived from B given the subset, as defined by this
14813 * constraint. 14843 * constraint.
14814 */ 14844 */
14815 if ((! WXS_IS_ANYTYPE(type->baseType)) && 14845 if ((! WXS_IS_ANYTYPE(type->baseType)) &&
14816 (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, 14846 (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType,
14817 baseType, subset) == 0)) { 14847 baseType, subset) == 0)) {
14818 return (0); 14848 return (0);
14819 } 14849 }
14820 /* 14850 /*
14821 * 2.2.3 D's {variety} is list or union and B is the �simple ur-type 14851 * 2.2.3 D's {variety} is list or union and B is the `simple ur-type
14822 * definition�. 14852 * definition`.
14823 */ 14853 */
14824 if (WXS_IS_ANY_SIMPLE_TYPE(baseType) && 14854 if (WXS_IS_ANY_SIMPLE_TYPE(baseType) &&
14825 (WXS_IS_LIST(type) || WXS_IS_UNION(type))) { 14855 (WXS_IS_LIST(type) || WXS_IS_UNION(type))) {
14826 return (0); 14856 return (0);
14827 } 14857 }
14828 /* 14858 /*
14829 * 2.2.4 B's {variety} is union and D is validly derived from a type 14859 * 2.2.4 B's {variety} is union and D is validly derived from a type
14830 * definition in B's {member type definitions} given the subset, as 14860 * definition in B's {member type definitions} given the subset, as
14831 * defined by this constraint. 14861 * defined by this constraint.
14832 * 14862 *
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
15124 xmlSchemaTypePtr baseType = type->baseType; 15154 xmlSchemaTypePtr baseType = type->baseType;
15125 xmlChar *str = NULL; 15155 xmlChar *str = NULL;
15126 15156
15127 /* STATE: error funcs converted. */ 15157 /* STATE: error funcs converted. */
15128 /* 15158 /*
15129 * Schema Component Constraint: Simple Type Definition Properties Correct 15159 * Schema Component Constraint: Simple Type Definition Properties Correct
15130 * 15160 *
15131 * NOTE: This is somehow redundant, since we actually built a simple type 15161 * NOTE: This is somehow redundant, since we actually built a simple type
15132 * to have all the needed information; this acts as an self test. 15162 * to have all the needed information; this acts as an self test.
15133 */ 15163 */
15134 /* Base type: If the datatype has been �derived� by �restriction� 15164 /* Base type: If the datatype has been `derived` by `restriction`
15135 * then the Simple Type Definition component from which it is �derived�, 15165 * then the Simple Type Definition component from which it is `derived`,
15136 * otherwise the Simple Type Definition for anySimpleType (�4.1.6). 15166 * otherwise the Simple Type Definition for anySimpleType ($4.1.6).
15137 */ 15167 */
15138 if (baseType == NULL) { 15168 if (baseType == NULL) {
15139 /* 15169 /*
15140 * TODO: Think about: "modulo the impact of Missing 15170 * TODO: Think about: "modulo the impact of Missing
15141 » * Sub-components (�5.3)." 15171 » * Sub-components ($5.3)."
15142 */ 15172 */
15143 xmlSchemaPCustomErr(ctxt, 15173 xmlSchemaPCustomErr(ctxt,
15144 XML_SCHEMAP_ST_PROPS_CORRECT_1, 15174 XML_SCHEMAP_ST_PROPS_CORRECT_1,
15145 WXS_BASIC_CAST type, NULL, 15175 WXS_BASIC_CAST type, NULL,
15146 "No base type existent", NULL); 15176 "No base type existent", NULL);
15147 return (XML_SCHEMAP_ST_PROPS_CORRECT_1); 15177 return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
15148 15178
15149 } 15179 }
15150 if (! WXS_IS_SIMPLE(baseType)) { 15180 if (! WXS_IS_SIMPLE(baseType)) {
15151 xmlSchemaPCustomErr(ctxt, 15181 xmlSchemaPCustomErr(ctxt,
15152 XML_SCHEMAP_ST_PROPS_CORRECT_1, 15182 XML_SCHEMAP_ST_PROPS_CORRECT_1,
15153 WXS_BASIC_CAST type, NULL, 15183 WXS_BASIC_CAST type, NULL,
15154 "The base type '%s' is not a simple type", 15184 "The base type '%s' is not a simple type",
15155 xmlSchemaGetComponentQName(&str, baseType)); 15185 xmlSchemaGetComponentQName(&str, baseType));
15156 FREE_AND_NULL(str) 15186 FREE_AND_NULL(str)
15157 return (XML_SCHEMAP_ST_PROPS_CORRECT_1); 15187 return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
15158 } 15188 }
15159 if ( (WXS_IS_LIST(type) || WXS_IS_UNION(type)) && 15189 if ((WXS_IS_LIST(type) || WXS_IS_UNION(type)) &&
15160 » (WXS_IS_RESTRICTION(type) == 0) && 15190 » (WXS_IS_RESTRICTION(type) == 0) &&
15161 » (! WXS_IS_ANY_SIMPLE_TYPE(baseType))) { 15191 » ((! WXS_IS_ANY_SIMPLE_TYPE(baseType)) &&
15192 (baseType->type != XML_SCHEMA_TYPE_SIMPLE))) {
15162 xmlSchemaPCustomErr(ctxt, 15193 xmlSchemaPCustomErr(ctxt,
15163 XML_SCHEMAP_ST_PROPS_CORRECT_1, 15194 XML_SCHEMAP_ST_PROPS_CORRECT_1,
15164 WXS_BASIC_CAST type, NULL, 15195 WXS_BASIC_CAST type, NULL,
15165 "A type, derived by list or union, must have " 15196 "A type, derived by list or union, must have "
15166 "the simple ur-type definition as base type, not '%s'", 15197 "the simple ur-type definition as base type, not '%s'",
15167 xmlSchemaGetComponentQName(&str, baseType)); 15198 xmlSchemaGetComponentQName(&str, baseType));
15168 FREE_AND_NULL(str) 15199 FREE_AND_NULL(str)
15169 return (XML_SCHEMAP_ST_PROPS_CORRECT_1); 15200 return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
15170 } 15201 }
15171 /* 15202 /*
(...skipping 18 matching lines...) Expand all
15190 XML_SCHEMAP_ST_PROPS_CORRECT_3, 15221 XML_SCHEMAP_ST_PROPS_CORRECT_3,
15191 WXS_BASIC_CAST type, NULL, 15222 WXS_BASIC_CAST type, NULL,
15192 "The 'final' of its base type '%s' must not contain " 15223 "The 'final' of its base type '%s' must not contain "
15193 "'restriction'", 15224 "'restriction'",
15194 xmlSchemaGetComponentQName(&str, baseType)); 15225 xmlSchemaGetComponentQName(&str, baseType));
15195 FREE_AND_NULL(str) 15226 FREE_AND_NULL(str)
15196 return (XML_SCHEMAP_ST_PROPS_CORRECT_3); 15227 return (XML_SCHEMAP_ST_PROPS_CORRECT_3);
15197 } 15228 }
15198 15229
15199 /* 15230 /*
15200 * 2 All simple type definitions must be derived ultimately from the �simple 15231 * 2 All simple type definitions must be derived ultimately from the `simple
15201 * ur-type definition (so� circular definitions are disallowed). That is, it 15232 * ur-type definition` (so circular definitions are disallowed). That is, it
15202 * must be possible to reach a built-in primitive datatype or the �simple 15233 * must be possible to reach a built-in primitive datatype or the `simple
15203 * ur-type definition� by repeatedly following the {base type definition}. 15234 * ur-type definition` by repeatedly following the {base type definition}.
15204 * 15235 *
15205 * NOTE: this is done in xmlSchemaCheckTypeDefCircular(). 15236 * NOTE: this is done in xmlSchemaCheckTypeDefCircular().
15206 */ 15237 */
15207 return (0); 15238 return (0);
15208 } 15239 }
15209 15240
15210 /** 15241 /**
15211 * xmlSchemaCheckCOSSTRestricts: 15242 * xmlSchemaCheckCOSSTRestricts:
15212 * @ctxt: the schema parser context 15243 * @ctxt: the schema parser context
15213 * @type: the simple type definition 15244 * @type: the simple type definition
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
15377 xmlSchemaPIllegalFacetListUnionErr(pctxt, 15408 xmlSchemaPIllegalFacetListUnionErr(pctxt,
15378 XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, 15409 XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2,
15379 type, facet); 15410 type, facet);
15380 return (XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2); 15411 return (XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2);
15381 } 15412 }
15382 facet = facet->next; 15413 facet = facet->next;
15383 } while (facet != NULL); 15414 } while (facet != NULL);
15384 } 15415 }
15385 /* 15416 /*
15386 * MAYBE TODO: (Hmm, not really) Datatypes states: 15417 * MAYBE TODO: (Hmm, not really) Datatypes states:
15387 » * A �list� datatype can be �derived� from an �atomic� datatype 15418 » * A `list` datatype can be `derived` from an `atomic` datatype
15388 » * whose �lexical space� allows space (such as string or anyURI)or 15419 » * whose `lexical space` allows space (such as string or anyURI)or
15389 » * a �union� datatype any of whose {member type definitions}'s 15420 » * a `union` datatype any of whose {member type definitions}'s
15390 » * �lexical space� allows space. 15421 » * `lexical space` allows space.
15391 */ 15422 */
15392 } else { 15423 } else {
15393 /* 15424 /*
15394 * This is the case if we have: <simpleType><restriction ... 15425 * This is the case if we have: <simpleType><restriction ...
15395 * I.e. the variety of "list" is inherited. 15426 * I.e. the variety of "list" is inherited.
15396 */ 15427 */
15397 /* 15428 /*
15398 * 2.3.2 15429 * 2.3.2
15399 * 2.3.2.1 The {base type definition} must have a {variety} of list. 15430 * 2.3.2.1 The {base type definition} must have a {variety} of list.
15400 */ 15431 */
(...skipping 16 matching lines...) Expand all
15417 XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, 15448 XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2,
15418 WXS_BASIC_CAST type, NULL, 15449 WXS_BASIC_CAST type, NULL,
15419 "The 'final' of the base type '%s' must not contain 'restric tion'", 15450 "The 'final' of the base type '%s' must not contain 'restric tion'",
15420 xmlSchemaGetComponentQName(&str, type->baseType)); 15451 xmlSchemaGetComponentQName(&str, type->baseType));
15421 FREE_AND_NULL(str) 15452 FREE_AND_NULL(str)
15422 return (XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2); 15453 return (XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2);
15423 } 15454 }
15424 /* 15455 /*
15425 * 2.3.2.3 The {item type definition} must be validly derived 15456 * 2.3.2.3 The {item type definition} must be validly derived
15426 * from the {base type definition}'s {item type definition} given 15457 * from the {base type definition}'s {item type definition} given
15427 » * the empty set, as defined in Type Derivation OK (Simple) (�3.14.6) . 15458 » * the empty set, as defined in Type Derivation OK (Simple) ($3.14.6) .
15428 */ 15459 */
15429 { 15460 {
15430 xmlSchemaTypePtr baseItemType; 15461 xmlSchemaTypePtr baseItemType;
15431 15462
15432 baseItemType = type->baseType->subtypes; 15463 baseItemType = type->baseType->subtypes;
15433 if ((baseItemType == NULL) || (! WXS_IS_SIMPLE(baseItemType))) { 15464 if ((baseItemType == NULL) || (! WXS_IS_SIMPLE(baseItemType))) {
15434 PERROR_INT("xmlSchemaCheckCOSSTRestricts", 15465 PERROR_INT("xmlSchemaCheckCOSSTRestricts",
15435 "failed to eval the item type of a base type"); 15466 "failed to eval the item type of a base type");
15436 return (-1); 15467 return (-1);
15437 } 15468 }
(...skipping 26 matching lines...) Expand all
15464 */ 15495 */
15465 facet = type->facets; 15496 facet = type->facets;
15466 do { 15497 do {
15467 switch (facet->type) { 15498 switch (facet->type) {
15468 case XML_SCHEMA_FACET_LENGTH: 15499 case XML_SCHEMA_FACET_LENGTH:
15469 case XML_SCHEMA_FACET_MINLENGTH: 15500 case XML_SCHEMA_FACET_MINLENGTH:
15470 case XML_SCHEMA_FACET_MAXLENGTH: 15501 case XML_SCHEMA_FACET_MAXLENGTH:
15471 case XML_SCHEMA_FACET_WHITESPACE: 15502 case XML_SCHEMA_FACET_WHITESPACE:
15472 /* 15503 /*
15473 * TODO: 2.5.1.2 List datatypes 15504 * TODO: 2.5.1.2 List datatypes
15474 » » » * The value of �whiteSpace� is fixed to the value co llapse. 15505 » » » * The value of `whiteSpace` is fixed to the value co llapse.
15475 */ 15506 */
15476 case XML_SCHEMA_FACET_PATTERN: 15507 case XML_SCHEMA_FACET_PATTERN:
15477 case XML_SCHEMA_FACET_ENUMERATION: 15508 case XML_SCHEMA_FACET_ENUMERATION:
15478 break; 15509 break;
15479 default: { 15510 default: {
15480 xmlSchemaPIllegalFacetListUnionErr(pctxt, 15511 xmlSchemaPIllegalFacetListUnionErr(pctxt,
15481 XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, 15512 XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4,
15482 type, facet); 15513 type, facet);
15483 /* 15514 /*
15484 * We could return, but it's nicer to report all 15515 * We could return, but it's nicer to report all
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
15517 XML_SCHEMAP_COS_ST_RESTRICTS_3_1, 15548 XML_SCHEMAP_COS_ST_RESTRICTS_3_1,
15518 WXS_BASIC_CAST type, NULL, 15549 WXS_BASIC_CAST type, NULL,
15519 "The member type '%s' is neither an atomic, nor a list type" , 15550 "The member type '%s' is neither an atomic, nor a list type" ,
15520 xmlSchemaGetComponentQName(&str, member->type)); 15551 xmlSchemaGetComponentQName(&str, member->type));
15521 FREE_AND_NULL(str) 15552 FREE_AND_NULL(str)
15522 return (XML_SCHEMAP_COS_ST_RESTRICTS_3_1); 15553 return (XML_SCHEMAP_COS_ST_RESTRICTS_3_1);
15523 } 15554 }
15524 member = member->next; 15555 member = member->next;
15525 } 15556 }
15526 /* 15557 /*
15527 » * 3.3.1 If the {base type definition} is the �simple ur-type 15558 » * 3.3.1 If the {base type definition} is the `simple ur-type
15528 » * definition� 15559 » * definition`
15529 */ 15560 */
15530 if (type->baseType->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) { 15561 if (type->baseType->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) {
15531 /* 15562 /*
15532 * 3.3.1.1 All of the {member type definitions} must have a 15563 * 3.3.1.1 All of the {member type definitions} must have a
15533 * {final} which does not contain union. 15564 * {final} which does not contain union.
15534 */ 15565 */
15535 member = type->memberTypes; 15566 member = type->memberTypes;
15536 while (member != NULL) { 15567 while (member != NULL) {
15537 if (xmlSchemaTypeFinalContains(member->type, 15568 if (xmlSchemaTypeFinalContains(member->type,
15538 XML_SCHEMAS_TYPE_FINAL_UNION)) { 15569 XML_SCHEMAS_TYPE_FINAL_UNION)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
15580 WXS_BASIC_CAST type, NULL, 15611 WXS_BASIC_CAST type, NULL,
15581 "The 'final' of its base type '%s' must not contain 'restric tion'", 15612 "The 'final' of its base type '%s' must not contain 'restric tion'",
15582 xmlSchemaGetComponentQName(&str, type->baseType)); 15613 xmlSchemaGetComponentQName(&str, type->baseType));
15583 FREE_AND_NULL(str) 15614 FREE_AND_NULL(str)
15584 return (XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2); 15615 return (XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2);
15585 } 15616 }
15586 /* 15617 /*
15587 * 3.3.2.3 The {member type definitions}, in order, must be validly 15618 * 3.3.2.3 The {member type definitions}, in order, must be validly
15588 * derived from the corresponding type definitions in the {base 15619 * derived from the corresponding type definitions in the {base
15589 * type definition}'s {member type definitions} given the empty set, 15620 * type definition}'s {member type definitions} given the empty set,
15590 » * as defined in Type Derivation OK (Simple) (�3.14.6). 15621 » * as defined in Type Derivation OK (Simple) ($3.14.6).
15591 */ 15622 */
15592 { 15623 {
15593 xmlSchemaTypeLinkPtr baseMember; 15624 xmlSchemaTypeLinkPtr baseMember;
15594 15625
15595 /* 15626 /*
15596 * OPTIMIZE: if the type is restricting, it has no local defined 15627 * OPTIMIZE: if the type is restricting, it has no local defined
15597 * member types and inherits the member types of the base type; 15628 * member types and inherits the member types of the base type;
15598 * thus a check for equality can be skipped. 15629 * thus a check for equality can be skipped.
15599 */ 15630 */
15600 /* 15631 /*
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
15687 * errors. 15718 * errors.
15688 */ 15719 */
15689 #if 0 15720 #if 0
15690 static int 15721 static int
15691 xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, 15722 xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt,
15692 xmlSchemaTypePtr type) 15723 xmlSchemaTypePtr type)
15693 { 15724 {
15694 /* 15725 /*
15695 * src-simple-type.1 The corresponding simple type definition, if any, 15726 * src-simple-type.1 The corresponding simple type definition, if any,
15696 * must satisfy the conditions set out in Constraints on Simple Type 15727 * must satisfy the conditions set out in Constraints on Simple Type
15697 * Definition Schema Components (�3.14.6). 15728 * Definition Schema Components ($3.14.6).
15698 */ 15729 */
15699 if (WXS_IS_RESTRICTION(type)) { 15730 if (WXS_IS_RESTRICTION(type)) {
15700 /* 15731 /*
15701 * src-simple-type.2 "If the <restriction> alternative is chosen, 15732 * src-simple-type.2 "If the <restriction> alternative is chosen,
15702 * either it must have a base [attribute] or a <simpleType> among its 15733 * either it must have a base [attribute] or a <simpleType> among its
15703 * [children], but not both." 15734 * [children], but not both."
15704 * NOTE: This is checked in the parse function of <restriction>. 15735 * NOTE: This is checked in the parse function of <restriction>.
15705 */ 15736 */
15706 /* 15737 /*
15707 * 15738 *
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
15785 * For a string to be a valid default with respect to a type 15816 * For a string to be a valid default with respect to a type
15786 * definition the appropriate case among the following must be true: 15817 * definition the appropriate case among the following must be true:
15787 */ 15818 */
15788 if WXS_IS_COMPLEX(type) { 15819 if WXS_IS_COMPLEX(type) {
15789 /* 15820 /*
15790 * Complex type. 15821 * Complex type.
15791 * 15822 *
15792 * SPEC (2.1) "its {content type} must be a simple type definition 15823 * SPEC (2.1) "its {content type} must be a simple type definition
15793 * or mixed." 15824 * or mixed."
15794 * SPEC (2.2.2) "If the {content type} is mixed, then the {content 15825 * SPEC (2.2.2) "If the {content type} is mixed, then the {content
15795 » * type}'s particle must be �emptiable� as defined by 15826 » * type}'s particle must be `emptiable` as defined by
15796 » * Particle Emptiable (�3.9.6)." 15827 » * Particle Emptiable ($3.9.6)."
15797 */ 15828 */
15798 if ((! WXS_HAS_SIMPLE_CONTENT(type)) && 15829 if ((! WXS_HAS_SIMPLE_CONTENT(type)) &&
15799 ((! WXS_HAS_MIXED_CONTENT(type)) || (! WXS_EMPTIABLE(type)))) { 15830 ((! WXS_HAS_MIXED_CONTENT(type)) || (! WXS_EMPTIABLE(type)))) {
15800 /* NOTE that this covers (2.2.2) as well. */ 15831 /* NOTE that this covers (2.2.2) as well. */
15801 xmlSchemaPCustomErr(pctxt, 15832 xmlSchemaPCustomErr(pctxt,
15802 XML_SCHEMAP_COS_VALID_DEFAULT_2_1, 15833 XML_SCHEMAP_COS_VALID_DEFAULT_2_1,
15803 WXS_BASIC_CAST type, type->node, 15834 WXS_BASIC_CAST type, type->node,
15804 "For a string to be a valid default, the type definition " 15835 "For a string to be a valid default, the type definition "
15805 "must be a simple type or a complex type with mixed content " 15836 "must be a simple type or a complex type with mixed content "
15806 "and a particle emptiable", NULL); 15837 "and a particle emptiable", NULL);
15807 return(XML_SCHEMAP_COS_VALID_DEFAULT_2_1); 15838 return(XML_SCHEMAP_COS_VALID_DEFAULT_2_1);
15808 } 15839 }
15809 } 15840 }
15810 /* 15841 /*
15811 * 1 If the type definition is a simple type definition, then the string 15842 * 1 If the type definition is a simple type definition, then the string
15812 * must be �valid� with respect to that definition as defined by String 15843 * must be `valid` with respect to that definition as defined by String
15813 * Valid (�3.14.4). 15844 * Valid ($3.14.4).
15814 * 15845 *
15815 * AND 15846 * AND
15816 * 15847 *
15817 * 2.2.1 If the {content type} is a simple type definition, then the 15848 * 2.2.1 If the {content type} is a simple type definition, then the
15818 * string must be �valid� with respect to that simple type definition 15849 * string must be `valid` with respect to that simple type definition
15819 * as defined by String Valid (�3.14.4). 15850 * as defined by String Valid ($3.14.4).
15820 */ 15851 */
15821 if (WXS_IS_SIMPLE(type)) 15852 if (WXS_IS_SIMPLE(type))
15822 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node, 15853 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node,
15823 type, value, val, 1, 1, 0); 15854 type, value, val, 1, 1, 0);
15824 else if (WXS_HAS_SIMPLE_CONTENT(type)) 15855 else if (WXS_HAS_SIMPLE_CONTENT(type))
15825 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node, 15856 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node,
15826 type->contentTypeDef, value, val, 1, 1, 0); 15857 type->contentTypeDef, value, val, 1, 1, 0);
15827 else 15858 else
15828 return (ret); 15859 return (ret);
15829 15860
(...skipping 20 matching lines...) Expand all
15850 */ 15881 */
15851 static int 15882 static int
15852 xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, 15883 xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt,
15853 xmlSchemaTypePtr type) 15884 xmlSchemaTypePtr type)
15854 { 15885 {
15855 /* 15886 /*
15856 * TODO: Correct the error code; XML_SCHEMAP_SRC_CT_1 is used temporarily. 15887 * TODO: Correct the error code; XML_SCHEMAP_SRC_CT_1 is used temporarily.
15857 * 15888 *
15858 * SPEC (1) "The values of the properties of a complex type definition must 15889 * SPEC (1) "The values of the properties of a complex type definition must
15859 * be as described in the property tableau in The Complex Type Definition 15890 * be as described in the property tableau in The Complex Type Definition
15860 * Schema Component (�3.4.1), modulo the impact of Missing 15891 * Schema Component ($3.4.1), modulo the impact of Missing
15861 * Sub-components (�5.3)." 15892 * Sub-components ($5.3)."
15862 */ 15893 */
15863 if ((type->baseType != NULL) && 15894 if ((type->baseType != NULL) &&
15864 (WXS_IS_SIMPLE(type->baseType)) && 15895 (WXS_IS_SIMPLE(type->baseType)) &&
15865 (WXS_IS_EXTENSION(type) == 0)) { 15896 (WXS_IS_EXTENSION(type) == 0)) {
15866 /* 15897 /*
15867 * SPEC (2) "If the {base type definition} is a simple type definition, 15898 * SPEC (2) "If the {base type definition} is a simple type definition,
15868 * the {derivation method} must be extension." 15899 * the {derivation method} must be extension."
15869 */ 15900 */
15870 xmlSchemaCustomErr(ACTXT_CAST pctxt, 15901 xmlSchemaCustomErr(ACTXT_CAST pctxt,
15871 XML_SCHEMAP_SRC_CT_1, 15902 XML_SCHEMAP_SRC_CT_1,
15872 NULL, WXS_BASIC_CAST type, 15903 NULL, WXS_BASIC_CAST type,
15873 "If the base type is a simple type, the derivation method must be " 15904 "If the base type is a simple type, the derivation method must be "
15874 "'extension'", NULL, NULL); 15905 "'extension'", NULL, NULL);
15875 return (XML_SCHEMAP_SRC_CT_1); 15906 return (XML_SCHEMAP_SRC_CT_1);
15876 } 15907 }
15877 /* 15908 /*
15878 * SPEC (3) "Circular definitions are disallowed, except for the �ur-type 15909 * SPEC (3) "Circular definitions are disallowed, except for the `ur-type
15879 * definition�. That is, it must be possible to reach the �ur-type 15910 * definition`. That is, it must be possible to reach the `ur-type
15880 * definition by repeatedly following the {base type definition}." 15911 * definition` by repeatedly following the {base type definition}."
15881 * 15912 *
15882 * NOTE (3) is done in xmlSchemaCheckTypeDefCircular(). 15913 * NOTE (3) is done in xmlSchemaCheckTypeDefCircular().
15883 */ 15914 */
15884 /* 15915 /*
15885 * NOTE that (4) and (5) need the following: 15916 * NOTE that (4) and (5) need the following:
15886 * - attribute uses need to be already inherited (apply attr. prohibitions) 15917 * - attribute uses need to be already inherited (apply attr. prohibitions)
15887 * - attribute group references need to be expanded already 15918 * - attribute group references need to be expanded already
15888 * - simple types need to be typefixed already 15919 * - simple types need to be typefixed already
15889 */ 15920 */
15890 if (type->attrUses && 15921 if (type->attrUses &&
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
16022 * SPEC (2.1) "B and D must be the same type definition." 16053 * SPEC (2.1) "B and D must be the same type definition."
16023 */ 16054 */
16024 return (0); 16055 return (0);
16025 } 16056 }
16026 /* 16057 /*
16027 * SPEC (2.2) "B must be D's {base type definition}." 16058 * SPEC (2.2) "B must be D's {base type definition}."
16028 */ 16059 */
16029 if (type->baseType == baseType) 16060 if (type->baseType == baseType)
16030 return (0); 16061 return (0);
16031 /* 16062 /*
16032 * SPEC (2.3.1) "D's {base type definition} must not be the �ur-type 16063 * SPEC (2.3.1) "D's {base type definition} must not be the `ur-type
16033 * definition�." 16064 * definition`."
16034 */ 16065 */
16035 if (WXS_IS_ANYTYPE(type->baseType)) 16066 if (WXS_IS_ANYTYPE(type->baseType))
16036 return (1); 16067 return (1);
16037 16068
16038 if (WXS_IS_COMPLEX(type->baseType)) { 16069 if (WXS_IS_COMPLEX(type->baseType)) {
16039 /* 16070 /*
16040 * SPEC (2.3.2.1) "If D's {base type definition} is complex, then it 16071 * SPEC (2.3.2.1) "If D's {base type definition} is complex, then it
16041 * must be validly derived from B given the subset as defined by this 16072 * must be validly derived from B given the subset as defined by this
16042 * constraint." 16073 * constraint."
16043 */ 16074 */
16044 return (xmlSchemaCheckCOSCTDerivedOK(actxt, type->baseType, 16075 return (xmlSchemaCheckCOSCTDerivedOK(actxt, type->baseType,
16045 baseType, set)); 16076 baseType, set));
16046 } else { 16077 } else {
16047 /* 16078 /*
16048 * SPEC (2.3.2.2) "If D's {base type definition} is simple, then it 16079 * SPEC (2.3.2.2) "If D's {base type definition} is simple, then it
16049 * must be validly derived from B given the subset as defined in Type 16080 * must be validly derived from B given the subset as defined in Type
16050 » * Derivation OK (Simple) (�3.14.6). 16081 » * Derivation OK (Simple) ($3.14.6).
16051 */ 16082 */
16052 return (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, 16083 return (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType,
16053 baseType, set)); 16084 baseType, set));
16054 } 16085 }
16055 } 16086 }
16056 16087
16057 /** 16088 /**
16058 * xmlSchemaCheckCOSDerivedOK: 16089 * xmlSchemaCheckCOSDerivedOK:
16059 * @type: the derived simple type definition 16090 * @type: the derived simple type definition
16060 * @baseType: the base type definition 16091 * @baseType: the base type definition
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
16180 NULL); 16211 NULL);
16181 FREE_AND_NULL(str) 16212 FREE_AND_NULL(str)
16182 } 16213 }
16183 } 16214 }
16184 } 16215 }
16185 /* 16216 /*
16186 * SPEC (1.3) "If it has an {attribute wildcard}, the complex type 16217 * SPEC (1.3) "If it has an {attribute wildcard}, the complex type
16187 * definition must also have one, and the base type definition's 16218 * definition must also have one, and the base type definition's
16188 * {attribute wildcard}'s {namespace constraint} must be a subset 16219 * {attribute wildcard}'s {namespace constraint} must be a subset
16189 * of the complex type definition's {attribute wildcard}'s {namespace 16220 * of the complex type definition's {attribute wildcard}'s {namespace
16190 » * constraint}, as defined by Wildcard Subset (�3.10.6)." 16221 » * constraint}, as defined by Wildcard Subset ($3.10.6)."
16191 */ 16222 */
16192 16223
16193 /* 16224 /*
16194 * MAYBE TODO: Enable if ever needed. But this will be needed only 16225 * MAYBE TODO: Enable if ever needed. But this will be needed only
16195 * if created the type via a schema construction API. 16226 * if created the type via a schema construction API.
16196 */ 16227 */
16197 if (base->attributeWildcard != NULL) { 16228 if (base->attributeWildcard != NULL) {
16198 if (type->attributeWilcard == NULL) { 16229 if (type->attributeWilcard == NULL) {
16199 xmlChar *str = NULL; 16230 xmlChar *str = NULL;
16200 16231
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
16277 */ 16308 */
16278 xmlSchemaPCustomErr(ctxt, 16309 xmlSchemaPCustomErr(ctxt,
16279 XML_SCHEMAP_COS_CT_EXTENDS_1_1, 16310 XML_SCHEMAP_COS_CT_EXTENDS_1_1,
16280 WXS_BASIC_CAST type, NULL, 16311 WXS_BASIC_CAST type, NULL,
16281 "The content type of both, the type and its base " 16312 "The content type of both, the type and its base "
16282 "type, must either 'mixed' or 'element-only'", NULL); 16313 "type, must either 'mixed' or 'element-only'", NULL);
16283 return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); 16314 return (XML_SCHEMAP_COS_CT_EXTENDS_1_1);
16284 } 16315 }
16285 /* 16316 /*
16286 * URGENT TODO SPEC (1.4.3.2.2.2) "The particle of the 16317 * URGENT TODO SPEC (1.4.3.2.2.2) "The particle of the
16287 » » * complex type definition must be a �valid extension� 16318 » » * complex type definition must be a `valid extension`
16288 * of the {base type definition}'s particle, as defined 16319 * of the {base type definition}'s particle, as defined
16289 » » * in Particle Valid (Extension) (�3.9.6)." 16320 » » * in Particle Valid (Extension) ($3.9.6)."
16290 * 16321 *
16291 * NOTE that we won't check "Particle Valid (Extension)", 16322 * NOTE that we won't check "Particle Valid (Extension)",
16292 * since it is ensured by the derivation process in 16323 * since it is ensured by the derivation process in
16293 * xmlSchemaTypeFixup(). We need to implement this when heading 16324 * xmlSchemaTypeFixup(). We need to implement this when heading
16294 * for a construction API 16325 * for a construction API
16295 * TODO: !! This is needed to be checked if redefining a type !! 16326 * TODO: !! This is needed to be checked if redefining a type !!
16296 */ 16327 */
16297 } 16328 }
16298 /* 16329 /*
16299 * URGENT TODO (1.5) 16330 * URGENT TODO (1.5)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
16396 base->attributeWildcard) == -1) 16427 base->attributeWildcard) == -1)
16397 { 16428 {
16398 return(-1); 16429 return(-1);
16399 } 16430 }
16400 /* 16431 /*
16401 * SPEC (5) "One of the following must be true:" 16432 * SPEC (5) "One of the following must be true:"
16402 */ 16433 */
16403 if (base->builtInType == XML_SCHEMAS_ANYTYPE) { 16434 if (base->builtInType == XML_SCHEMAS_ANYTYPE) {
16404 /* 16435 /*
16405 * SPEC (5.1) "The {base type definition} must be the 16436 * SPEC (5.1) "The {base type definition} must be the
16406 » * �ur-type definition�." 16437 » * `ur-type definition`."
16407 * PASS 16438 * PASS
16408 */ 16439 */
16409 } else if ((type->contentType == XML_SCHEMA_CONTENT_SIMPLE) || 16440 } else if ((type->contentType == XML_SCHEMA_CONTENT_SIMPLE) ||
16410 (type->contentType == XML_SCHEMA_CONTENT_BASIC)) { 16441 (type->contentType == XML_SCHEMA_CONTENT_BASIC)) {
16411 /* 16442 /*
16412 * SPEC (5.2.1) "The {content type} of the complex type definition 16443 * SPEC (5.2.1) "The {content type} of the complex type definition
16413 * must be a simple type definition" 16444 * must be a simple type definition"
16414 * 16445 *
16415 * SPEC (5.2.2) "One of the following must be true:" 16446 * SPEC (5.2.2) "One of the following must be true:"
16416 */ 16447 */
16417 if ((base->contentType == XML_SCHEMA_CONTENT_SIMPLE) || 16448 if ((base->contentType == XML_SCHEMA_CONTENT_SIMPLE) ||
16418 (base->contentType == XML_SCHEMA_CONTENT_BASIC)) 16449 (base->contentType == XML_SCHEMA_CONTENT_BASIC))
16419 { 16450 {
16420 int err; 16451 int err;
16421 /* 16452 /*
16422 * SPEC (5.2.2.1) "The {content type} of the {base type 16453 * SPEC (5.2.2.1) "The {content type} of the {base type
16423 * definition} must be a simple type definition from which 16454 * definition} must be a simple type definition from which
16424 * the {content type} is validly derived given the empty 16455 * the {content type} is validly derived given the empty
16425 » * set as defined in Type Derivation OK (Simple) (�3.14.6)." 16456 » * set as defined in Type Derivation OK (Simple) ($3.14.6)."
16426 * 16457 *
16427 * ATTENTION TODO: This seems not needed if the type implicitely 16458 * ATTENTION TODO: This seems not needed if the type implicitely
16428 * derived from the base type. 16459 * derived from the base type.
16429 * 16460 *
16430 */ 16461 */
16431 err = xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST ctxt, 16462 err = xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST ctxt,
16432 type->contentTypeDef, base->contentTypeDef, 0); 16463 type->contentTypeDef, base->contentTypeDef, 0);
16433 if (err != 0) { 16464 if (err != 0) {
16434 xmlChar *strA = NULL, *strB = NULL; 16465 xmlChar *strA = NULL, *strB = NULL;
16435 16466
(...skipping 10 matching lines...) Expand all
16446 base->contentTypeDef)); 16477 base->contentTypeDef));
16447 FREE_AND_NULL(strA); 16478 FREE_AND_NULL(strA);
16448 FREE_AND_NULL(strB); 16479 FREE_AND_NULL(strB);
16449 return(ctxt->err); 16480 return(ctxt->err);
16450 } 16481 }
16451 } else if ((base->contentType == XML_SCHEMA_CONTENT_MIXED) && 16482 } else if ((base->contentType == XML_SCHEMA_CONTENT_MIXED) &&
16452 (xmlSchemaIsParticleEmptiable( 16483 (xmlSchemaIsParticleEmptiable(
16453 (xmlSchemaParticlePtr) base->subtypes))) { 16484 (xmlSchemaParticlePtr) base->subtypes))) {
16454 /* 16485 /*
16455 * SPEC (5.2.2.2) "The {base type definition} must be mixed 16486 * SPEC (5.2.2.2) "The {base type definition} must be mixed
16456 » * and have a particle which is �emptiable� as defined in 16487 » * and have a particle which is `emptiable` as defined in
16457 » * Particle Emptiable (�3.9.6)." 16488 » * Particle Emptiable ($3.9.6)."
16458 * PASS 16489 * PASS
16459 */ 16490 */
16460 } else { 16491 } else {
16461 xmlSchemaPCustomErr(ctxt, 16492 xmlSchemaPCustomErr(ctxt,
16462 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, 16493 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1,
16463 WXS_BASIC_CAST type, NULL, 16494 WXS_BASIC_CAST type, NULL,
16464 "The content type of the base type must be either " 16495 "The content type of the base type must be either "
16465 "a simple type or 'mixed' and an emptiable particle", NULL); 16496 "a simple type or 'mixed' and an emptiable particle", NULL);
16466 return (ctxt->err); 16497 return (ctxt->err);
16467 } 16498 }
16468 } else if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { 16499 } else if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) {
16469 /* 16500 /*
16470 * SPEC (5.3.1) "The {content type} of the complex type itself must 16501 * SPEC (5.3.1) "The {content type} of the complex type itself must
16471 * be empty" 16502 * be empty"
16472 */ 16503 */
16473 if (base->contentType == XML_SCHEMA_CONTENT_EMPTY) { 16504 if (base->contentType == XML_SCHEMA_CONTENT_EMPTY) {
16474 /* 16505 /*
16475 * SPEC (5.3.2.1) "The {content type} of the {base type 16506 * SPEC (5.3.2.1) "The {content type} of the {base type
16476 * definition} must also be empty." 16507 * definition} must also be empty."
16477 * PASS 16508 * PASS
16478 */ 16509 */
16479 } else if (((base->contentType == XML_SCHEMA_CONTENT_ELEMENTS) || 16510 } else if (((base->contentType == XML_SCHEMA_CONTENT_ELEMENTS) ||
16480 (base->contentType == XML_SCHEMA_CONTENT_MIXED)) && 16511 (base->contentType == XML_SCHEMA_CONTENT_MIXED)) &&
16481 xmlSchemaIsParticleEmptiable( 16512 xmlSchemaIsParticleEmptiable(
16482 (xmlSchemaParticlePtr) base->subtypes)) { 16513 (xmlSchemaParticlePtr) base->subtypes)) {
16483 /* 16514 /*
16484 * SPEC (5.3.2.2) "The {content type} of the {base type 16515 * SPEC (5.3.2.2) "The {content type} of the {base type
16485 * definition} must be elementOnly or mixed and have a particle 16516 * definition} must be elementOnly or mixed and have a particle
16486 » * which is �emptiable� as defined in Particle Emptiable (�3.9.6)." 16517 » * which is `emptiable` as defined in Particle Emptiable ($3.9.6)."
16487 * PASS 16518 * PASS
16488 */ 16519 */
16489 } else { 16520 } else {
16490 xmlSchemaPCustomErr(ctxt, 16521 xmlSchemaPCustomErr(ctxt,
16491 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, 16522 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1,
16492 WXS_BASIC_CAST type, NULL, 16523 WXS_BASIC_CAST type, NULL,
16493 "The content type of the base type must be either " 16524 "The content type of the base type must be either "
16494 "empty or 'mixed' (or 'elements-only') and an emptiable " 16525 "empty or 'mixed' (or 'elements-only') and an emptiable "
16495 "particle", NULL); 16526 "particle", NULL);
16496 return (ctxt->err); 16527 return (ctxt->err);
(...skipping 12 matching lines...) Expand all
16509 */ 16540 */
16510 xmlSchemaPCustomErr(ctxt, 16541 xmlSchemaPCustomErr(ctxt,
16511 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, 16542 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1,
16512 WXS_BASIC_CAST type, NULL, 16543 WXS_BASIC_CAST type, NULL,
16513 "If the content type is 'mixed', then the content type of the " 16544 "If the content type is 'mixed', then the content type of the "
16514 "base type must also be 'mixed'", NULL); 16545 "base type must also be 'mixed'", NULL);
16515 return (ctxt->err); 16546 return (ctxt->err);
16516 } 16547 }
16517 /* 16548 /*
16518 * SPEC (5.4.2) "The particle of the complex type definition itself 16549 * SPEC (5.4.2) "The particle of the complex type definition itself
16519 » * must be a �valid restriction� of the particle of the {content 16550 » * must be a `valid restriction` of the particle of the {content
16520 * type} of the {base type definition} as defined in Particle Valid 16551 * type} of the {base type definition} as defined in Particle Valid
16521 » * (Restriction) (�3.9.6). 16552 » * (Restriction) ($3.9.6).
16522 * 16553 *
16523 * URGENT TODO: (5.4.2) 16554 * URGENT TODO: (5.4.2)
16524 */ 16555 */
16525 } else { 16556 } else {
16526 xmlSchemaPCustomErr(ctxt, 16557 xmlSchemaPCustomErr(ctxt,
16527 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, 16558 XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1,
16528 WXS_BASIC_CAST type, NULL, 16559 WXS_BASIC_CAST type, NULL,
16529 "The type is not a valid restriction of its base type", NULL); 16560 "The type is not a valid restriction of its base type", NULL);
16530 return (ctxt->err); 16561 return (ctxt->err);
16531 } 16562 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
16580 int ret = 0; 16611 int ret = 0;
16581 16612
16582 /* 16613 /*
16583 * TODO: Adjust the error codes here, as I used 16614 * TODO: Adjust the error codes here, as I used
16584 * XML_SCHEMAP_SRC_CT_1 only yet. 16615 * XML_SCHEMAP_SRC_CT_1 only yet.
16585 */ 16616 */
16586 base = type->baseType; 16617 base = type->baseType;
16587 if (! WXS_HAS_SIMPLE_CONTENT(type)) { 16618 if (! WXS_HAS_SIMPLE_CONTENT(type)) {
16588 /* 16619 /*
16589 * 1 If the <complexContent> alternative is chosen, the type definition 16620 * 1 If the <complexContent> alternative is chosen, the type definition
16590 » * �resolved� to by the �actual value� of the base [attribute] 16621 » * `resolved` to by the `actual value` of the base [attribute]
16591 * must be a complex type definition; 16622 * must be a complex type definition;
16592 */ 16623 */
16593 if (! WXS_IS_COMPLEX(base)) { 16624 if (! WXS_IS_COMPLEX(base)) {
16594 xmlChar *str = NULL; 16625 xmlChar *str = NULL;
16595 xmlSchemaPCustomErr(ctxt, 16626 xmlSchemaPCustomErr(ctxt,
16596 XML_SCHEMAP_SRC_CT_1, 16627 XML_SCHEMAP_SRC_CT_1,
16597 WXS_BASIC_CAST type, type->node, 16628 WXS_BASIC_CAST type, type->node,
16598 "If using <complexContent>, the base type is expected to be " 16629 "If using <complexContent>, the base type is expected to be "
16599 "a complex type. The base type '%s' is a simple type", 16630 "a complex type. The base type '%s' is a simple type",
16600 xmlSchemaFormatQName(&str, base->targetNamespace, 16631 xmlSchemaFormatQName(&str, base->targetNamespace,
16601 base->name)); 16632 base->name));
16602 FREE_AND_NULL(str) 16633 FREE_AND_NULL(str)
16603 return (XML_SCHEMAP_SRC_CT_1); 16634 return (XML_SCHEMAP_SRC_CT_1);
16604 } 16635 }
16605 } else { 16636 } else {
16606 /* 16637 /*
16607 * SPEC 16638 * SPEC
16608 * 2 If the <simpleContent> alternative is chosen, all of the 16639 * 2 If the <simpleContent> alternative is chosen, all of the
16609 * following must be true: 16640 * following must be true:
16610 » * 2.1 The type definition �resolved� to by the �actual value� of the 16641 » * 2.1 The type definition `resolved` to by the `actual value` of the
16611 * base [attribute] must be one of the following: 16642 * base [attribute] must be one of the following:
16612 */ 16643 */
16613 if (WXS_IS_SIMPLE(base)) { 16644 if (WXS_IS_SIMPLE(base)) {
16614 if (WXS_IS_EXTENSION(type) == 0) { 16645 if (WXS_IS_EXTENSION(type) == 0) {
16615 xmlChar *str = NULL; 16646 xmlChar *str = NULL;
16616 /* 16647 /*
16617 * 2.1.3 only if the <extension> alternative is also 16648 * 2.1.3 only if the <extension> alternative is also
16618 * chosen, a simple type definition. 16649 * chosen, a simple type definition.
16619 */ 16650 */
16620 /* TODO: Change error code to ..._SRC_CT_2_1_3. */ 16651 /* TODO: Change error code to ..._SRC_CT_2_1_3. */
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
16706 "is a complex type", 16737 "is a complex type",
16707 xmlSchemaFormatQName(&str, base->targetNamespace, 16738 xmlSchemaFormatQName(&str, base->targetNamespace,
16708 base->name)); 16739 base->name));
16709 } 16740 }
16710 FREE_AND_NULL(str) 16741 FREE_AND_NULL(str)
16711 } 16742 }
16712 } 16743 }
16713 /* 16744 /*
16714 * SPEC (3) "The corresponding complex type definition component must 16745 * SPEC (3) "The corresponding complex type definition component must
16715 * satisfy the conditions set out in Constraints on Complex Type 16746 * satisfy the conditions set out in Constraints on Complex Type
16716 * Definition Schema Components (�3.4.6);" 16747 * Definition Schema Components ($3.4.6);"
16717 * NOTE (3) will be done in xmlSchemaTypeFixup(). 16748 * NOTE (3) will be done in xmlSchemaTypeFixup().
16718 */ 16749 */
16719 /* 16750 /*
16720 * SPEC (4) If clause 2.2.1 or clause 2.2.2 in the correspondence specificati on 16751 * SPEC (4) If clause 2.2.1 or clause 2.2.2 in the correspondence specificati on
16721 * above for {attribute wildcard} is satisfied, the intensional 16752 * above for {attribute wildcard} is satisfied, the intensional
16722 * intersection must be expressible, as defined in Attribute Wildcard 16753 * intersection must be expressible, as defined in Attribute Wildcard
16723 * Intersection (�3.10.6). 16754 * Intersection ($3.10.6).
16724 * NOTE (4) is done in xmlSchemaFixupTypeAttributeUses(). 16755 * NOTE (4) is done in xmlSchemaFixupTypeAttributeUses().
16725 */ 16756 */
16726 return (ret); 16757 return (ret);
16727 } 16758 }
16728 16759
16729 #ifdef ENABLE_PARTICLE_RESTRICTION 16760 #ifdef ENABLE_PARTICLE_RESTRICTION
16730 /** 16761 /**
16731 * xmlSchemaCheckParticleRangeOK: 16762 * xmlSchemaCheckParticleRangeOK:
16732 * @ctxt: the schema parser context 16763 * @ctxt: the schema parser context
16733 * @type: the complex type definition 16764 * @type: the complex type definition
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
16784 /* 16815 /*
16785 * SPEC (1) "The declarations' {name}s and {target namespace}s are 16816 * SPEC (1) "The declarations' {name}s and {target namespace}s are
16786 * the same." 16817 * the same."
16787 */ 16818 */
16788 if ((elemR != elemB) && 16819 if ((elemR != elemB) &&
16789 ((! xmlStrEqual(elemR->name, elemB->name)) || 16820 ((! xmlStrEqual(elemR->name, elemB->name)) ||
16790 (! xmlStrEqual(elemR->targetNamespace, elemB->targetNamespace)))) 16821 (! xmlStrEqual(elemR->targetNamespace, elemB->targetNamespace))))
16791 return (1); 16822 return (1);
16792 /* 16823 /*
16793 * SPEC (2) "R's occurrence range is a valid restriction of B's 16824 * SPEC (2) "R's occurrence range is a valid restriction of B's
16794 * occurrence range as defined by Occurrence Range OK (�3.9.6)." 16825 * occurrence range as defined by Occurrence Range OK ($3.9.6)."
16795 */ 16826 */
16796 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, 16827 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs,
16797 b->minOccurs, b->maxOccurs) != 0) 16828 b->minOccurs, b->maxOccurs) != 0)
16798 return (1); 16829 return (1);
16799 /* 16830 /*
16800 * SPEC (3.1) "Both B's declaration's {scope} and R's declaration's 16831 * SPEC (3.1) "Both B's declaration's {scope} and R's declaration's
16801 * {scope} are global." 16832 * {scope} are global."
16802 */ 16833 */
16803 if (elemR == elemB) 16834 if (elemR == elemB)
16804 return (0); 16835 return (0);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
16876 * Returns 0 if the constraints are satisfied, a positive 16907 * Returns 0 if the constraints are satisfied, a positive
16877 * error code if not and -1 if an internal error occured. 16908 * error code if not and -1 if an internal error occured.
16878 */ 16909 */
16879 static int 16910 static int
16880 xmlSchemaCheckRCaseNSCompat(xmlSchemaParserCtxtPtr ctxt, 16911 xmlSchemaCheckRCaseNSCompat(xmlSchemaParserCtxtPtr ctxt,
16881 xmlSchemaParticlePtr r, 16912 xmlSchemaParticlePtr r,
16882 xmlSchemaParticlePtr b) 16913 xmlSchemaParticlePtr b)
16883 { 16914 {
16884 /* TODO:Error codes (rcase-NSCompat). */ 16915 /* TODO:Error codes (rcase-NSCompat). */
16885 /* 16916 /*
16886 * SPEC "For an element declaration particle to be a �valid restriction� 16917 * SPEC "For an element declaration particle to be a `valid restriction`
16887 * of a wildcard particle all of the following must be true:" 16918 * of a wildcard particle all of the following must be true:"
16888 * 16919 *
16889 * SPEC (1) "The element declaration's {target namespace} is �valid� 16920 * SPEC (1) "The element declaration's {target namespace} is `valid`
16890 * with respect to the wildcard's {namespace constraint} as defined by 16921 * with respect to the wildcard's {namespace constraint} as defined by
16891 * Wildcard allows Namespace Name (�3.10.4)." 16922 * Wildcard allows Namespace Name ($3.10.4)."
16892 */ 16923 */
16893 if (xmlSchemaCheckCVCWildcardNamespace((xmlSchemaWildcardPtr) b->children, 16924 if (xmlSchemaCheckCVCWildcardNamespace((xmlSchemaWildcardPtr) b->children,
16894 ((xmlSchemaElementPtr) r->children)->targetNamespace) != 0) 16925 ((xmlSchemaElementPtr) r->children)->targetNamespace) != 0)
16895 return (1); 16926 return (1);
16896 /* 16927 /*
16897 * SPEC (2) "R's occurrence range is a valid restriction of B's 16928 * SPEC (2) "R's occurrence range is a valid restriction of B's
16898 * occurrence range as defined by Occurrence Range OK (�3.9.6)." 16929 * occurrence range as defined by Occurrence Range OK ($3.9.6)."
16899 */ 16930 */
16900 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, 16931 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs,
16901 b->minOccurs, b->maxOccurs) != 0) 16932 b->minOccurs, b->maxOccurs) != 0)
16902 return (1); 16933 return (1);
16903 16934
16904 return (0); 16935 return (0);
16905 } 16936 }
16906 16937
16907 /** 16938 /**
16908 * xmlSchemaCheckRCaseRecurseAsIfGroup: 16939 * xmlSchemaCheckRCaseRecurseAsIfGroup:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
16948 */ 16979 */
16949 static int 16980 static int
16950 xmlSchemaCheckRCaseNSSubset(xmlSchemaParserCtxtPtr ctxt, 16981 xmlSchemaCheckRCaseNSSubset(xmlSchemaParserCtxtPtr ctxt,
16951 xmlSchemaParticlePtr r, 16982 xmlSchemaParticlePtr r,
16952 xmlSchemaParticlePtr b, 16983 xmlSchemaParticlePtr b,
16953 int isAnyTypeBase) 16984 int isAnyTypeBase)
16954 { 16985 {
16955 /* TODO: Error codes (rcase-NSSubset). */ 16986 /* TODO: Error codes (rcase-NSSubset). */
16956 /* 16987 /*
16957 * SPEC (1) "R's occurrence range is a valid restriction of B's 16988 * SPEC (1) "R's occurrence range is a valid restriction of B's
16958 * occurrence range as defined by Occurrence Range OK (�3.9.6)." 16989 * occurrence range as defined by Occurrence Range OK ($3.9.6)."
16959 */ 16990 */
16960 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, 16991 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs,
16961 b->minOccurs, b->maxOccurs)) 16992 b->minOccurs, b->maxOccurs))
16962 return (1); 16993 return (1);
16963 /* 16994 /*
16964 * SPEC (2) "R's {namespace constraint} must be an intensional subset 16995 * SPEC (2) "R's {namespace constraint} must be an intensional subset
16965 * of B's {namespace constraint} as defined by Wildcard Subset (�3.10.6)." 16996 * of B's {namespace constraint} as defined by Wildcard Subset ($3.10.6)."
16966 */ 16997 */
16967 if (xmlSchemaCheckCOSNSSubset((xmlSchemaWildcardPtr) r->children, 16998 if (xmlSchemaCheckCOSNSSubset((xmlSchemaWildcardPtr) r->children,
16968 (xmlSchemaWildcardPtr) b->children)) 16999 (xmlSchemaWildcardPtr) b->children))
16969 return (1); 17000 return (1);
16970 /* 17001 /*
16971 * SPEC (3) "Unless B is the content model wildcard of the �ur-type 17002 * SPEC (3) "Unless B is the content model wildcard of the `ur-type
16972 * definition�, R's {process contents} must be identical to or stronger 17003 * definition`, R's {process contents} must be identical to or stronger
16973 * than B's {process contents}, where strict is stronger than lax is 17004 * than B's {process contents}, where strict is stronger than lax is
16974 * stronger than skip." 17005 * stronger than skip."
16975 */ 17006 */
16976 if (! isAnyTypeBase) { 17007 if (! isAnyTypeBase) {
16977 if ( ((xmlSchemaWildcardPtr) r->children)->processContents < 17008 if ( ((xmlSchemaWildcardPtr) r->children)->processContents <
16978 ((xmlSchemaWildcardPtr) b->children)->processContents) 17009 ((xmlSchemaWildcardPtr) b->children)->processContents)
16979 return (1); 17010 return (1);
16980 } 17011 }
16981 17012
16982 return (0); 17013 return (0);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
17040 static int 17071 static int
17041 xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt, 17072 xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt,
17042 xmlSchemaParticlePtr r, 17073 xmlSchemaParticlePtr r,
17043 xmlSchemaParticlePtr b) 17074 xmlSchemaParticlePtr b)
17044 { 17075 {
17045 xmlSchemaParticlePtr part; 17076 xmlSchemaParticlePtr part;
17046 /* TODO: Error codes (rcase-NSRecurseCheckCardinality). */ 17077 /* TODO: Error codes (rcase-NSRecurseCheckCardinality). */
17047 if ((r->children == NULL) || (r->children->children == NULL)) 17078 if ((r->children == NULL) || (r->children->children == NULL))
17048 return (-1); 17079 return (-1);
17049 /* 17080 /*
17050 * SPEC "For a group particle to be a �valid restriction� of a 17081 * SPEC "For a group particle to be a `valid restriction` of a
17051 * wildcard particle..." 17082 * wildcard particle..."
17052 * 17083 *
17053 * SPEC (1) "Every member of the {particles} of the group is a �valid 17084 * SPEC (1) "Every member of the {particles} of the group is a `valid
17054 * restriction� of the wildcard as defined by 17085 * restriction` of the wildcard as defined by
17055 * Particle Valid (Restriction) (�3.9.6)." 17086 * Particle Valid (Restriction) ($3.9.6)."
17056 */ 17087 */
17057 part = (xmlSchemaParticlePtr) r->children->children; 17088 part = (xmlSchemaParticlePtr) r->children->children;
17058 do { 17089 do {
17059 if (xmlSchemaCheckCOSParticleRestrict(ctxt, part, b)) 17090 if (xmlSchemaCheckCOSParticleRestrict(ctxt, part, b))
17060 return (1); 17091 return (1);
17061 part = (xmlSchemaParticlePtr) part->next; 17092 part = (xmlSchemaParticlePtr) part->next;
17062 } while (part != NULL); 17093 } while (part != NULL);
17063 /* 17094 /*
17064 * SPEC (2) "The effective total range of the group [...] is a 17095 * SPEC (2) "The effective total range of the group [...] is a
17065 * valid restriction of B's occurrence range as defined by 17096 * valid restriction of B's occurrence range as defined by
17066 * Occurrence Range OK (�3.9.6)." 17097 * Occurrence Range OK ($3.9.6)."
17067 */ 17098 */
17068 if (xmlSchemaCheckParticleRangeOK( 17099 if (xmlSchemaCheckParticleRangeOK(
17069 xmlSchemaGetParticleTotalRangeMin(r), 17100 xmlSchemaGetParticleTotalRangeMin(r),
17070 xmlSchemaGetParticleTotalRangeMax(r), 17101 xmlSchemaGetParticleTotalRangeMax(r),
17071 b->minOccurs, b->maxOccurs) != 0) 17102 b->minOccurs, b->maxOccurs) != 0)
17072 return (1); 17103 return (1);
17073 return (0); 17104 return (0);
17074 } 17105 }
17075 #endif 17106 #endif
17076 17107
(...skipping 19 matching lines...) Expand all
17096 xmlSchemaCheckRCaseRecurse(xmlSchemaParserCtxtPtr ctxt, 17127 xmlSchemaCheckRCaseRecurse(xmlSchemaParserCtxtPtr ctxt,
17097 xmlSchemaParticlePtr r, 17128 xmlSchemaParticlePtr r,
17098 xmlSchemaParticlePtr b) 17129 xmlSchemaParticlePtr b)
17099 { 17130 {
17100 /* xmlSchemaParticlePtr part; */ 17131 /* xmlSchemaParticlePtr part; */
17101 /* TODO: Error codes (rcase-Recurse). */ 17132 /* TODO: Error codes (rcase-Recurse). */
17102 if ((r->children == NULL) || (b->children == NULL) || 17133 if ((r->children == NULL) || (b->children == NULL) ||
17103 (r->children->type != b->children->type)) 17134 (r->children->type != b->children->type))
17104 return (-1); 17135 return (-1);
17105 /* 17136 /*
17106 * SPEC "For an all or sequence group particle to be a �valid 17137 * SPEC "For an all or sequence group particle to be a `valid
17107 * restriction� of another group particle with the same {compositor}..." 17138 * restriction` of another group particle with the same {compositor}..."
17108 * 17139 *
17109 * SPEC (1) "R's occurrence range is a valid restriction of B's 17140 * SPEC (1) "R's occurrence range is a valid restriction of B's
17110 * occurrence range as defined by Occurrence Range OK (�3.9.6)." 17141 * occurrence range as defined by Occurrence Range OK ($3.9.6)."
17111 */ 17142 */
17112 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, 17143 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs,
17113 b->minOccurs, b->maxOccurs)) 17144 b->minOccurs, b->maxOccurs))
17114 return (1); 17145 return (1);
17115 17146
17116 17147
17117 return (0); 17148 return (0);
17118 } 17149 }
17119 17150
17120 #endif 17151 #endif
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
17724 return (-1); 17755 return (-1);
17725 } 17756 }
17726 17757
17727 static int 17758 static int
17728 xmlSchemaFinishMemberTypeDefinitionsProperty(xmlSchemaParserCtxtPtr pctxt, 17759 xmlSchemaFinishMemberTypeDefinitionsProperty(xmlSchemaParserCtxtPtr pctxt,
17729 xmlSchemaTypePtr type) 17760 xmlSchemaTypePtr type)
17730 { 17761 {
17731 xmlSchemaTypeLinkPtr link, lastLink, prevLink, subLink, newLink; 17762 xmlSchemaTypeLinkPtr link, lastLink, prevLink, subLink, newLink;
17732 /* 17763 /*
17733 * The actual value is then formed by replacing any union type 17764 * The actual value is then formed by replacing any union type
17734 * definition in the �explicit members� with the members of their 17765 * definition in the `explicit members` with the members of their
17735 * {member type definitions}, in order. 17766 * {member type definitions}, in order.
17736 * 17767 *
17737 * TODO: There's a bug entry at 17768 * TODO: There's a bug entry at
17738 * "http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/02 87.html" 17769 * "http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/02 87.html"
17739 * which indicates that we'll keep the union types the future. 17770 * which indicates that we'll keep the union types the future.
17740 */ 17771 */
17741 link = type->memberTypes; 17772 link = type->memberTypes;
17742 while (link != NULL) { 17773 while (link != NULL) {
17743 17774
17744 if (WXS_IS_TYPE_NOT_FIXED(link->type)) 17775 if (WXS_IS_TYPE_NOT_FIXED(link->type))
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
17858 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; 17889 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE;
17859 break; 17890 break;
17860 default: 17891 default:
17861 return (-1); 17892 return (-1);
17862 } 17893 }
17863 return (0); 17894 return (0);
17864 } 17895 }
17865 } 17896 }
17866 } 17897 }
17867 /* 17898 /*
17868 * For all �atomic� datatypes other than string (and types �derived� 17899 * For all `atomic` datatypes other than string (and types `derived`
17869 * by �restriction� from it) the value of whiteSpace is fixed to 17900 * by `restriction` from it) the value of whiteSpace is fixed to
17870 * collapse 17901 * collapse
17871 */ 17902 */
17872 { 17903 {
17873 xmlSchemaTypePtr anc; 17904 xmlSchemaTypePtr anc;
17874 17905
17875 for (anc = type->baseType; anc != NULL && 17906 for (anc = type->baseType; anc != NULL &&
17876 anc->builtInType != XML_SCHEMAS_ANYTYPE; 17907 anc->builtInType != XML_SCHEMAS_ANYTYPE;
17877 anc = anc->baseType) { 17908 anc = anc->baseType) {
17878 17909
17879 if (anc->type == XML_SCHEMA_TYPE_BASIC) { 17910 if (anc->type == XML_SCHEMA_TYPE_BASIC) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
18048 * NOTE that this might change in WXS 1.1; i.e. we will keep the union 18079 * NOTE that this might change in WXS 1.1; i.e. we will keep the union
18049 * types in WXS 1.1. 18080 * types in WXS 1.1.
18050 */ 18081 */
18051 if ((type->memberTypes != NULL) && 18082 if ((type->memberTypes != NULL) &&
18052 (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1)) 18083 (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1))
18053 return(-1); 18084 return(-1);
18054 /* 18085 /*
18055 * SPEC src-simple-type 1 18086 * SPEC src-simple-type 1
18056 * "The corresponding simple type definition, if any, must satisfy 18087 * "The corresponding simple type definition, if any, must satisfy
18057 * the conditions set out in Constraints on Simple Type Definition 18088 * the conditions set out in Constraints on Simple Type Definition
18058 * Schema Components (�3.14.6)." 18089 * Schema Components ($3.14.6)."
18059 */ 18090 */
18060 /* 18091 /*
18061 * Schema Component Constraint: Simple Type Definition Properties Correct 18092 * Schema Component Constraint: Simple Type Definition Properties Correct
18062 * (st-props-correct) 18093 * (st-props-correct)
18063 */ 18094 */
18064 res = xmlSchemaCheckSTPropsCorrect(pctxt, type); 18095 res = xmlSchemaCheckSTPropsCorrect(pctxt, type);
18065 HFAILURE HERROR 18096 HFAILURE HERROR
18066 /* 18097 /*
18067 * Schema Component Constraint: Derivation Valid (Restriction, Simple) 18098 * Schema Component Constraint: Derivation Valid (Restriction, Simple)
18068 * (cos-st-restricts) 18099 * (cos-st-restricts)
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
18308 */ 18339 */
18309 if ((particle == NULL) || 18340 if ((particle == NULL) ||
18310 ((particle->type == XML_SCHEMA_TYPE_PARTICLE) && 18341 ((particle->type == XML_SCHEMA_TYPE_PARTICLE) &&
18311 ((particle->children->type == XML_SCHEMA_TYPE_ALL) || 18342 ((particle->children->type == XML_SCHEMA_TYPE_ALL) ||
18312 (particle->children->type == XML_SCHEMA_TYPE_SEQUENCE) || 18343 (particle->children->type == XML_SCHEMA_TYPE_SEQUENCE) ||
18313 ((particle->children->type == XML_SCHEMA_TYPE_CHOICE) && 18344 ((particle->children->type == XML_SCHEMA_TYPE_CHOICE) &&
18314 (particle->minOccurs == 0))) && 18345 (particle->minOccurs == 0))) &&
18315 ( ((xmlSchemaTreeItemPtr) particle->children)->children == NULL))) { 18346 ( ((xmlSchemaTreeItemPtr) particle->children)->children == NULL))) {
18316 if (type->flags & XML_SCHEMAS_TYPE_MIXED) { 18347 if (type->flags & XML_SCHEMAS_TYPE_MIXED) {
18317 /* 18348 /*
18318 » » * SPEC (2.1.4) "If the �effective mixed� is true, then 18349 » » * SPEC (2.1.4) "If the `effective mixed` is true, then
18319 * a particle whose properties are as follows:..." 18350 * a particle whose properties are as follows:..."
18320 * 18351 *
18321 * Empty sequence model group with 18352 * Empty sequence model group with
18322 * minOccurs/maxOccurs = 1 (i.e. a "particle emptiable"). 18353 * minOccurs/maxOccurs = 1 (i.e. a "particle emptiable").
18323 * NOTE that we sill assign it the <complexType> node to 18354 * NOTE that we sill assign it the <complexType> node to
18324 * somehow anchor it in the doc. 18355 * somehow anchor it in the doc.
18325 */ 18356 */
18326 if ((particle == NULL) || 18357 if ((particle == NULL) ||
18327 (particle->children->type != XML_SCHEMA_TYPE_SEQUENCE)) { 18358 (particle->children->type != XML_SCHEMA_TYPE_SEQUENCE)) {
18328 /* 18359 /*
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
18370 if (type->flags & XML_SCHEMAS_TYPE_MIXED) 18401 if (type->flags & XML_SCHEMAS_TYPE_MIXED)
18371 type->contentType = XML_SCHEMA_CONTENT_MIXED; 18402 type->contentType = XML_SCHEMA_CONTENT_MIXED;
18372 } 18403 }
18373 } else { 18404 } else {
18374 /* 18405 /*
18375 * SPEC (3.2) "If <extension>..." 18406 * SPEC (3.2) "If <extension>..."
18376 */ 18407 */
18377 if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { 18408 if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) {
18378 /* 18409 /*
18379 * SPEC (3.2.1) 18410 * SPEC (3.2.1)
18380 » » * "If the �effective content� is empty, then the 18411 » » * "If the `effective content` is empty, then the
18381 * {content type} of the [...] base ..." 18412 * {content type} of the [...] base ..."
18382 */ 18413 */
18383 type->contentType = baseType->contentType; 18414 type->contentType = baseType->contentType;
18384 type->subtypes = baseType->subtypes; 18415 type->subtypes = baseType->subtypes;
18385 /* 18416 /*
18386 * Fixes bug #347316: 18417 * Fixes bug #347316:
18387 * This is the case when the base type has a simple 18418 * This is the case when the base type has a simple
18388 * type definition as content. 18419 * type definition as content.
18389 */ 18420 */
18390 type->contentTypeDef = baseType->contentTypeDef; 18421 type->contentTypeDef = baseType->contentTypeDef;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
18468 WXS_TYPE_CONTENTTYPE(type) = (xmlSchemaTypePtr) particle; 18499 WXS_TYPE_CONTENTTYPE(type) = (xmlSchemaTypePtr) particle;
18469 /* 18500 /*
18470 * SPEC "the particle of the {content type} of 18501 * SPEC "the particle of the {content type} of
18471 * the ... base ..." 18502 * the ... base ..."
18472 * Create a duplicate of the base type's particle 18503 * Create a duplicate of the base type's particle
18473 * and assign its "term" to it. 18504 * and assign its "term" to it.
18474 */ 18505 */
18475 particle->children->children = 18506 particle->children->children =
18476 (xmlSchemaTreeItemPtr) xmlSchemaAddParticle(pctxt, 18507 (xmlSchemaTreeItemPtr) xmlSchemaAddParticle(pctxt,
18477 type->node, 18508 type->node,
18478 » » » ((xmlSchemaParticlePtr) type->subtypes)->minOccurs, 18509 » » » ((xmlSchemaParticlePtr) baseType->subtypes)->minOccurs,
18479 » » » ((xmlSchemaParticlePtr) type->subtypes)->maxOccurs); 18510 » » » ((xmlSchemaParticlePtr) baseType->subtypes)->maxOccurs);
18480 if (particle->children->children == NULL) 18511 if (particle->children->children == NULL)
18481 goto exit_failure; 18512 goto exit_failure;
18482 particle = (xmlSchemaParticlePtr) 18513 particle = (xmlSchemaParticlePtr)
18483 particle->children->children; 18514 particle->children->children;
18484 particle->children = 18515 particle->children =
18485 ((xmlSchemaParticlePtr) baseType->subtypes)->children; 18516 ((xmlSchemaParticlePtr) baseType->subtypes)->children;
18486 /* 18517 /*
18487 » » * SPEC "followed by the �effective content�." 18518 » » * SPEC "followed by the `effective content`."
18488 */ 18519 */
18489 particle->next = effectiveContent; 18520 particle->next = effectiveContent;
18490 /* 18521 /*
18491 * This all will result in: 18522 * This all will result in:
18492 * new-particle 18523 * new-particle
18493 * --> new-sequence( 18524 * --> new-sequence(
18494 * new-particle 18525 * new-particle
18495 * --> base-model, 18526 * --> base-model,
18496 * this-particle 18527 * this-particle
18497 * --> this-model 18528 * --> this-model
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
18621 case XML_SCHEMA_FACET_MAXEXCLUSIVE: 18652 case XML_SCHEMA_FACET_MAXEXCLUSIVE:
18622 case XML_SCHEMA_FACET_ENUMERATION: { 18653 case XML_SCHEMA_FACET_ENUMERATION: {
18623 /* 18654 /*
18624 * Okay we need to validate the value 18655 * Okay we need to validate the value
18625 * at that point. 18656 * at that point.
18626 */ 18657 */
18627 xmlSchemaTypePtr base; 18658 xmlSchemaTypePtr base;
18628 18659
18629 /* 4.3.5.5 Constraints on enumeration Schema Components 18660 /* 4.3.5.5 Constraints on enumeration Schema Components
18630 * Schema Component Constraint: enumeration valid restriction 18661 * Schema Component Constraint: enumeration valid restriction
18631 » » * It is an �error� if any member of {value} is not in the 18662 » » * It is an `error` if any member of {value} is not in the
18632 » » * �value space� of {base type definition}. 18663 » » * `value space` of {base type definition}.
18633 * 18664 *
18634 * minInclusive, maxInclusive, minExclusive, maxExclusive: 18665 * minInclusive, maxInclusive, minExclusive, maxExclusive:
18635 » » * The value �must� be in the 18666 » » * The value `must` be in the
18636 » » * �value space� of the �base type�. 18667 » » * `value space` of the `base type`.
18637 */ 18668 */
18638 /* 18669 /*
18639 * This function is intended to deliver a compiled value 18670 * This function is intended to deliver a compiled value
18640 * on the facet. In this implementation of XML Schemata the 18671 * on the facet. In this implementation of XML Schemata the
18641 * type holding a facet, won't be a built-in type. 18672 * type holding a facet, won't be a built-in type.
18642 * Thus to ensure that other API 18673 * Thus to ensure that other API
18643 * calls (relaxng) do work, if the given type is a built-in 18674 * calls (relaxng) do work, if the given type is a built-in
18644 * type, we will assume that the given built-in type *is 18675 * type, we will assume that the given built-in type *is
18645 * already* the base type. 18676 * already* the base type.
18646 */ 18677 */
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
19061 { 19092 {
19062 /* 19093 /*
19063 * Schema Representation Constraint: 19094 * Schema Representation Constraint:
19064 * Attribute Group Definition Representation OK 19095 * Attribute Group Definition Representation OK
19065 * 3 Circular group reference is disallowed outside <redefine>. 19096 * 3 Circular group reference is disallowed outside <redefine>.
19066 * That is, unless this element information item's parent is 19097 * That is, unless this element information item's parent is
19067 * <redefine>, then among the [children], if any, there must 19098 * <redefine>, then among the [children], if any, there must
19068 * not be an <attributeGroup> with ref [attribute] which resolves 19099 * not be an <attributeGroup> with ref [attribute] which resolves
19069 * to the component corresponding to this <attributeGroup>. Indirect 19100 * to the component corresponding to this <attributeGroup>. Indirect
19070 * circularity is also ruled out. That is, when QName resolution 19101 * circularity is also ruled out. That is, when QName resolution
19071 * (Schema Document) (�3.15.3) is applied to a �QName� arising from 19102 * (Schema Document) ($3.15.3) is applied to a `QName` arising from
19072 * any <attributeGroup>s with a ref [attribute] among the [children], 19103 * any <attributeGroup>s with a ref [attribute] among the [children],
19073 * it must not be the case that a �QName� is encountered at any depth 19104 * it must not be the case that a `QName` is encountered at any depth
19074 * which resolves to the component corresponding to this <attributeGroup>. 19105 * which resolves to the component corresponding to this <attributeGroup>.
19075 */ 19106 */
19076 if (attrGr->attrUses == NULL) 19107 if (attrGr->attrUses == NULL)
19077 return(0); 19108 return(0);
19078 else if ((attrGr->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS) == 0) 19109 else if ((attrGr->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS) == 0)
19079 return(0); 19110 return(0);
19080 else { 19111 else {
19081 xmlSchemaQNameRefPtr circ; 19112 xmlSchemaQNameRefPtr circ;
19082 19113
19083 circ = xmlSchemaCheckAttrGroupCircularRecur(attrGr, 19114 circ = xmlSchemaCheckAttrGroupCircularRecur(attrGr,
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
19320 * Attribute Group Definition Properties Correct (ag-props-correct) 19351 * Attribute Group Definition Properties Correct (ag-props-correct)
19321 */ 19352 */
19322 static int 19353 static int
19323 xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, 19354 xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt,
19324 xmlSchemaAttributeGroupPtr attrGr) 19355 xmlSchemaAttributeGroupPtr attrGr)
19325 { 19356 {
19326 /* 19357 /*
19327 * SPEC ag-props-correct 19358 * SPEC ag-props-correct
19328 * (1) "The values of the properties of an attribute group definition 19359 * (1) "The values of the properties of an attribute group definition
19329 * must be as described in the property tableau in The Attribute 19360 * must be as described in the property tableau in The Attribute
19330 * Group Definition Schema Component (�3.6.1), modulo the impact of 19361 * Group Definition Schema Component ($3.6.1), modulo the impact of
19331 * Missing Sub-components (�5.3);" 19362 * Missing Sub-components ($5.3);"
19332 */ 19363 */
19333 19364
19334 if ((attrGr->attrUses != NULL) && 19365 if ((attrGr->attrUses != NULL) &&
19335 (WXS_LIST_CAST attrGr->attrUses)->nbItems > 1) 19366 (WXS_LIST_CAST attrGr->attrUses)->nbItems > 1)
19336 { 19367 {
19337 xmlSchemaItemListPtr uses = WXS_LIST_CAST attrGr->attrUses; 19368 xmlSchemaItemListPtr uses = WXS_LIST_CAST attrGr->attrUses;
19338 xmlSchemaAttributeUsePtr use, tmp; 19369 xmlSchemaAttributeUsePtr use, tmp;
19339 int i, j, hasId = 0; 19370 int i, j, hasId = 0;
19340 19371
19341 for (i = uses->nbItems -1; i >= 0; i--) { 19372 for (i = uses->nbItems -1; i >= 0; i--) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
19455 */ 19486 */
19456 static int 19487 static int
19457 xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, 19488 xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt,
19458 xmlSchemaAttributePtr attr) 19489 xmlSchemaAttributePtr attr)
19459 { 19490 {
19460 19491
19461 /* 19492 /*
19462 * SPEC a-props-correct (1) 19493 * SPEC a-props-correct (1)
19463 * "The values of the properties of an attribute declaration must 19494 * "The values of the properties of an attribute declaration must
19464 * be as described in the property tableau in The Attribute 19495 * be as described in the property tableau in The Attribute
19465 * Declaration Schema Component (�3.2.1), modulo the impact of 19496 * Declaration Schema Component ($3.2.1), modulo the impact of
19466 * Missing Sub-components (�5.3)." 19497 * Missing Sub-components ($5.3)."
19467 */ 19498 */
19468 19499
19469 if (WXS_ATTR_TYPEDEF(attr) == NULL) 19500 if (WXS_ATTR_TYPEDEF(attr) == NULL)
19470 return(0); 19501 return(0);
19471 19502
19472 if (attr->defValue != NULL) { 19503 if (attr->defValue != NULL) {
19473 int ret; 19504 int ret;
19474 19505
19475 /* 19506 /*
19476 * SPEC a-props-correct (3) 19507 * SPEC a-props-correct (3)
19477 * "If the {type definition} is or is derived from ID then there 19508 * "If the {type definition} is or is derived from ID then there
19478 * must not be a {value constraint}." 19509 * must not be a {value constraint}."
19479 */ 19510 */
19480 if (xmlSchemaIsDerivedFromBuiltInType( 19511 if (xmlSchemaIsDerivedFromBuiltInType(
19481 WXS_ATTR_TYPEDEF(attr), XML_SCHEMAS_ID)) 19512 WXS_ATTR_TYPEDEF(attr), XML_SCHEMAS_ID))
19482 { 19513 {
19483 xmlSchemaCustomErr(ACTXT_CAST pctxt, 19514 xmlSchemaCustomErr(ACTXT_CAST pctxt,
19484 XML_SCHEMAP_A_PROPS_CORRECT_3, 19515 XML_SCHEMAP_A_PROPS_CORRECT_3,
19485 NULL, WXS_BASIC_CAST attr, 19516 NULL, WXS_BASIC_CAST attr,
19486 "Value constraints are not allowed if the type definition " 19517 "Value constraints are not allowed if the type definition "
19487 "is or is derived from xs:ID", 19518 "is or is derived from xs:ID",
19488 NULL, NULL); 19519 NULL, NULL);
19489 return(pctxt->err); 19520 return(pctxt->err);
19490 } 19521 }
19491 /* 19522 /*
19492 * SPEC a-props-correct (2) 19523 * SPEC a-props-correct (2)
19493 * "if there is a {value constraint}, the canonical lexical 19524 * "if there is a {value constraint}, the canonical lexical
19494 » * representation of its value must be �valid� with respect 19525 » * representation of its value must be `valid` with respect
19495 » * to the {type definition} as defined in String Valid (�3.14.4)." 19526 » * to the {type definition} as defined in String Valid ($3.14.4)."
19496 » * TODO: Don't care about the *cononical* stuff here, this requirement 19527 » * TODO: Don't care about the *canonical* stuff here, this requirement
19497 * will be removed in WXS 1.1 anyway. 19528 * will be removed in WXS 1.1 anyway.
19498 */ 19529 */
19499 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, 19530 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt,
19500 attr->node, WXS_ATTR_TYPEDEF(attr), 19531 attr->node, WXS_ATTR_TYPEDEF(attr),
19501 attr->defValue, &(attr->defVal), 19532 attr->defValue, &(attr->defVal),
19502 1, 1, 0); 19533 1, 1, 0);
19503 if (ret != 0) { 19534 if (ret != 0) {
19504 if (ret < 0) { 19535 if (ret < 0) {
19505 PERROR_INT("xmlSchemaCheckAttrPropsCorrect", 19536 PERROR_INT("xmlSchemaCheckAttrPropsCorrect",
19506 "calling xmlSchemaVCheckCVCSimpleType()"); 19537 "calling xmlSchemaVCheckCVCSimpleType()");
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
19553 */ 19584 */
19554 static int 19585 static int
19555 xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, 19586 xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt,
19556 xmlSchemaElementPtr elemDecl) 19587 xmlSchemaElementPtr elemDecl)
19557 { 19588 {
19558 int ret = 0; 19589 int ret = 0;
19559 xmlSchemaTypePtr typeDef = WXS_ELEM_TYPEDEF(elemDecl); 19590 xmlSchemaTypePtr typeDef = WXS_ELEM_TYPEDEF(elemDecl);
19560 /* 19591 /*
19561 * SPEC (1) "The values of the properties of an element declaration 19592 * SPEC (1) "The values of the properties of an element declaration
19562 * must be as described in the property tableau in The Element 19593 * must be as described in the property tableau in The Element
19563 * Declaration Schema Component (�3.3.1), modulo the impact of Missing 19594 * Declaration Schema Component ($3.3.1), modulo the impact of Missing
19564 * Sub-components (�5.3)." 19595 * Sub-components ($5.3)."
19565 */ 19596 */
19566 if (WXS_SUBST_HEAD(elemDecl) != NULL) { 19597 if (WXS_SUBST_HEAD(elemDecl) != NULL) {
19567 xmlSchemaElementPtr head = WXS_SUBST_HEAD(elemDecl), circ; 19598 xmlSchemaElementPtr head = WXS_SUBST_HEAD(elemDecl), circ;
19568 19599
19569 xmlSchemaCheckElementDeclComponent(head, pctxt); 19600 xmlSchemaCheckElementDeclComponent(head, pctxt);
19570 /* 19601 /*
19571 » * SPEC (3) "If there is a non-�absent� {substitution group 19602 » * SPEC (3) "If there is a non-`absent` {substitution group
19572 * affiliation}, then {scope} must be global." 19603 * affiliation}, then {scope} must be global."
19573 */ 19604 */
19574 if ((elemDecl->flags & XML_SCHEMAS_ELEM_GLOBAL) == 0) { 19605 if ((elemDecl->flags & XML_SCHEMAS_ELEM_GLOBAL) == 0) {
19575 xmlSchemaPCustomErr(pctxt, 19606 xmlSchemaPCustomErr(pctxt,
19576 XML_SCHEMAP_E_PROPS_CORRECT_3, 19607 XML_SCHEMAP_E_PROPS_CORRECT_3,
19577 WXS_BASIC_CAST elemDecl, NULL, 19608 WXS_BASIC_CAST elemDecl, NULL,
19578 "Only global element declarations can have a " 19609 "Only global element declarations can have a "
19579 "substitution group affiliation", NULL); 19610 "substitution group affiliation", NULL);
19580 ret = XML_SCHEMAP_E_PROPS_CORRECT_3; 19611 ret = XML_SCHEMAP_E_PROPS_CORRECT_3;
19581 } 19612 }
(...skipping 23 matching lines...) Expand all
19605 FREE_AND_NULL(strA) 19636 FREE_AND_NULL(strA)
19606 FREE_AND_NULL(strB) 19637 FREE_AND_NULL(strB)
19607 ret = XML_SCHEMAP_E_PROPS_CORRECT_6; 19638 ret = XML_SCHEMAP_E_PROPS_CORRECT_6;
19608 } 19639 }
19609 /* 19640 /*
19610 * SPEC (4) "If there is a {substitution group affiliation}, 19641 * SPEC (4) "If there is a {substitution group affiliation},
19611 * the {type definition} 19642 * the {type definition}
19612 * of the element declaration must be validly derived from the {type 19643 * of the element declaration must be validly derived from the {type
19613 * definition} of the {substitution group affiliation}, given the value 19644 * definition} of the {substitution group affiliation}, given the value
19614 * of the {substitution group exclusions} of the {substitution group 19645 * of the {substitution group exclusions} of the {substitution group
19615 » * affiliation}, as defined in Type Derivation OK (Complex) (�3.4.6) 19646 » * affiliation}, as defined in Type Derivation OK (Complex) ($3.4.6)
19616 * (if the {type definition} is complex) or as defined in 19647 * (if the {type definition} is complex) or as defined in
19617 » * Type Derivation OK (Simple) (�3.14.6) (if the {type definition} is 19648 » * Type Derivation OK (Simple) ($3.14.6) (if the {type definition} is
19618 * simple)." 19649 * simple)."
19619 * 19650 *
19620 * NOTE: {substitution group exclusions} means the values of the 19651 * NOTE: {substitution group exclusions} means the values of the
19621 * attribute "final". 19652 * attribute "final".
19622 */ 19653 */
19623 19654
19624 if (typeDef != WXS_ELEM_TYPEDEF(WXS_SUBST_HEAD(elemDecl))) { 19655 if (typeDef != WXS_ELEM_TYPEDEF(WXS_SUBST_HEAD(elemDecl))) {
19625 int set = 0; 19656 int set = 0;
19626 19657
19627 if (head->flags & XML_SCHEMAS_ELEM_FINAL_EXTENSION) 19658 if (head->flags & XML_SCHEMAS_ELEM_FINAL_EXTENSION)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
19671 WXS_BASIC_CAST elemDecl, NULL, 19702 WXS_BASIC_CAST elemDecl, NULL,
19672 "The type definition (or type definition's content type) is or " 19703 "The type definition (or type definition's content type) is or "
19673 "is derived from ID; value constraints are not allowed in " 19704 "is derived from ID; value constraints are not allowed in "
19674 "conjunction with such a type definition", NULL); 19705 "conjunction with such a type definition", NULL);
19675 } else if (elemDecl->value != NULL) { 19706 } else if (elemDecl->value != NULL) {
19676 int vcret; 19707 int vcret;
19677 xmlNodePtr node = NULL; 19708 xmlNodePtr node = NULL;
19678 19709
19679 /* 19710 /*
19680 * SPEC (2) "If there is a {value constraint}, the canonical lexical 19711 * SPEC (2) "If there is a {value constraint}, the canonical lexical
19681 » * representation of its value must be �valid� with respect to the 19712 » * representation of its value must be `valid` with respect to the
19682 * {type definition} as defined in Element Default Valid (Immediate) 19713 * {type definition} as defined in Element Default Valid (Immediate)
19683 » * (�3.3.6)." 19714 » * ($3.3.6)."
19684 */ 19715 */
19685 if (typeDef == NULL) { 19716 if (typeDef == NULL) {
19686 xmlSchemaPErr(pctxt, elemDecl->node, 19717 xmlSchemaPErr(pctxt, elemDecl->node,
19687 XML_SCHEMAP_INTERNAL, 19718 XML_SCHEMAP_INTERNAL,
19688 "Internal error: xmlSchemaCheckElemPropsCorrect, " 19719 "Internal error: xmlSchemaCheckElemPropsCorrect, "
19689 "type is missing... skipping validation of " 19720 "type is missing... skipping validation of "
19690 "the value constraint", NULL, NULL); 19721 "the value constraint", NULL, NULL);
19691 return (-1); 19722 return (-1);
19692 } 19723 }
19693 if (elemDecl->node != NULL) { 19724 if (elemDecl->node != NULL) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
19741 /* SPEC (1) "Its {abstract} is false." */ 19772 /* SPEC (1) "Its {abstract} is false." */
19742 (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT)) 19773 (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT))
19743 return; 19774 return;
19744 { 19775 {
19745 xmlSchemaElementPtr head; 19776 xmlSchemaElementPtr head;
19746 xmlSchemaTypePtr headType, type; 19777 xmlSchemaTypePtr headType, type;
19747 int set, methSet; 19778 int set, methSet;
19748 /* 19779 /*
19749 * SPEC (2) "It is validly substitutable for HEAD subject to HEAD's 19780 * SPEC (2) "It is validly substitutable for HEAD subject to HEAD's
19750 * {disallowed substitutions} as the blocking constraint, as defined in 19781 * {disallowed substitutions} as the blocking constraint, as defined in
19751 » * Substitution Group OK (Transitive) (�3.3.6)." 19782 » * Substitution Group OK (Transitive) ($3.3.6)."
19752 */ 19783 */
19753 for (head = WXS_SUBST_HEAD(elemDecl); head != NULL; 19784 for (head = WXS_SUBST_HEAD(elemDecl); head != NULL;
19754 head = WXS_SUBST_HEAD(head)) { 19785 head = WXS_SUBST_HEAD(head)) {
19755 set = 0; 19786 set = 0;
19756 methSet = 0; 19787 methSet = 0;
19757 /* 19788 /*
19758 * The blocking constraints. 19789 * The blocking constraints.
19759 */ 19790 */
19760 if (head->flags & XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION) 19791 if (head->flags & XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION)
19761 continue; 19792 continue;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
19874 ctxtComponent, ctxtParticle, cur, ctxtParticle, 1); 19905 ctxtComponent, ctxtParticle, cur, ctxtParticle, 1);
19875 if (ret != 0) 19906 if (ret != 0)
19876 return(ret); 19907 return(ret);
19877 } else { 19908 } else {
19878 xmlSchemaElementPtr elem = 19909 xmlSchemaElementPtr elem =
19879 WXS_ELEM_CAST(WXS_PARTICLE_TERM(cur)); 19910 WXS_ELEM_CAST(WXS_PARTICLE_TERM(cur));
19880 /* 19911 /*
19881 * SPEC Element Declarations Consistent: 19912 * SPEC Element Declarations Consistent:
19882 * "If the {particles} contains, either directly, 19913 * "If the {particles} contains, either directly,
19883 * indirectly (that is, within the {particles} of a 19914 * indirectly (that is, within the {particles} of a
19884 » » * contained model group, recursively) or �implicitly� 19915 » » * contained model group, recursively) or `implicitly`
19885 * two or more element declaration particles with 19916 * two or more element declaration particles with
19886 * the same {name} and {target namespace}, then 19917 * the same {name} and {target namespace}, then
19887 * all their type definitions must be the same 19918 * all their type definitions must be the same
19888 * top-level definition [...]" 19919 * top-level definition [...]"
19889 */ 19920 */
19890 if (xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->name, 19921 if (xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->name,
19891 WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->name) && 19922 WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->name) &&
19892 xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->targetNamesp ace, 19923 xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->targetNamesp ace,
19893 WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->targetNam espace)) 19924 WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->targetNam espace))
19894 { 19925 {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
20072 xmlSchemaTypePtr tx, ty, ptx, pty; 20103 xmlSchemaTypePtr tx, ty, ptx, pty;
20073 int ret; 20104 int ret;
20074 20105
20075 while (x != NULL) { 20106 while (x != NULL) {
20076 /* Same types. */ 20107 /* Same types. */
20077 tx = xmlSchemaGetBuiltInType(xmlSchemaGetValType(x)); 20108 tx = xmlSchemaGetBuiltInType(xmlSchemaGetValType(x));
20078 ty = xmlSchemaGetBuiltInType(xmlSchemaGetValType(y)); 20109 ty = xmlSchemaGetBuiltInType(xmlSchemaGetValType(y));
20079 ptx = xmlSchemaGetPrimitiveType(tx); 20110 ptx = xmlSchemaGetPrimitiveType(tx);
20080 pty = xmlSchemaGetPrimitiveType(ty); 20111 pty = xmlSchemaGetPrimitiveType(ty);
20081 /* 20112 /*
20082 » * (1) if a datatype T' is �derived� by �restriction� from an 20113 » * (1) if a datatype T' is `derived` by `restriction` from an
20083 » * atomic datatype T then the �value space� of T' is a subset of 20114 » * atomic datatype T then the `value space` of T' is a subset of
20084 » * the �value space� of T. */ 20115 » * the `value space` of T. */
20085 /* 20116 /*
20086 » * (2) if datatypes T' and T'' are �derived� by �restriction� 20117 » * (2) if datatypes T' and T'' are `derived` by `restriction`
20087 » * from a common atomic ancestor T then the �value space�s of T' 20118 » * from a common atomic ancestor T then the `value space`s of T'
20088 * and T'' may overlap. 20119 * and T'' may overlap.
20089 */ 20120 */
20090 if (ptx != pty) 20121 if (ptx != pty)
20091 return(0); 20122 return(0);
20092 /* 20123 /*
20093 * We assume computed values to be normalized, so do a fast 20124 * We assume computed values to be normalized, so do a fast
20094 * string comparison for string based types. 20125 * string comparison for string based types.
20095 */ 20126 */
20096 if ((ptx->builtInType == XML_SCHEMAS_STRING) || 20127 if ((ptx->builtInType == XML_SCHEMAS_STRING) ||
20097 WXS_IS_ANY_SIMPLE_TYPE(ptx)) { 20128 WXS_IS_ANY_SIMPLE_TYPE(ptx)) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
20145 xmlSchemaQNameRefPtr ref = WXS_QNAME_CAST ause->attrDecl; 20176 xmlSchemaQNameRefPtr ref = WXS_QNAME_CAST ause->attrDecl;
20146 20177
20147 /* 20178 /*
20148 * TODO: Evaluate, what errors could occur if the declaration is not 20179 * TODO: Evaluate, what errors could occur if the declaration is not
20149 * found. 20180 * found.
20150 */ 20181 */
20151 ause->attrDecl = xmlSchemaGetAttributeDecl(ctxt->schema, 20182 ause->attrDecl = xmlSchemaGetAttributeDecl(ctxt->schema,
20152 ref->name, ref->targetNamespace); 20183 ref->name, ref->targetNamespace);
20153 if (ause->attrDecl == NULL) { 20184 if (ause->attrDecl == NULL) {
20154 xmlSchemaPResCompAttrErr(ctxt, 20185 xmlSchemaPResCompAttrErr(ctxt,
20155 » » XML_SCHEMAP_SRC_RESOLVE, 20186 » » XML_SCHEMAP_SRC_RESOLVE,
20156 WXS_BASIC_CAST ause, ause->node, 20187 WXS_BASIC_CAST ause, ause->node,
20157 "ref", ref->name, ref->targetNamespace, 20188 "ref", ref->name, ref->targetNamespace,
20158 XML_SCHEMA_TYPE_ATTRIBUTE, NULL); 20189 XML_SCHEMA_TYPE_ATTRIBUTE, NULL);
20159 return(ctxt->err);; 20190 return(ctxt->err);;
20160 } 20191 }
20161 } 20192 }
20162 return(0); 20193 return(0);
20163 } 20194 }
20164 20195
20165 /** 20196 /**
(...skipping 12 matching lines...) Expand all
20178 if ((ctxt == NULL) || (use == NULL)) 20209 if ((ctxt == NULL) || (use == NULL))
20179 return(-1); 20210 return(-1);
20180 if ((use->defValue == NULL) || (WXS_ATTRUSE_DECL(use) == NULL) || 20211 if ((use->defValue == NULL) || (WXS_ATTRUSE_DECL(use) == NULL) ||
20181 ((WXS_ATTRUSE_DECL(use))->type != XML_SCHEMA_TYPE_ATTRIBUTE)) 20212 ((WXS_ATTRUSE_DECL(use))->type != XML_SCHEMA_TYPE_ATTRIBUTE))
20182 return(0); 20213 return(0);
20183 20214
20184 /* 20215 /*
20185 * SPEC au-props-correct (1) 20216 * SPEC au-props-correct (1)
20186 * "The values of the properties of an attribute use must be as 20217 * "The values of the properties of an attribute use must be as
20187 * described in the property tableau in The Attribute Use Schema 20218 * described in the property tableau in The Attribute Use Schema
20188 * Component (�3.5.1), modulo the impact of Missing 20219 * Component ($3.5.1), modulo the impact of Missing
20189 * Sub-components (�5.3)." 20220 * Sub-components ($5.3)."
20190 */ 20221 */
20191 20222
20192 if (((WXS_ATTRUSE_DECL(use))->defValue != NULL) && 20223 if (((WXS_ATTRUSE_DECL(use))->defValue != NULL) &&
20193 ((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMAS_ATTR_FIXED) && 20224 ((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMAS_ATTR_FIXED) &&
20194 ((use->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0)) 20225 ((use->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0))
20195 { 20226 {
20196 xmlSchemaPCustomErr(ctxt, 20227 xmlSchemaPCustomErr(ctxt,
20197 XML_SCHEMAP_AU_PROPS_CORRECT_2, 20228 XML_SCHEMAP_AU_PROPS_CORRECT_2,
20198 WXS_BASIC_CAST use, NULL, 20229 WXS_BASIC_CAST use, NULL,
20199 "The attribute declaration has a 'fixed' value constraint " 20230 "The attribute declaration has a 'fixed' value constraint "
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
20280 * 20311 *
20281 * Resolves the referenced type definition component. 20312 * Resolves the referenced type definition component.
20282 */ 20313 */
20283 static int 20314 static int
20284 xmlSchemaResolveAttrTypeReferences(xmlSchemaAttributePtr item, 20315 xmlSchemaResolveAttrTypeReferences(xmlSchemaAttributePtr item,
20285 xmlSchemaParserCtxtPtr ctxt) 20316 xmlSchemaParserCtxtPtr ctxt)
20286 { 20317 {
20287 /* 20318 /*
20288 * The simple type definition corresponding to the <simpleType> element 20319 * The simple type definition corresponding to the <simpleType> element
20289 * information item in the [children], if present, otherwise the simple 20320 * information item in the [children], if present, otherwise the simple
20290 * type definition �resolved� to by the �actual value� of the type 20321 * type definition `resolved` to by the `actual value` of the type
20291 * [attribute], if present, otherwise the �simple ur-type definition�. 20322 * [attribute], if present, otherwise the `simple ur-type definition`.
20292 */ 20323 */
20293 if (item->flags & XML_SCHEMAS_ATTR_INTERNAL_RESOLVED) 20324 if (item->flags & XML_SCHEMAS_ATTR_INTERNAL_RESOLVED)
20294 return(0); 20325 return(0);
20295 item->flags |= XML_SCHEMAS_ATTR_INTERNAL_RESOLVED; 20326 item->flags |= XML_SCHEMAS_ATTR_INTERNAL_RESOLVED;
20296 if (item->subtypes != NULL) 20327 if (item->subtypes != NULL)
20297 return(0); 20328 return(0);
20298 if (item->typeName != NULL) { 20329 if (item->typeName != NULL) {
20299 xmlSchemaTypePtr type; 20330 xmlSchemaTypePtr type;
20300 20331
20301 type = xmlSchemaGetType(ctxt->schema, item->typeName, 20332 type = xmlSchemaGetType(ctxt->schema, item->typeName,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
20445 */ 20476 */
20446 prev = xmlSchemaFindRedefCompInGraph( 20477 prev = xmlSchemaFindRedefCompInGraph(
20447 redef->targetBucket, item->type, 20478 redef->targetBucket, item->type,
20448 redef->refName, redef->refTargetNs); 20479 redef->refName, redef->refTargetNs);
20449 if (prev == NULL) { 20480 if (prev == NULL) {
20450 xmlChar *str = NULL; 20481 xmlChar *str = NULL;
20451 xmlNodePtr node; 20482 xmlNodePtr node;
20452 20483
20453 /* 20484 /*
20454 * SPEC src-redefine: 20485 * SPEC src-redefine:
20455 » * (6.2.1) "The �actual value� of its own name attribute plus 20486 » * (6.2.1) "The `actual value` of its own name attribute plus
20456 » * target namespace must successfully �resolve� to a model 20487 » * target namespace must successfully `resolve` to a model
20457 * group definition in I." 20488 * group definition in I."
20458 » * (7.2.1) "The �actual value� of its own name attribute plus 20489 » * (7.2.1) "The `actual value` of its own name attribute plus
20459 » * target namespace must successfully �resolve� to an attribute 20490 » * target namespace must successfully `resolve` to an attribute
20460 * group definition in I." 20491 * group definition in I."
20461 20492
20462 * 20493 *
20463 * Note that, if we are redefining with the use of references 20494 * Note that, if we are redefining with the use of references
20464 * to components, the spec assumes the src-resolve to be used; 20495 * to components, the spec assumes the src-resolve to be used;
20465 * but this won't assure that we search only *inside* the 20496 * but this won't assure that we search only *inside* the
20466 * redefined schema. 20497 * redefined schema.
20467 */ 20498 */
20468 if (redef->reference) 20499 if (redef->reference)
20469 node = WXS_ITEM_NODE(redef->reference); 20500 node = WXS_ITEM_NODE(redef->reference);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
20622 * TODO: Seems like there's nothing more to do. The normal 20653 * TODO: Seems like there's nothing more to do. The normal
20623 * inheritance mechanism is used. But not 100% sure. 20654 * inheritance mechanism is used. But not 100% sure.
20624 */ 20655 */
20625 break; 20656 break;
20626 case XML_SCHEMA_TYPE_GROUP: 20657 case XML_SCHEMA_TYPE_GROUP:
20627 /* 20658 /*
20628 * URGENT TODO: 20659 * URGENT TODO:
20629 * SPEC src-redefine: 20660 * SPEC src-redefine:
20630 * (6.2.2) "The {model group} of the model group definition 20661 * (6.2.2) "The {model group} of the model group definition
20631 * which corresponds to it per XML Representation of Model 20662 * which corresponds to it per XML Representation of Model
20632 » » * Group Definition Schema Components (�3.7.2) must be a 20663 » » * Group Definition Schema Components ($3.7.2) must be a
20633 » » * �valid restriction� of the {model group} of that model 20664 » » * `valid restriction` of the {model group} of that model
20634 * group definition in I, as defined in Particle Valid 20665 * group definition in I, as defined in Particle Valid
20635 » » * (Restriction) (�3.9.6)." 20666 » » * (Restriction) ($3.9.6)."
20636 */ 20667 */
20637 break; 20668 break;
20638 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: 20669 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
20639 /* 20670 /*
20640 * SPEC src-redefine: 20671 * SPEC src-redefine:
20641 * (7.2.2) "The {attribute uses} and {attribute wildcard} of 20672 * (7.2.2) "The {attribute uses} and {attribute wildcard} of
20642 * the attribute group definition which corresponds to it 20673 * the attribute group definition which corresponds to it
20643 * per XML Representation of Attribute Group Definition Schema 20674 * per XML Representation of Attribute Group Definition Schema
20644 » » * Components (�3.6.2) must be �valid restrictions� of the 20675 » » * Components ($3.6.2) must be `valid restrictions` of the
20645 * {attribute uses} and {attribute wildcard} of that attribute 20676 * {attribute uses} and {attribute wildcard} of that attribute
20646 * group definition in I, as defined in clause 2, clause 3 and 20677 * group definition in I, as defined in clause 2, clause 3 and
20647 * clause 4 of Derivation Valid (Restriction, Complex) 20678 * clause 4 of Derivation Valid (Restriction, Complex)
20648 » » * (�3.4.6) (where references to the base type definition are 20679 » » * ($3.4.6) (where references to the base type definition are
20649 * understood as references to the attribute group definition 20680 * understood as references to the attribute group definition
20650 * in I)." 20681 * in I)."
20651 */ 20682 */
20652 err = xmlSchemaCheckDerivationOKRestriction2to4(pctxt, 20683 err = xmlSchemaCheckDerivationOKRestriction2to4(pctxt,
20653 XML_SCHEMA_ACTION_REDEFINE, 20684 XML_SCHEMA_ACTION_REDEFINE,
20654 item, redef->target, 20685 item, redef->target,
20655 (WXS_ATTR_GROUP_CAST item)->attrUses, 20686 (WXS_ATTR_GROUP_CAST item)->attrUses,
20656 (WXS_ATTR_GROUP_CAST redef->target)->attrUses, 20687 (WXS_ATTR_GROUP_CAST redef->target)->attrUses,
20657 (WXS_ATTR_GROUP_CAST item)->attributeWildcard, 20688 (WXS_ATTR_GROUP_CAST item)->attributeWildcard,
20658 (WXS_ATTR_GROUP_CAST redef->target)->attributeWildcard); 20689 (WXS_ATTR_GROUP_CAST redef->target)->attributeWildcard);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
20813 if (con->bucket == NULL) 20844 if (con->bucket == NULL)
20814 con->bucket = rootBucket; 20845 con->bucket = rootBucket;
20815 20846
20816 /* TODO: 20847 /* TODO:
20817 * SPEC (src-redefine): 20848 * SPEC (src-redefine):
20818 * (6.2) "If it has no such self-reference, then all of the 20849 * (6.2) "If it has no such self-reference, then all of the
20819 * following must be true:" 20850 * following must be true:"
20820 20851
20821 * (6.2.2) The {model group} of the model group definition which 20852 * (6.2.2) The {model group} of the model group definition which
20822 * corresponds to it per XML Representation of Model Group 20853 * corresponds to it per XML Representation of Model Group
20823 * Definition Schema Components (�3.7.2) must be a �valid 20854 * Definition Schema Components ($3.7.2) must be a `valid
20824 * restriction� of the {model group} of that model group definition 20855 * restriction` of the {model group} of that model group definition
20825 * in I, as defined in Particle Valid (Restriction) (�3.9.6)." 20856 * in I, as defined in Particle Valid (Restriction) ($3.9.6)."
20826 */ 20857 */
20827 xmlSchemaCheckSRCRedefineFirst(pctxt); 20858 xmlSchemaCheckSRCRedefineFirst(pctxt);
20828 20859
20829 /* 20860 /*
20830 * Add global components to the schemata's hash tables. 20861 * Add global components to the schemata's hash tables.
20831 */ 20862 */
20832 xmlSchemaAddComponents(pctxt, rootBucket); 20863 xmlSchemaAddComponents(pctxt, rootBucket);
20833 20864
20834 pctxt->ctxtType = NULL; 20865 pctxt->ctxtType = NULL;
20835 items = (xmlSchemaTreeItemPtr *) con->pending->items; 20866 items = (xmlSchemaTreeItemPtr *) con->pending->items;
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
21499 /* 21530 /*
21500 * Note that we assume a whitespace of preserve for anySimpleType. 21531 * Note that we assume a whitespace of preserve for anySimpleType.
21501 */ 21532 */
21502 if ((type->builtInType == XML_SCHEMAS_STRING) || 21533 if ((type->builtInType == XML_SCHEMAS_STRING) ||
21503 (type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) 21534 (type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE))
21504 return(XML_SCHEMA_WHITESPACE_PRESERVE); 21535 return(XML_SCHEMA_WHITESPACE_PRESERVE);
21505 else if (type->builtInType == XML_SCHEMAS_NORMSTRING) 21536 else if (type->builtInType == XML_SCHEMAS_NORMSTRING)
21506 return(XML_SCHEMA_WHITESPACE_REPLACE); 21537 return(XML_SCHEMA_WHITESPACE_REPLACE);
21507 else { 21538 else {
21508 /* 21539 /*
21509 » * For all �atomic� datatypes other than string (and types �derived� 21540 » * For all `atomic` datatypes other than string (and types `derived`
21510 » * by �restriction� from it) the value of whiteSpace is fixed to 21541 » * by `restriction` from it) the value of whiteSpace is fixed to
21511 * collapse 21542 * collapse
21512 * Note that this includes built-in list datatypes. 21543 * Note that this includes built-in list datatypes.
21513 */ 21544 */
21514 return(XML_SCHEMA_WHITESPACE_COLLAPSE); 21545 return(XML_SCHEMA_WHITESPACE_COLLAPSE);
21515 } 21546 }
21516 } else if (WXS_IS_LIST(type)) { 21547 } else if (WXS_IS_LIST(type)) {
21517 /* 21548 /*
21518 * For list types the facet "whiteSpace" is fixed to "collapse". 21549 * For list types the facet "whiteSpace" is fixed to "collapse".
21519 */ 21550 */
21520 return (XML_SCHEMA_WHITESPACE_COLLAPSE); 21551 return (XML_SCHEMA_WHITESPACE_COLLAPSE);
21521 } else if (WXS_IS_UNION(type)) { 21552 } else if (WXS_IS_UNION(type)) {
21522 return (XML_SCHEMA_WHITESPACE_UNKNOWN); 21553 return (XML_SCHEMA_WHITESPACE_UNKNOWN);
21523 } else if (WXS_IS_ATOMIC(type)) { 21554 } else if (WXS_IS_ATOMIC(type)) {
21524 if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE) 21555 if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE)
21525 return (XML_SCHEMA_WHITESPACE_PRESERVE); 21556 return (XML_SCHEMA_WHITESPACE_PRESERVE);
21526 else if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_REPLACE) 21557 else if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_REPLACE)
21527 return (XML_SCHEMA_WHITESPACE_REPLACE); 21558 return (XML_SCHEMA_WHITESPACE_REPLACE);
21528 else 21559 else
21529 return (XML_SCHEMA_WHITESPACE_COLLAPSE); 21560 return (XML_SCHEMA_WHITESPACE_COLLAPSE);
21530 } 21561 }
21531 return (-1); 21562 return (-1);
21532 } 21563 }
21533 21564
21534 /************************************************************************ 21565 /************************************************************************
21535 * » » » » » » » » » * 21566 *» » » » » » » » » *
21536 * » » » Simple type validation» » » » * 21567 *» » » Simple type validation» » » » *
21537 * » » » » » » » » » * 21568 *» » » » » » » » » *
21538 ************************************************************************/ 21569 ************************************************************************/
21539 21570
21540 21571
21541 /************************************************************************ 21572 /************************************************************************
21542 * » » » » » » » » » * 21573 *» » » » » » » » » *
21543 * » » » DOM Validation code» » » » * 21574 *» » » DOM Validation code» » » » *
21544 * » » » » » » » » » * 21575 *» » » » » » » » » *
21545 ************************************************************************/ 21576 ************************************************************************/
21546 21577
21547 /** 21578 /**
21548 * xmlSchemaAssembleByLocation: 21579 * xmlSchemaAssembleByLocation:
21549 * @pctxt: a schema parser context 21580 * @pctxt: a schema parser context
21550 * @vctxt: a schema validation context 21581 * @vctxt: a schema validation context
21551 * @schema: the existing schema 21582 * @schema: the existing schema
21552 * @node: the node that fired the assembling 21583 * @node: the node that fired the assembling
21553 * @nsName: the namespace name of the new schema 21584 * @nsName: the namespace name of the new schema
21554 * @location: the location of the schema 21585 * @location: the location of the schema
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
21928 return(i); 21959 return(i);
21929 } 21960 }
21930 /* Add new entry. */ 21961 /* Add new entry. */
21931 i = vctxt->nodeQNames->nbItems; 21962 i = vctxt->nodeQNames->nbItems;
21932 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) lname); 21963 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) lname);
21933 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) nsname); 21964 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) nsname);
21934 return(i); 21965 return(i);
21935 } 21966 }
21936 21967
21937 /************************************************************************ 21968 /************************************************************************
21938 * » » » » » » » » » * 21969 *» » » » » » » » » *
21939 * Validation of identity-constraints (IDC) * 21970 * Validation of identity-constraints (IDC) *
21940 * » » » » » » » » » * 21971 *» » » » » » » » » *
21941 ************************************************************************/ 21972 ************************************************************************/
21942 21973
21943 /** 21974 /**
21944 * xmlSchemaAugmentIDC: 21975 * xmlSchemaAugmentIDC:
21945 * @idcDef: the IDC definition 21976 * @idcDef: the IDC definition
21946 * 21977 *
21947 * Creates an augmented IDC definition item. 21978 * Creates an augmented IDC definition item.
21948 * 21979 *
21949 * Returns the item, or NULL on internal errors. 21980 * Returns the item, or NULL on internal errors.
21950 */ 21981 */
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
22805 /* 22836 /*
22806 * Get/create the key-sequence. 22837 * Get/create the key-sequence.
22807 */ 22838 */
22808 keySeq = matcher->keySeqs[pos]; 22839 keySeq = matcher->keySeqs[pos];
22809 if (keySeq == NULL) { 22840 if (keySeq == NULL) {
22810 goto create_sequence; 22841 goto create_sequence;
22811 } else if (keySeq[idx] != NULL) { 22842 } else if (keySeq[idx] != NULL) {
22812 xmlChar *str = NULL; 22843 xmlChar *str = NULL;
22813 /* 22844 /*
22814 * cvc-identity-constraint: 22845 * cvc-identity-constraint:
22815 » » * 3 For each node in the �target node set� all 22846 » » * 3 For each node in the `target node set` all
22816 * of the {fields}, with that node as the context 22847 * of the {fields}, with that node as the context
22817 * node, evaluate to either an empty node-set or 22848 * node, evaluate to either an empty node-set or
22818 * a node-set with exactly one member, which must 22849 * a node-set with exactly one member, which must
22819 * have a simple type. 22850 * have a simple type.
22820 * 22851 *
22821 * The key was already set; report an error. 22852 * The key was already set; report an error.
22822 */ 22853 */
22823 xmlSchemaCustomErr(ACTXT_CAST vctxt, 22854 xmlSchemaCustomErr(ACTXT_CAST vctxt,
22824 XML_SCHEMAV_CVC_IDC, NULL, 22855 XML_SCHEMAV_CVC_IDC, NULL,
22825 WXS_BASIC_CAST matcher->aidc->def, 22856 WXS_BASIC_CAST matcher->aidc->def,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
22935 } 22966 }
22936 goto selector_leave; 22967 goto selector_leave;
22937 } 22968 }
22938 } 22969 }
22939 /* 22970 /*
22940 * All fields did resolve. 22971 * All fields did resolve.
22941 */ 22972 */
22942 22973
22943 /* 22974 /*
22944 * 4.1 If the {identity-constraint category} is unique(/key), 22975 * 4.1 If the {identity-constraint category} is unique(/key),
22945 » * then no two members of the �qualified node set� have 22976 » * then no two members of the `qualified node set` have
22946 » * �key-sequences� whose members are pairwise equal, as 22977 » * `key-sequences` whose members are pairwise equal, as
22947 * defined by Equal in [XML Schemas: Datatypes]. 22978 * defined by Equal in [XML Schemas: Datatypes].
22948 * 22979 *
22949 * Get the IDC binding from the matcher and check for 22980 * Get the IDC binding from the matcher and check for
22950 * duplicate key-sequences. 22981 * duplicate key-sequences.
22951 */ 22982 */
22952 #if 0 22983 #if 0
22953 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher); 22984 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
22954 #endif 22985 #endif
22955 targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher); 22986 targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher);
22956 if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) && 22987 if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) &&
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
23064 xmlFree(ntItem); 23095 xmlFree(ntItem);
23065 } 23096 }
23066 return (-1); 23097 return (-1);
23067 } 23098 }
23068 23099
23069 goto selector_leave; 23100 goto selector_leave;
23070 selector_key_error: 23101 selector_key_error:
23071 { 23102 {
23072 xmlChar *str = NULL; 23103 xmlChar *str = NULL;
23073 /* 23104 /*
23074 » » * 4.2.1 (KEY) The �target node set� and the 23105 » » * 4.2.1 (KEY) The `target node set` and the
23075 » » * �qualified node set� are equal, that is, every 23106 » » * `qualified node set` are equal, that is, every
23076 » » * member of the �target node set� is also a member 23107 » » * member of the `target node set` is also a member
23077 » » * of the �qualified node set� and vice versa. 23108 » » * of the `qualified node set` and vice versa.
23078 */ 23109 */
23079 xmlSchemaCustomErr(ACTXT_CAST vctxt, 23110 xmlSchemaCustomErr(ACTXT_CAST vctxt,
23080 XML_SCHEMAV_CVC_IDC, NULL, 23111 XML_SCHEMAV_CVC_IDC, NULL,
23081 WXS_BASIC_CAST idc, 23112 WXS_BASIC_CAST idc,
23082 "Not all fields of %s evaluate to a node", 23113 "Not all fields of %s evaluate to a node",
23083 xmlSchemaGetIDCDesignation(&str, idc), NULL); 23114 xmlSchemaGetIDCDesignation(&str, idc), NULL);
23084 FREE_AND_NULL(str); 23115 FREE_AND_NULL(str);
23085 } 23116 }
23086 selector_leave: 23117 selector_leave:
23087 /* 23118 /*
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
23858 } 23889 }
23859 } 23890 }
23860 } 23891 }
23861 matcher = matcher->next; 23892 matcher = matcher->next;
23862 } 23893 }
23863 /* TODO: Return an error if any error encountered. */ 23894 /* TODO: Return an error if any error encountered. */
23864 return (0); 23895 return (0);
23865 } 23896 }
23866 23897
23867 /************************************************************************ 23898 /************************************************************************
23868 * » » » » » » » » » * 23899 *» » » » » » » » » *
23869 * » » » XML Reader validation code * 23900 *» » » XML Reader validation code *
23870 * » » » » » » » » » * 23901 *» » » » » » » » » *
23871 ************************************************************************/ 23902 ************************************************************************/
23872 23903
23873 static xmlSchemaAttrInfoPtr 23904 static xmlSchemaAttrInfoPtr
23874 xmlSchemaGetFreshAttrInfo(xmlSchemaValidCtxtPtr vctxt) 23905 xmlSchemaGetFreshAttrInfo(xmlSchemaValidCtxtPtr vctxt)
23875 { 23906 {
23876 xmlSchemaAttrInfoPtr iattr; 23907 xmlSchemaAttrInfoPtr iattr;
23877 /* 23908 /*
23878 * Grow/create list of attribute infos. 23909 * Grow/create list of attribute infos.
23879 */ 23910 */
23880 if (vctxt->attrInfos == NULL) { 23911 if (vctxt->attrInfos == NULL) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
24463 /* 24494 /*
24464 * 3.14.4 Simple Type Definition Validation Rules 24495 * 3.14.4 Simple Type Definition Validation Rules
24465 * Validation Rule: String Valid 24496 * Validation Rule: String Valid
24466 */ 24497 */
24467 /* 24498 /*
24468 * 1 It is schema-valid with respect to that definition as defined 24499 * 1 It is schema-valid with respect to that definition as defined
24469 * by Datatype Valid in [XML Schemas: Datatypes]. 24500 * by Datatype Valid in [XML Schemas: Datatypes].
24470 */ 24501 */
24471 /* 24502 /*
24472 * 2.1 If The definition is ENTITY or is validly derived from ENTITY given 24503 * 2.1 If The definition is ENTITY or is validly derived from ENTITY given
24473 * the empty set, as defined in Type Derivation OK (Simple) (�3.14.6), then 24504 * the empty set, as defined in Type Derivation OK (Simple) ($3.14.6), then
24474 * the string must be a �declared entity name�. 24505 * the string must be a `declared entity name`.
24475 */ 24506 */
24476 /* 24507 /*
24477 * 2.2 If The definition is ENTITIES or is validly derived from ENTITIES 24508 * 2.2 If The definition is ENTITIES or is validly derived from ENTITIES
24478 * given the empty set, as defined in Type Derivation OK (Simple) (�3.14.6), 24509 * given the empty set, as defined in Type Derivation OK (Simple) ($3.14.6),
24479 * then every whitespace-delimited substring of the string must be a �declare d 24510 * then every whitespace-delimited substring of the string must be a `declare d
24480 * entity name�. 24511 * entity name`.
24481 */ 24512 */
24482 /* 24513 /*
24483 * 2.3 otherwise no further condition applies. 24514 * 2.3 otherwise no further condition applies.
24484 */ 24515 */
24485 if ((! valNeeded) && (type->flags & XML_SCHEMAS_TYPE_FACETSNEEDVALUE)) 24516 if ((! valNeeded) && (type->flags & XML_SCHEMAS_TYPE_FACETSNEEDVALUE))
24486 valNeeded = 1; 24517 valNeeded = 1;
24487 if (value == NULL) 24518 if (value == NULL)
24488 value = BAD_CAST ""; 24519 value = BAD_CAST "";
24489 if (WXS_IS_ANY_SIMPLE_TYPE(type) || WXS_IS_ATOMIC(type)) { 24520 if (WXS_IS_ANY_SIMPLE_TYPE(type) || WXS_IS_ATOMIC(type)) {
24490 xmlSchemaTypePtr biType; /* The built-in type. */ 24521 xmlSchemaTypePtr biType; /* The built-in type. */
24491 /* 24522 /*
24492 » * SPEC (1.2.1) "if {variety} is �atomic� then the string must �match� 24523 » * SPEC (1.2.1) "if {variety} is `atomic` then the string must `match`
24493 » * a literal in the �lexical space� of {base type definition}" 24524 » * a literal in the `lexical space` of {base type definition}"
24494 */ 24525 */
24495 /* 24526 /*
24496 * Whitespace-normalize. 24527 * Whitespace-normalize.
24497 */ 24528 */
24498 NORMALIZE(type); 24529 NORMALIZE(type);
24499 if (type->type != XML_SCHEMA_TYPE_BASIC) { 24530 if (type->type != XML_SCHEMA_TYPE_BASIC) {
24500 /* 24531 /*
24501 * Get the built-in type. 24532 * Get the built-in type.
24502 */ 24533 */
24503 biType = type->baseType; 24534 biType = type->baseType;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
24594 } 24625 }
24595 if (fireErrors && (ret > 0)) 24626 if (fireErrors && (ret > 0))
24596 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1); 24627 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1);
24597 } else if (WXS_IS_LIST(type)) { 24628 } else if (WXS_IS_LIST(type)) {
24598 24629
24599 xmlSchemaTypePtr itemType; 24630 xmlSchemaTypePtr itemType;
24600 const xmlChar *cur, *end; 24631 const xmlChar *cur, *end;
24601 xmlChar *tmpValue = NULL; 24632 xmlChar *tmpValue = NULL;
24602 unsigned long len = 0; 24633 unsigned long len = 0;
24603 xmlSchemaValPtr prevVal = NULL, curVal = NULL; 24634 xmlSchemaValPtr prevVal = NULL, curVal = NULL;
24604 » /* 1.2.2 if {variety} is �list� then the string must be a sequence 24635 » /* 1.2.2 if {variety} is `list` then the string must be a sequence
24605 » * of white space separated tokens, each of which �match�es a literal 24636 » * of white space separated tokens, each of which `match`es a literal
24606 » * in the �lexical space� of {item type definition} 24637 » * in the `lexical space` of {item type definition}
24607 */ 24638 */
24608 /* 24639 /*
24609 * Note that XML_SCHEMAS_TYPE_NORMVALUENEEDED will be set if 24640 * Note that XML_SCHEMAS_TYPE_NORMVALUENEEDED will be set if
24610 * the list type has an enum or pattern facet. 24641 * the list type has an enum or pattern facet.
24611 */ 24642 */
24612 NORMALIZE(type); 24643 NORMALIZE(type);
24613 /* 24644 /*
24614 * VAL TODO: Optimize validation of empty values. 24645 * VAL TODO: Optimize validation of empty values.
24615 * VAL TODO: We do not have computed values for lists. 24646 * VAL TODO: We do not have computed values for lists.
24616 */ 24647 */
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
24677 /* 24708 /*
24678 * Report the normalized value. 24709 * Report the normalized value.
24679 */ 24710 */
24680 normalize = 1; 24711 normalize = 1;
24681 NORMALIZE(type); 24712 NORMALIZE(type);
24682 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1); 24713 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1);
24683 } 24714 }
24684 } else if (WXS_IS_UNION(type)) { 24715 } else if (WXS_IS_UNION(type)) {
24685 xmlSchemaTypeLinkPtr memberLink; 24716 xmlSchemaTypeLinkPtr memberLink;
24686 /* 24717 /*
24687 » * TODO: For all datatypes �derived� by �union� whiteSpace does 24718 » * TODO: For all datatypes `derived` by `union` whiteSpace does
24688 » * not apply directly; however, the normalization behavior of �union� 24719 » * not apply directly; however, the normalization behavior of `union`
24689 * types is controlled by the value of whiteSpace on that one of the 24720 * types is controlled by the value of whiteSpace on that one of the
24690 » * �memberTypes� against which the �union� is successfully validated. 24721 » * `memberTypes` against which the `union` is successfully validated.
24691 * 24722 *
24692 * This means that the value is normalized by the first validating 24723 * This means that the value is normalized by the first validating
24693 * member type, then the facets of the union type are applied. This 24724 * member type, then the facets of the union type are applied. This
24694 * needs changing of the value! 24725 * needs changing of the value!
24695 */ 24726 */
24696 24727
24697 /* 24728 /*
24698 » * 1.2.3 if {variety} is �union� then the string must �match� a 24729 » * 1.2.3 if {variety} is `union` then the string must `match` a
24699 » * literal in the �lexical space� of at least one member of 24730 » * literal in the `lexical space` of at least one member of
24700 * {member type definitions} 24731 * {member type definitions}
24701 */ 24732 */
24702 memberLink = xmlSchemaGetUnionSimpleTypeMemberTypes(type); 24733 memberLink = xmlSchemaGetUnionSimpleTypeMemberTypes(type);
24703 if (memberLink == NULL) { 24734 if (memberLink == NULL) {
24704 AERROR_INT("xmlSchemaVCheckCVCSimpleType", 24735 AERROR_INT("xmlSchemaVCheckCVCSimpleType",
24705 "union simple type has no member types"); 24736 "union simple type has no member types");
24706 goto internal_error; 24737 goto internal_error;
24707 } 24738 }
24708 /* 24739 /*
24709 * Always normalize union type values, since we currently 24740 * Always normalize union type values, since we currently
(...skipping 18 matching lines...) Expand all
24728 "validating members of union simple type"); 24759 "validating members of union simple type");
24729 goto internal_error; 24760 goto internal_error;
24730 } 24761 }
24731 ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3; 24762 ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3;
24732 } 24763 }
24733 /* 24764 /*
24734 * Apply facets (pattern, enumeration). 24765 * Apply facets (pattern, enumeration).
24735 */ 24766 */
24736 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { 24767 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) {
24737 /* 24768 /*
24738 » * The normalization behavior of �union� types is controlled by 24769 » * The normalization behavior of `union` types is controlled by
24739 » * the value of whiteSpace on that one of the �memberTypes� 24770 » * the value of whiteSpace on that one of the `memberTypes`
24740 » * against which the �union� is successfully validated. 24771 » * against which the `union` is successfully validated.
24741 */ 24772 */
24742 NORMALIZE(memberLink->type); 24773 NORMALIZE(memberLink->type);
24743 ret = xmlSchemaValidateFacets(actxt, node, type, 24774 ret = xmlSchemaValidateFacets(actxt, node, type,
24744 XML_SCHEMAS_UNKNOWN, value, val, 24775 XML_SCHEMAS_UNKNOWN, value, val,
24745 0, fireErrors); 24776 0, fireErrors);
24746 if (ret != 0) { 24777 if (ret != 0) {
24747 if (ret < 0) { 24778 if (ret < 0) {
24748 AERROR_INT("xmlSchemaVCheckCVCSimpleType", 24779 AERROR_INT("xmlSchemaVCheckCVCSimpleType",
24749 "validating facets of union simple type"); 24780 "validating facets of union simple type");
24750 goto internal_error; 24781 goto internal_error;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
24890 xmlSchemaFormatQName(&str, nsName, local), NULL); 24921 xmlSchemaFormatQName(&str, nsName, local), NULL);
24891 FREE_AND_NULL(str); 24922 FREE_AND_NULL(str);
24892 ret = vctxt->err; 24923 ret = vctxt->err;
24893 goto exit; 24924 goto exit;
24894 } 24925 }
24895 if (elemDecl != NULL) { 24926 if (elemDecl != NULL) {
24896 int set = 0; 24927 int set = 0;
24897 24928
24898 /* 24929 /*
24899 * SPEC cvc-elt (3.3.4) : (4.3) (Type Derivation OK) 24930 * SPEC cvc-elt (3.3.4) : (4.3) (Type Derivation OK)
24900 » * "The �local type definition� must be validly 24931 » * "The `local type definition` must be validly
24901 * derived from the {type definition} given the union of 24932 * derived from the {type definition} given the union of
24902 * the {disallowed substitutions} and the {type definition}'s 24933 * the {disallowed substitutions} and the {type definition}'s
24903 * {prohibited substitutions}, as defined in 24934 * {prohibited substitutions}, as defined in
24904 » * Type Derivation OK (Complex) (�3.4.6) 24935 » * Type Derivation OK (Complex) ($3.4.6)
24905 * (if it is a complex type definition), 24936 * (if it is a complex type definition),
24906 * or given {disallowed substitutions} as defined in Type 24937 * or given {disallowed substitutions} as defined in Type
24907 » * Derivation OK (Simple) (�3.14.6) (if it is a simple type 24938 » * Derivation OK (Simple) ($3.14.6) (if it is a simple type
24908 * definition)." 24939 * definition)."
24909 * 24940 *
24910 * {disallowed substitutions}: the "block" on the element decl. 24941 * {disallowed substitutions}: the "block" on the element decl.
24911 * {prohibited substitutions}: the "block" on the type def. 24942 * {prohibited substitutions}: the "block" on the type def.
24912 */ 24943 */
24913 /* 24944 /*
24914 * OPTIMIZE TODO: We could map types already evaluated 24945 * OPTIMIZE TODO: We could map types already evaluated
24915 * to be validly derived from other types to avoid checking 24946 * to be validly derived from other types to avoid checking
24916 * this over and over for the same types. 24947 * this over and over for the same types.
24917 */ 24948 */
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
24980 actualType = WXS_ELEM_TYPEDEF(elemDecl); 25011 actualType = WXS_ELEM_TYPEDEF(elemDecl);
24981 /* 25012 /*
24982 * cvc-elt (3.3.4) : 2 25013 * cvc-elt (3.3.4) : 2
24983 */ 25014 */
24984 if (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT) { 25015 if (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT) {
24985 VERROR(XML_SCHEMAV_CVC_ELT_2, NULL, 25016 VERROR(XML_SCHEMAV_CVC_ELT_2, NULL,
24986 "The element declaration is abstract"); 25017 "The element declaration is abstract");
24987 return (vctxt->err); 25018 return (vctxt->err);
24988 } 25019 }
24989 if (actualType == NULL) { 25020 if (actualType == NULL) {
24990 » VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, 25021 » VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL,
24991 » "The type definition is absent"); 25022 » "The type definition is absent");
24992 » return (XML_SCHEMAV_CVC_TYPE_1); 25023 » return (XML_SCHEMAV_CVC_TYPE_1);
24993 } 25024 }
24994 if (vctxt->nbAttrInfos != 0) { 25025 if (vctxt->nbAttrInfos != 0) {
24995 int ret; 25026 int ret;
24996 xmlSchemaAttrInfoPtr iattr; 25027 xmlSchemaAttrInfoPtr iattr;
24997 /* 25028 /*
24998 * cvc-elt (3.3.4) : 3 25029 * cvc-elt (3.3.4) : 3
24999 * Handle 'xsi:nil'. 25030 * Handle 'xsi:nil'.
25000 */ 25031 */
25001 iattr = xmlSchemaGetMetaAttrInfo(vctxt, 25032 iattr = xmlSchemaGetMetaAttrInfo(vctxt,
25002 XML_SCHEMA_ATTR_INFO_META_XSI_NIL); 25033 XML_SCHEMA_ATTR_INFO_META_XSI_NIL);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
25072 /* 25103 /*
25073 * IDC: Register identity-constraint XPath matchers. 25104 * IDC: Register identity-constraint XPath matchers.
25074 */ 25105 */
25075 if ((elemDecl->idcs != NULL) && 25106 if ((elemDecl->idcs != NULL) &&
25076 (xmlSchemaIDCRegisterMatchers(vctxt, elemDecl) == -1)) 25107 (xmlSchemaIDCRegisterMatchers(vctxt, elemDecl) == -1))
25077 return (-1); 25108 return (-1);
25078 /* 25109 /*
25079 * No actual type definition. 25110 * No actual type definition.
25080 */ 25111 */
25081 if (actualType == NULL) { 25112 if (actualType == NULL) {
25082 » VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, 25113 » VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL,
25083 » "The type definition is absent"); 25114 » "The type definition is absent");
25084 » return (XML_SCHEMAV_CVC_TYPE_1); 25115 » return (XML_SCHEMAV_CVC_TYPE_1);
25085 } 25116 }
25086 /* 25117 /*
25087 * Remember the actual type definition. 25118 * Remember the actual type definition.
25088 */ 25119 */
25089 vctxt->inode->typeDef = actualType; 25120 vctxt->inode->typeDef = actualType;
25090 25121
25091 return (0); 25122 return (0);
25092 } 25123 }
25093 25124
25094 static int 25125 static int
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
25168 xmlSchemaItemListPtr attrUseList; 25199 xmlSchemaItemListPtr attrUseList;
25169 xmlSchemaAttributeUsePtr attrUse = NULL; 25200 xmlSchemaAttributeUsePtr attrUse = NULL;
25170 xmlSchemaAttributePtr attrDecl = NULL; 25201 xmlSchemaAttributePtr attrDecl = NULL;
25171 xmlSchemaAttrInfoPtr iattr, tmpiattr; 25202 xmlSchemaAttrInfoPtr iattr, tmpiattr;
25172 int i, j, found, nbAttrs, nbUses; 25203 int i, j, found, nbAttrs, nbUses;
25173 int xpathRes = 0, res, wildIDs = 0, fixed; 25204 int xpathRes = 0, res, wildIDs = 0, fixed;
25174 xmlNodePtr defAttrOwnerElem = NULL; 25205 xmlNodePtr defAttrOwnerElem = NULL;
25175 25206
25176 /* 25207 /*
25177 * SPEC (cvc-attribute) 25208 * SPEC (cvc-attribute)
25178 * (1) "The declaration must not be �absent� (see Missing 25209 * (1) "The declaration must not be `absent` (see Missing
25179 * Sub-components (�5.3) for how this can fail to be 25210 * Sub-components ($5.3) for how this can fail to be
25180 * the case)." 25211 * the case)."
25181 * (2) "Its {type definition} must not be absent." 25212 * (2) "Its {type definition} must not be absent."
25182 * 25213 *
25183 * NOTE (1) + (2): This is not handled here, since we currently do not 25214 * NOTE (1) + (2): This is not handled here, since we currently do not
25184 * allow validation against schemas which have missing sub-components. 25215 * allow validation against schemas which have missing sub-components.
25185 * 25216 *
25186 * SPEC (cvc-complex-type) 25217 * SPEC (cvc-complex-type)
25187 * (3) "For each attribute information item in the element information 25218 * (3) "For each attribute information item in the element information
25188 * item's [attributes] excepting those whose [namespace name] is 25219 * item's [attributes] excepting those whose [namespace name] is
25189 * identical to http://www.w3.org/2001/XMLSchema-instance and whose 25220 * identical to http://www.w3.org/2001/XMLSchema-instance and whose
(...skipping 29 matching lines...) Expand all
25219 continue; 25250 continue;
25220 if (!xmlStrEqual(iattr->nsName, attrDecl->targetNamespace)) 25251 if (!xmlStrEqual(iattr->nsName, attrDecl->targetNamespace))
25221 continue; 25252 continue;
25222 found = 1; 25253 found = 1;
25223 /* 25254 /*
25224 * SPEC (cvc-complex-type) 25255 * SPEC (cvc-complex-type)
25225 * (3.1) "If there is among the {attribute uses} an attribute 25256 * (3.1) "If there is among the {attribute uses} an attribute
25226 * use with an {attribute declaration} whose {name} matches 25257 * use with an {attribute declaration} whose {name} matches
25227 * the attribute information item's [local name] and whose 25258 * the attribute information item's [local name] and whose
25228 * {target namespace} is identical to the attribute information 25259 * {target namespace} is identical to the attribute information
25229 » * item's [namespace name] (where an �absent� {target namespace} 25260 » * item's [namespace name] (where an `absent` {target namespace}
25230 * is taken to be identical to a [namespace name] with no value), 25261 * is taken to be identical to a [namespace name] with no value),
25231 » * then the attribute information must be �valid� with respect 25262 » * then the attribute information must be `valid` with respect
25232 * to that attribute use as per Attribute Locally Valid (Use) 25263 * to that attribute use as per Attribute Locally Valid (Use)
25233 » * (�3.5.4). In this case the {attribute declaration} of that 25264 » * ($3.5.4). In this case the {attribute declaration} of that
25234 » * attribute use is the �context-determined declaration� for the 25265 » * attribute use is the `context-determined declaration` for the
25235 * attribute information item with respect to Schema-Validity 25266 * attribute information item with respect to Schema-Validity
25236 » * Assessment (Attribute) (�3.2.4) and 25267 » * Assessment (Attribute) ($3.2.4) and
25237 » * Assessment Outcome (Attribute) (�3.2.5). 25268 » * Assessment Outcome (Attribute) ($3.2.5).
25238 */ 25269 */
25239 iattr->state = XML_SCHEMAS_ATTR_ASSESSED; 25270 iattr->state = XML_SCHEMAS_ATTR_ASSESSED;
25240 iattr->use = attrUse; 25271 iattr->use = attrUse;
25241 /* 25272 /*
25242 * Context-determined declaration. 25273 * Context-determined declaration.
25243 */ 25274 */
25244 iattr->decl = attrDecl; 25275 iattr->decl = attrDecl;
25245 iattr->typeDef = attrDecl->subtypes; 25276 iattr->typeDef = attrDecl->subtypes;
25246 break; 25277 break;
25247 } 25278 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
25304 for (i = 0; i < nbAttrs; i++) { 25335 for (i = 0; i < nbAttrs; i++) {
25305 iattr = vctxt->attrInfos[i]; 25336 iattr = vctxt->attrInfos[i];
25306 /* 25337 /*
25307 * SPEC (cvc-complex-type) (3) 25338 * SPEC (cvc-complex-type) (3)
25308 * Skip meta attributes. 25339 * Skip meta attributes.
25309 */ 25340 */
25310 if (iattr->state != XML_SCHEMAS_ATTR_UNKNOWN) 25341 if (iattr->state != XML_SCHEMAS_ATTR_UNKNOWN)
25311 continue; 25342 continue;
25312 /* 25343 /*
25313 * SPEC (cvc-complex-type) 25344 * SPEC (cvc-complex-type)
25314 » * (3.2.2) "The attribute information item must be �valid� with 25345 » * (3.2.2) "The attribute information item must be `valid` with
25315 » * respect to it as defined in Item Valid (Wildcard) (�3.10.4)." 25346 » * respect to it as defined in Item Valid (Wildcard) ($3.10.4)."
25316 * 25347 *
25317 * SPEC Item Valid (Wildcard) (cvc-wildcard) 25348 * SPEC Item Valid (Wildcard) (cvc-wildcard)
25318 » * "... its [namespace name] must be �valid� with respect to 25349 » * "... its [namespace name] must be `valid` with respect to
25319 * the wildcard constraint, as defined in Wildcard allows 25350 * the wildcard constraint, as defined in Wildcard allows
25320 » * Namespace Name (�3.10.4)." 25351 » * Namespace Name ($3.10.4)."
25321 */ 25352 */
25322 if (xmlSchemaCheckCVCWildcardNamespace(type->attributeWildcard, 25353 if (xmlSchemaCheckCVCWildcardNamespace(type->attributeWildcard,
25323 iattr->nsName) == 0) { 25354 iattr->nsName) == 0) {
25324 /* 25355 /*
25325 * Handle processContents. 25356 * Handle processContents.
25326 * 25357 *
25327 * SPEC (cvc-wildcard): 25358 * SPEC (cvc-wildcard):
25328 * processContents | context-determined declaration: 25359 * processContents | context-determined declaration:
25329 * "strict" "mustFind" 25360 * "strict" "mustFind"
25330 * "lax" "none" 25361 * "lax" "none"
(...skipping 15 matching lines...) Expand all
25346 * Find an attribute declaration. 25377 * Find an attribute declaration.
25347 */ 25378 */
25348 iattr->decl = xmlSchemaGetAttributeDecl(vctxt->schema, 25379 iattr->decl = xmlSchemaGetAttributeDecl(vctxt->schema,
25349 iattr->localName, iattr->nsName); 25380 iattr->localName, iattr->nsName);
25350 if (iattr->decl != NULL) { 25381 if (iattr->decl != NULL) {
25351 iattr->state = XML_SCHEMAS_ATTR_ASSESSED; 25382 iattr->state = XML_SCHEMAS_ATTR_ASSESSED;
25352 /* 25383 /*
25353 * SPEC (cvc-complex-type) 25384 * SPEC (cvc-complex-type)
25354 * (5) "Let [Definition:] the wild IDs be the set of 25385 * (5) "Let [Definition:] the wild IDs be the set of
25355 * all attribute information item to which clause 3.2 25386 * all attribute information item to which clause 3.2
25356 » » * applied and whose �validation� resulted in a 25387 » » * applied and whose `validation` resulted in a
25357 » » * �context-determined declaration� of mustFind or no 25388 » » * `context-determined declaration` of mustFind or no
25358 » » * �context-determined declaration� at all, and whose 25389 » » * `context-determined declaration` at all, and whose
25359 * [local name] and [namespace name] resolve (as 25390 * [local name] and [namespace name] resolve (as
25360 » » * defined by QName resolution (Instance) (�3.15.4)) to 25391 » » * defined by QName resolution (Instance) ($3.15.4)) to
25361 * an attribute declaration whose {type definition} is 25392 * an attribute declaration whose {type definition} is
25362 * or is derived from ID. Then all of the following 25393 * or is derived from ID. Then all of the following
25363 * must be true:" 25394 * must be true:"
25364 */ 25395 */
25365 iattr->typeDef = WXS_ATTR_TYPEDEF(iattr->decl); 25396 iattr->typeDef = WXS_ATTR_TYPEDEF(iattr->decl);
25366 if (xmlSchemaIsDerivedFromBuiltInType( 25397 if (xmlSchemaIsDerivedFromBuiltInType(
25367 iattr->typeDef, XML_SCHEMAS_ID)) { 25398 iattr->typeDef, XML_SCHEMAS_ID)) {
25368 /* 25399 /*
25369 * SPEC (5.1) "There must be no more than one 25400 * SPEC (5.1) "There must be no more than one
25370 » » » * item in �wild IDs�." 25401 » » » * item in `wild IDs`."
25371 */ 25402 */
25372 if (wildIDs != 0) { 25403 if (wildIDs != 0) {
25373 /* VAL TODO */ 25404 /* VAL TODO */
25374 iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_I D; 25405 iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_I D;
25375 TODO 25406 TODO
25376 continue; 25407 continue;
25377 } 25408 }
25378 wildIDs++; 25409 wildIDs++;
25379 /* 25410 /*
25380 * SPEC (cvc-complex-type) 25411 * SPEC (cvc-complex-type)
25381 » » » * (5.2) "If �wild IDs� is non-empty, there must not 25412 » » » * (5.2) "If `wild IDs` is non-empty, there must not
25382 * be any attribute uses among the {attribute uses} 25413 * be any attribute uses among the {attribute uses}
25383 * whose {attribute declaration}'s {type definition} 25414 * whose {attribute declaration}'s {type definition}
25384 * is or is derived from ID." 25415 * is or is derived from ID."
25385 */ 25416 */
25386 if (attrUseList != NULL) { 25417 if (attrUseList != NULL) {
25387 for (j = 0; j < attrUseList->nbItems; j++) { 25418 for (j = 0; j < attrUseList->nbItems; j++) {
25388 if (xmlSchemaIsDerivedFromBuiltInType( 25419 if (xmlSchemaIsDerivedFromBuiltInType(
25389 WXS_ATTRUSE_TYPEDEF(attrUseList->items[j]), 25420 WXS_ATTRUSE_TYPEDEF(attrUseList->items[j]),
25390 XML_SCHEMAS_ID)) { 25421 XML_SCHEMAS_ID)) {
25391 /* URGENT VAL TODO: implement */ 25422 /* URGENT VAL TODO: implement */
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
25581 * the attribute was a wild attribute. 25612 * the attribute was a wild attribute.
25582 */ 25613 */
25583 if ((iattr->decl->flags & XML_SCHEMAS_ATTR_FIXED) || 25614 if ((iattr->decl->flags & XML_SCHEMAS_ATTR_FIXED) ||
25584 ((iattr->use != NULL) && 25615 ((iattr->use != NULL) &&
25585 (iattr->use->flags & XML_SCHEMAS_ATTR_FIXED))) 25616 (iattr->use->flags & XML_SCHEMAS_ATTR_FIXED)))
25586 fixed = 1; 25617 fixed = 1;
25587 else 25618 else
25588 fixed = 0; 25619 fixed = 0;
25589 /* 25620 /*
25590 * SPEC (cvc-attribute) 25621 * SPEC (cvc-attribute)
25591 » * (3) "The item's �normalized value� must be locally �valid� 25622 » * (3) "The item's `normalized value` must be locally `valid`
25592 * with respect to that {type definition} as per 25623 * with respect to that {type definition} as per
25593 » * String Valid (�3.14.4)." 25624 » * String Valid ($3.14.4)."
25594 * 25625 *
25595 * VAL TODO: Do we already have the 25626 * VAL TODO: Do we already have the
25596 * "normalized attribute value" here? 25627 * "normalized attribute value" here?
25597 */ 25628 */
25598 if (xpathRes || fixed) { 25629 if (xpathRes || fixed) {
25599 iattr->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED; 25630 iattr->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED;
25600 /* 25631 /*
25601 * Request a computed value. 25632 * Request a computed value.
25602 */ 25633 */
25603 res = xmlSchemaVCheckCVCSimpleType( 25634 res = xmlSchemaVCheckCVCSimpleType(
(...skipping 17 matching lines...) Expand all
25621 /* 25652 /*
25622 * SPEC PSVI Assessment Outcome (Attribute) 25653 * SPEC PSVI Assessment Outcome (Attribute)
25623 * [validity] = "invalid" 25654 * [validity] = "invalid"
25624 */ 25655 */
25625 goto eval_idcs; 25656 goto eval_idcs;
25626 } 25657 }
25627 25658
25628 if (fixed) { 25659 if (fixed) {
25629 /* 25660 /*
25630 * SPEC Attribute Locally Valid (Use) (cvc-au) 25661 * SPEC Attribute Locally Valid (Use) (cvc-au)
25631 » * "For an attribute information item to be�valid� 25662 » * "For an attribute information item to be `valid`
25632 * with respect to an attribute use its *normalized* 25663 * with respect to an attribute use its *normalized*
25633 » * value� must match the *canonical* lexical 25664 » * value must match the *canonical* lexical
25634 * representation of the attribute use's {value 25665 * representation of the attribute use's {value
25635 * constraint}value, if it is present and fixed." 25666 * constraint}value, if it is present and fixed."
25636 * 25667 *
25637 * VAL TODO: The requirement for the *canonical* value 25668 * VAL TODO: The requirement for the *canonical* value
25638 * will be removed in XML Schema 1.1. 25669 * will be removed in XML Schema 1.1.
25639 */ 25670 */
25640 /* 25671 /*
25641 * SPEC Attribute Locally Valid (cvc-attribute) 25672 * SPEC Attribute Locally Valid (cvc-attribute)
25642 » * (4) "The item's *actual* value� must match the *value* of 25673 » * (4) "The item's *actual* value must match the *value* of
25643 * the {value constraint}, if it is present and fixed." 25674 * the {value constraint}, if it is present and fixed."
25644 */ 25675 */
25645 if (iattr->val == NULL) { 25676 if (iattr->val == NULL) {
25646 /* VAL TODO: A value was not precomputed. */ 25677 /* VAL TODO: A value was not precomputed. */
25647 TODO 25678 TODO
25648 goto eval_idcs; 25679 goto eval_idcs;
25649 } 25680 }
25650 if ((iattr->use != NULL) && 25681 if ((iattr->use != NULL) &&
25651 (iattr->use->defValue != NULL)) { 25682 (iattr->use->defValue != NULL)) {
25652 if (iattr->use->defVal == NULL) { 25683 if (iattr->use->defVal == NULL) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
25862 * For a string to be a valid default with respect to a type 25893 * For a string to be a valid default with respect to a type
25863 * definition the appropriate case among the following must be true: 25894 * definition the appropriate case among the following must be true:
25864 */ 25895 */
25865 if WXS_IS_COMPLEX(inode->typeDef) { 25896 if WXS_IS_COMPLEX(inode->typeDef) {
25866 /* 25897 /*
25867 * Complex type. 25898 * Complex type.
25868 * 25899 *
25869 * SPEC (2.1) "its {content type} must be a simple type definition 25900 * SPEC (2.1) "its {content type} must be a simple type definition
25870 * or mixed." 25901 * or mixed."
25871 * SPEC (2.2.2) "If the {content type} is mixed, then the {content 25902 * SPEC (2.2.2) "If the {content type} is mixed, then the {content
25872 » * type}'s particle must be �emptiable� as defined by 25903 » * type}'s particle must be `emptiable` as defined by
25873 » * Particle Emptiable (�3.9.6)." 25904 » * Particle Emptiable ($3.9.6)."
25874 */ 25905 */
25875 if ((! WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) && 25906 if ((! WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) &&
25876 ((! WXS_HAS_MIXED_CONTENT(inode->typeDef)) || 25907 ((! WXS_HAS_MIXED_CONTENT(inode->typeDef)) ||
25877 (! WXS_EMPTIABLE(inode->typeDef)))) { 25908 (! WXS_EMPTIABLE(inode->typeDef)))) {
25878 ret = XML_SCHEMAP_COS_VALID_DEFAULT_2_1; 25909 ret = XML_SCHEMAP_COS_VALID_DEFAULT_2_1;
25879 /* NOTE that this covers (2.2.2) as well. */ 25910 /* NOTE that this covers (2.2.2) as well. */
25880 VERROR(ret, NULL, 25911 VERROR(ret, NULL,
25881 "For a string to be a valid default, the type definition " 25912 "For a string to be a valid default, the type definition "
25882 "must be a simple type or a complex type with simple content " 25913 "must be a simple type or a complex type with simple content "
25883 "or mixed content and a particle emptiable"); 25914 "or mixed content and a particle emptiable");
25884 return(ret); 25915 return(ret);
25885 } 25916 }
25886 } 25917 }
25887 /* 25918 /*
25888 * 1 If the type definition is a simple type definition, then the string 25919 * 1 If the type definition is a simple type definition, then the string
25889 * must be �valid� with respect to that definition as defined by String 25920 * must be `valid` with respect to that definition as defined by String
25890 * Valid (�3.14.4). 25921 * Valid ($3.14.4).
25891 * 25922 *
25892 * AND 25923 * AND
25893 * 25924 *
25894 * 2.2.1 If the {content type} is a simple type definition, then the 25925 * 2.2.1 If the {content type} is a simple type definition, then the
25895 * string must be �valid� with respect to that simple type definition 25926 * string must be `valid` with respect to that simple type definition
25896 * as defined by String Valid (�3.14.4). 25927 * as defined by String Valid ($3.14.4).
25897 */ 25928 */
25898 if (WXS_IS_SIMPLE(inode->typeDef)) { 25929 if (WXS_IS_SIMPLE(inode->typeDef)) {
25899 25930
25900 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt, 25931 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25901 NULL, inode->typeDef, value, val, 1, 1, 0); 25932 NULL, inode->typeDef, value, val, 1, 1, 0);
25902 25933
25903 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { 25934 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) {
25904 25935
25905 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt, 25936 ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
25906 NULL, inode->typeDef->contentTypeDef, value, val, 1, 1, 0); 25937 NULL, inode->typeDef->contentTypeDef, value, val, 1, 1, 0);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
26027 if (inode->regexCtxt == NULL) { 26058 if (inode->regexCtxt == NULL) {
26028 VERROR_INT("xmlSchemaValidatorPopElem", 26059 VERROR_INT("xmlSchemaValidatorPopElem",
26029 "failed to create a regex context"); 26060 "failed to create a regex context");
26030 goto internal_error; 26061 goto internal_error;
26031 } 26062 }
26032 #ifdef DEBUG_AUTOMATA 26063 #ifdef DEBUG_AUTOMATA
26033 xmlGenericError(xmlGenericErrorContext, 26064 xmlGenericError(xmlGenericErrorContext,
26034 "AUTOMATON create on '%s'\n", inode->localName); 26065 "AUTOMATON create on '%s'\n", inode->localName);
26035 #endif 26066 #endif
26036 } 26067 }
26068
26069 /*
26070 * Do not check further content if the node has been nilled
26071 */
26072 if (INODE_NILLED(inode)) {
26073 ret = 0;
26074 #ifdef DEBUG_AUTOMATA
26075 xmlGenericError(xmlGenericErrorContext,
26076 "AUTOMATON succeeded on nilled '%s'\n",
26077 inode->localName);
26078 #endif
26079 goto skip_nilled;
26080 }
26081
26037 /* 26082 /*
26038 * Get hold of the still expected content, since a further 26083 * Get hold of the still expected content, since a further
26039 * call to xmlRegExecPushString() will loose this information. 26084 * call to xmlRegExecPushString() will loose this information.
26040 */ 26085 */
26041 xmlRegExecNextValues(inode->regexCtxt, 26086 xmlRegExecNextValues(inode->regexCtxt,
26042 &nbval, &nbneg, &values[0], &terminal); 26087 &nbval, &nbneg, &values[0], &terminal);
26043 ret = xmlRegExecPushString(inode->regexCtxt, NULL, NULL); 26088 ret = xmlRegExecPushString(inode->regexCtxt, NULL, NULL);
26044 if ((ret<0) || ((ret==0) && (!INODE_NILLED(inode)))) { 26089 if ((ret<0) || ((ret==0) && (!INODE_NILLED(inode)))) {
26045 /* 26090 /*
26046 * Still missing something. 26091 * Still missing something.
(...skipping 17 matching lines...) Expand all
26064 ret = 0; 26109 ret = 0;
26065 #ifdef DEBUG_AUTOMATA 26110 #ifdef DEBUG_AUTOMATA
26066 xmlGenericError(xmlGenericErrorContext, 26111 xmlGenericError(xmlGenericErrorContext,
26067 "AUTOMATON succeeded on '%s'\n", 26112 "AUTOMATON succeeded on '%s'\n",
26068 inode->localName); 26113 inode->localName);
26069 #endif 26114 #endif
26070 } 26115 }
26071 26116
26072 } 26117 }
26073 } 26118 }
26119
26120 skip_nilled:
26121
26074 if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS) 26122 if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS)
26075 goto end_elem; 26123 goto end_elem;
26076 26124
26077 character_content: 26125 character_content:
26078 26126
26079 if (vctxt->value != NULL) { 26127 if (vctxt->value != NULL) {
26080 xmlSchemaFreeValue(vctxt->value); 26128 xmlSchemaFreeValue(vctxt->value);
26081 vctxt->value = NULL; 26129 vctxt->value = NULL;
26082 } 26130 }
26083 /* 26131 /*
(...skipping 26 matching lines...) Expand all
26110 * cvc-elt (3.3.4) : 5.1 26158 * cvc-elt (3.3.4) : 5.1
26111 * If the declaration has a {value constraint}, 26159 * If the declaration has a {value constraint},
26112 * the item has neither element nor character [children] and 26160 * the item has neither element nor character [children] and
26113 * clause 3.2 has not applied, then all of the following must be true: 26161 * clause 3.2 has not applied, then all of the following must be true:
26114 */ 26162 */
26115 if ((inode->decl->value != NULL) && 26163 if ((inode->decl->value != NULL) &&
26116 (inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) && 26164 (inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) &&
26117 (! INODE_NILLED(inode))) { 26165 (! INODE_NILLED(inode))) {
26118 /* 26166 /*
26119 * cvc-elt (3.3.4) : 5.1.1 26167 * cvc-elt (3.3.4) : 5.1.1
26120 » * If the �actual type definition� is a �local type definition� 26168 » * If the `actual type definition` is a `local type definition`
26121 * then the canonical lexical representation of the {value constraint} 26169 * then the canonical lexical representation of the {value constraint}
26122 » * value must be a valid default for the �actual type definition� as 26170 » * value must be a valid default for the `actual type definition` as
26123 » * defined in Element Default Valid (Immediate) (�3.3.6). 26171 » * defined in Element Default Valid (Immediate) ($3.3.6).
26124 */ 26172 */
26125 /* 26173 /*
26126 * NOTE: 'local' above means types acquired by xsi:type. 26174 * NOTE: 'local' above means types acquired by xsi:type.
26127 * NOTE: Although the *canonical* value is stated, it is not 26175 * NOTE: Although the *canonical* value is stated, it is not
26128 * relevant if canonical or not. Additionally XML Schema 1.1 26176 * relevant if canonical or not. Additionally XML Schema 1.1
26129 * will removed this requirement as well. 26177 * will removed this requirement as well.
26130 */ 26178 */
26131 if (inode->flags & XML_SCHEMA_ELEM_INFO_LOCAL_TYPE) { 26179 if (inode->flags & XML_SCHEMA_ELEM_INFO_LOCAL_TYPE) {
26132 26180
26133 ret = xmlSchemaCheckCOSValidDefault(vctxt, 26181 ret = xmlSchemaCheckCOSValidDefault(vctxt,
26134 inode->decl->value, &(inode->val)); 26182 inode->decl->value, &(inode->val));
26135 if (ret != 0) { 26183 if (ret != 0) {
26136 if (ret < 0) { 26184 if (ret < 0) {
26137 VERROR_INT("xmlSchemaValidatorPopElem", 26185 VERROR_INT("xmlSchemaValidatorPopElem",
26138 "calling xmlSchemaCheckCOSValidDefault()"); 26186 "calling xmlSchemaCheckCOSValidDefault()");
26139 goto internal_error; 26187 goto internal_error;
26140 } 26188 }
26141 goto end_elem; 26189 goto end_elem;
26142 } 26190 }
26143 /* 26191 /*
26144 * Stop here, to avoid redundant validation of the value 26192 * Stop here, to avoid redundant validation of the value
26145 * (see following). 26193 * (see following).
26146 */ 26194 */
26147 goto default_psvi; 26195 goto default_psvi;
26148 } 26196 }
26149 /* 26197 /*
26150 * cvc-elt (3.3.4) : 5.1.2 26198 * cvc-elt (3.3.4) : 5.1.2
26151 * The element information item with the canonical lexical 26199 * The element information item with the canonical lexical
26152 * representation of the {value constraint} value used as its 26200 * representation of the {value constraint} value used as its
26153 » * �normalized value� must be �valid� with respect to the 26201 » * `normalized value` must be `valid` with respect to the
26154 » * �actual type definition� as defined by Element Locally Valid (Type) 26202 » * `actual type definition` as defined by Element Locally Valid (Type)
26155 » * (�3.3.4). 26203 » * ($3.3.4).
26156 */ 26204 */
26157 if (WXS_IS_SIMPLE(inode->typeDef)) { 26205 if (WXS_IS_SIMPLE(inode->typeDef)) {
26158 ret = xmlSchemaVCheckINodeDataType(vctxt, 26206 ret = xmlSchemaVCheckINodeDataType(vctxt,
26159 inode, inode->typeDef, inode->decl->value); 26207 inode, inode->typeDef, inode->decl->value);
26160 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { 26208 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) {
26161 ret = xmlSchemaVCheckINodeDataType(vctxt, 26209 ret = xmlSchemaVCheckINodeDataType(vctxt,
26162 inode, inode->typeDef->contentTypeDef, 26210 inode, inode->typeDef->contentTypeDef,
26163 inode->decl->value); 26211 inode->decl->value);
26164 } 26212 }
26165 if (ret != 0) { 26213 if (ret != 0) {
(...skipping 26 matching lines...) Expand all
26192 if (textChild == NULL) { 26240 if (textChild == NULL) {
26193 VERROR_INT("xmlSchemaValidatorPopElem", 26241 VERROR_INT("xmlSchemaValidatorPopElem",
26194 "calling xmlNewText()"); 26242 "calling xmlNewText()");
26195 goto internal_error; 26243 goto internal_error;
26196 } else 26244 } else
26197 xmlAddChild(inode->node, textChild); 26245 xmlAddChild(inode->node, textChild);
26198 } 26246 }
26199 26247
26200 } else if (! INODE_NILLED(inode)) { 26248 } else if (! INODE_NILLED(inode)) {
26201 /* 26249 /*
26202 » * 5.2.1 The element information item must be �valid� with respect 26250 » * 5.2.1 The element information item must be `valid` with respect
26203 » * to the �actual type definition� as defined by Element Locally 26251 » * to the `actual type definition` as defined by Element Locally
26204 » * Valid (Type) (�3.3.4). 26252 » * Valid (Type) ($3.3.4).
26205 */ 26253 */
26206 if (WXS_IS_SIMPLE(inode->typeDef)) { 26254 if (WXS_IS_SIMPLE(inode->typeDef)) {
26207 /* 26255 /*
26208 * SPEC (cvc-type) (3.1) 26256 * SPEC (cvc-type) (3.1)
26209 * "If the type definition is a simple type definition, ..." 26257 * "If the type definition is a simple type definition, ..."
26210 * (3.1.3) "If clause 3.2 of Element Locally Valid 26258 * (3.1.3) "If clause 3.2 of Element Locally Valid
26211 » * (Element) (�3.3.4) did not apply, then the �normalized value� 26259 » * (Element) ($3.3.4) did not apply, then the `normalized value`
26212 » * must be �valid� with respect to the type definition as defined 26260 » * must be `valid` with respect to the type definition as defined
26213 » * by String Valid (�3.14.4). 26261 » * by String Valid ($3.14.4).
26214 */ 26262 */
26215 ret = xmlSchemaVCheckINodeDataType(vctxt, 26263 ret = xmlSchemaVCheckINodeDataType(vctxt,
26216 inode, inode->typeDef, inode->value); 26264 inode, inode->typeDef, inode->value);
26217 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { 26265 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) {
26218 /* 26266 /*
26219 * SPEC (cvc-type) (3.2) "If the type definition is a complex type 26267 * SPEC (cvc-type) (3.2) "If the type definition is a complex type
26220 * definition, then the element information item must be 26268 * definition, then the element information item must be
26221 » * �valid� with respect to the type definition as per 26269 » * `valid` with respect to the type definition as per
26222 » * Element Locally Valid (Complex Type) (�3.4.4);" 26270 » * Element Locally Valid (Complex Type) ($3.4.4);"
26223 * 26271 *
26224 * SPEC (cvc-complex-type) (2.2) 26272 * SPEC (cvc-complex-type) (2.2)
26225 * "If the {content type} is a simple type definition, ... 26273 * "If the {content type} is a simple type definition, ...
26226 » * the �normalized value� of the element information item is 26274 » * the `normalized value` of the element information item is
26227 » * �valid� with respect to that simple type definition as 26275 » * `valid` with respect to that simple type definition as
26228 » * defined by String Valid (�3.14.4)." 26276 » * defined by String Valid ($3.14.4)."
26229 */ 26277 */
26230 ret = xmlSchemaVCheckINodeDataType(vctxt, 26278 ret = xmlSchemaVCheckINodeDataType(vctxt,
26231 inode, inode->typeDef->contentTypeDef, inode->value); 26279 inode, inode->typeDef->contentTypeDef, inode->value);
26232 } 26280 }
26233 if (ret != 0) { 26281 if (ret != 0) {
26234 if (ret < 0) { 26282 if (ret < 0) {
26235 VERROR_INT("xmlSchemaValidatorPopElem", 26283 VERROR_INT("xmlSchemaValidatorPopElem",
26236 "calling xmlSchemaVCheckCVCSimpleType()"); 26284 "calling xmlSchemaVCheckCVCSimpleType()");
26237 goto internal_error; 26285 goto internal_error;
26238 } 26286 }
(...skipping 21 matching lines...) Expand all
26260 "The content must not containt element nodes since " 26308 "The content must not containt element nodes since "
26261 "there is a fixed value constraint"); 26309 "there is a fixed value constraint");
26262 goto end_elem; 26310 goto end_elem;
26263 } else { 26311 } else {
26264 /* 26312 /*
26265 * 5.2.2.2 The appropriate case among the following must 26313 * 5.2.2.2 The appropriate case among the following must
26266 * be true: 26314 * be true:
26267 */ 26315 */
26268 if (WXS_HAS_MIXED_CONTENT(inode->typeDef)) { 26316 if (WXS_HAS_MIXED_CONTENT(inode->typeDef)) {
26269 /* 26317 /*
26270 » » * 5.2.2.2.1 If the {content type} of the �actual type 26318 » » * 5.2.2.2.1 If the {content type} of the `actual type
26271 » » * definition� is mixed, then the *initial value* of the 26319 » » * definition` is mixed, then the *initial value* of the
26272 * item must match the canonical lexical representation 26320 * item must match the canonical lexical representation
26273 * of the {value constraint} value. 26321 * of the {value constraint} value.
26274 * 26322 *
26275 * ... the *initial value* of an element information 26323 * ... the *initial value* of an element information
26276 * item is the string composed of, in order, the 26324 * item is the string composed of, in order, the
26277 * [character code] of each character information item in 26325 * [character code] of each character information item in
26278 * the [children] of that element information item. 26326 * the [children] of that element information item.
26279 */ 26327 */
26280 if (! xmlStrEqual(inode->value, inode->decl->value)){ 26328 if (! xmlStrEqual(inode->value, inode->decl->value)){
26281 /* 26329 /*
26282 * VAL TODO: Report invalid & expected values as well. 26330 * VAL TODO: Report invalid & expected values as well.
26283 * VAL TODO: Implement the canonical stuff. 26331 * VAL TODO: Implement the canonical stuff.
26284 */ 26332 */
26285 ret = XML_SCHEMAV_CVC_ELT_5_2_2_2_1; 26333 ret = XML_SCHEMAV_CVC_ELT_5_2_2_2_1;
26286 xmlSchemaCustomErr(ACTXT_CAST vctxt, 26334 xmlSchemaCustomErr(ACTXT_CAST vctxt,
26287 ret, NULL, NULL, 26335 ret, NULL, NULL,
26288 "The initial value '%s' does not match the fixed " 26336 "The initial value '%s' does not match the fixed "
26289 "value constraint '%s'", 26337 "value constraint '%s'",
26290 inode->value, inode->decl->value); 26338 inode->value, inode->decl->value);
26291 goto end_elem; 26339 goto end_elem;
26292 } 26340 }
26293 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { 26341 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) {
26294 /* 26342 /*
26295 » » * 5.2.2.2.2 If the {content type} of the �actual type 26343 » » * 5.2.2.2.2 If the {content type} of the `actual type
26296 » » * definition� is a simple type definition, then the 26344 » » * definition` is a simple type definition, then the
26297 * *actual value* of the item must match the canonical 26345 * *actual value* of the item must match the canonical
26298 * lexical representation of the {value constraint} value. 26346 * lexical representation of the {value constraint} value.
26299 */ 26347 */
26300 /* 26348 /*
26301 * VAL TODO: *actual value* is the normalized value, impl. 26349 * VAL TODO: *actual value* is the normalized value, impl.
26302 * this. 26350 * this.
26303 * VAL TODO: Report invalid & expected values as well. 26351 * VAL TODO: Report invalid & expected values as well.
26304 * VAL TODO: Implement a comparison with the computed values. 26352 * VAL TODO: Implement a comparison with the computed values.
26305 */ 26353 */
26306 if (! xmlStrEqual(inode->value, 26354 if (! xmlStrEqual(inode->value,
(...skipping 20 matching lines...) Expand all
26327 if (vctxt->depth == vctxt->skipDepth) 26375 if (vctxt->depth == vctxt->skipDepth)
26328 vctxt->skipDepth = -1; 26376 vctxt->skipDepth = -1;
26329 /* 26377 /*
26330 * Evaluate the history of XPath state objects. 26378 * Evaluate the history of XPath state objects.
26331 */ 26379 */
26332 if (inode->appliedXPath && 26380 if (inode->appliedXPath &&
26333 (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1)) 26381 (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1))
26334 goto internal_error; 26382 goto internal_error;
26335 /* 26383 /*
26336 * MAYBE TODO: 26384 * MAYBE TODO:
26337 * SPEC (6) "The element information item must be �valid� with 26385 * SPEC (6) "The element information item must be `valid` with
26338 * respect to each of the {identity-constraint definitions} as per 26386 * respect to each of the {identity-constraint definitions} as per
26339 * Identity-constraint Satisfied (�3.11.4)." 26387 * Identity-constraint Satisfied ($3.11.4)."
26340 */ 26388 */
26341 /* 26389 /*
26342 * PSVI TODO: If we expose IDC node-tables via PSVI then the tables 26390 * PSVI TODO: If we expose IDC node-tables via PSVI then the tables
26343 * need to be built in any case. 26391 * need to be built in any case.
26344 * We will currently build IDC node-tables and bubble them only if 26392 * We will currently build IDC node-tables and bubble them only if
26345 * keyrefs do exist. 26393 * keyrefs do exist.
26346 */ 26394 */
26347 26395
26348 /* 26396 /*
26349 * Add the current IDC target-nodes to the IDC node-tables. 26397 * Add the current IDC target-nodes to the IDC node-tables.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
26407 * top-most keyref IDC which refers to this IDC. 26455 * top-most keyref IDC which refers to this IDC.
26408 */ 26456 */
26409 aidc->keyrefDepth = -1; 26457 aidc->keyrefDepth = -1;
26410 } 26458 }
26411 aidc = aidc->next; 26459 aidc = aidc->next;
26412 } while (aidc != NULL); 26460 } while (aidc != NULL);
26413 } 26461 }
26414 vctxt->depth--; 26462 vctxt->depth--;
26415 vctxt->inode = vctxt->elemInfos[vctxt->depth]; 26463 vctxt->inode = vctxt->elemInfos[vctxt->depth];
26416 /* 26464 /*
26417 * VAL TODO: 7 If the element information item is the �validation root�, it m ust be 26465 * VAL TODO: 7 If the element information item is the `validation root`, it m ust be
26418 * �valid� per Validation Root Valid (ID/IDREF) (�3.3.4). 26466 * `valid` per Validation Root Valid (ID/IDREF) ($3.3.4).
26419 */ 26467 */
26420 return (ret); 26468 return (ret);
26421 26469
26422 internal_error: 26470 internal_error:
26423 vctxt->err = -1; 26471 vctxt->err = -1;
26424 return (-1); 26472 return (-1);
26425 } 26473 }
26426 26474
26427 /* 26475 /*
26428 * 3.4.4 Complex Type Definition Validation Rules 26476 * 3.4.4 Complex Type Definition Validation Rules
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
26489 "process the attribute 'xsi:nil'"); 26537 "process the attribute 'xsi:nil'");
26490 return (-1); 26538 return (-1);
26491 } 26539 }
26492 return (ret); 26540 return (ret);
26493 } 26541 }
26494 } else { 26542 } else {
26495 /* 26543 /*
26496 * Fallback to "anyType". 26544 * Fallback to "anyType".
26497 * 26545 *
26498 * SPEC (cvc-assess-elt) 26546 * SPEC (cvc-assess-elt)
26499 » » * "If the item cannot be �strictly assessed�, [...] 26547 » » * "If the item cannot be `strictly assessed`, [...]
26500 * an element information item's schema validity may be laxly 26548 * an element information item's schema validity may be laxly
26501 » » * assessed if its �context-determined declaration� is not 26549 » » * assessed if its `context-determined declaration` is not
26502 » » * skip by �validating� with respect to the �ur-type 26550 » » * skip by `validating` with respect to the `ur-type
26503 » » * definition� as per Element Locally Valid (Type) (�3.3.4)." 26551 » » * definition` as per Element Locally Valid (Type) ($3.3.4)."
26504 */ 26552 */
26505 vctxt->inode->typeDef = 26553 vctxt->inode->typeDef =
26506 xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); 26554 xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE);
26507 } 26555 }
26508 } 26556 }
26509 return (0); 26557 return (0);
26510 } 26558 }
26511 26559
26512 switch (ptype->contentType) { 26560 switch (ptype->contentType) {
26513 case XML_SCHEMA_CONTENT_EMPTY: 26561 case XML_SCHEMA_CONTENT_EMPTY:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
26565 #ifdef DEBUG_AUTOMATA 26613 #ifdef DEBUG_AUTOMATA
26566 xmlGenericError(xmlGenericErrorContext, "AUTOMATA create on '%s' \n", 26614 xmlGenericError(xmlGenericErrorContext, "AUTOMATA create on '%s' \n",
26567 pielem->localName); 26615 pielem->localName);
26568 #endif 26616 #endif
26569 } 26617 }
26570 26618
26571 /* 26619 /*
26572 * SPEC (2.4) "If the {content type} is element-only or mixed, 26620 * SPEC (2.4) "If the {content type} is element-only or mixed,
26573 * then the sequence of the element information item's 26621 * then the sequence of the element information item's
26574 * element information item [children], if any, taken in 26622 * element information item [children], if any, taken in
26575 » * order, is �valid� with respect to the {content type}'s 26623 » * order, is `valid` with respect to the {content type}'s
26576 * particle, as defined in Element Sequence Locally Valid 26624 * particle, as defined in Element Sequence Locally Valid
26577 » * (Particle) (�3.9.4)." 26625 » * (Particle) ($3.9.4)."
26578 */ 26626 */
26579 ret = xmlRegExecPushString2(regexCtxt, 26627 ret = xmlRegExecPushString2(regexCtxt,
26580 vctxt->inode->localName, 26628 vctxt->inode->localName,
26581 vctxt->inode->nsName, 26629 vctxt->inode->nsName,
26582 vctxt->inode); 26630 vctxt->inode);
26583 #ifdef DEBUG_AUTOMATA 26631 #ifdef DEBUG_AUTOMATA
26584 if (ret < 0) 26632 if (ret < 0)
26585 xmlGenericError(xmlGenericErrorContext, 26633 xmlGenericError(xmlGenericErrorContext,
26586 "AUTOMATON push ERROR for '%s' on '%s'\n", 26634 "AUTOMATON push ERROR for '%s' on '%s'\n",
26587 vctxt->inode->localName, pielem->localName); 26635 vctxt->inode->localName, pielem->localName);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
26804 * for all input scenarios, then this should be changed to 26852 * for all input scenarios, then this should be changed to
26805 * instantly stop the validation. 26853 * instantly stop the validation.
26806 */ 26854 */
26807 ret = xmlSchemaAssembleByXSI(vctxt); 26855 ret = xmlSchemaAssembleByXSI(vctxt);
26808 if (ret != 0) { 26856 if (ret != 0) {
26809 if (ret == -1) 26857 if (ret == -1)
26810 goto internal_error; 26858 goto internal_error;
26811 vctxt->skipDepth = 0; 26859 vctxt->skipDepth = 0;
26812 return(ret); 26860 return(ret);
26813 } 26861 }
26862 /*
26863 * Augment the IDC definitions for the main schema and all imported ones
26864 * NOTE: main schema is the first in the imported list
26865 */
26866 xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugme ntImportedIDC, vctxt);
26814 } 26867 }
26815 if (vctxt->depth > 0) { 26868 if (vctxt->depth > 0) {
26816 /* 26869 /*
26817 * Validate this element against the content model 26870 * Validate this element against the content model
26818 * of the parent. 26871 * of the parent.
26819 */ 26872 */
26820 ret = xmlSchemaValidateChildElem(vctxt); 26873 ret = xmlSchemaValidateChildElem(vctxt);
26821 if (ret != 0) { 26874 if (ret != 0) {
26822 if (ret < 0) { 26875 if (ret < 0) {
26823 VERROR_INT("xmlSchemaValidateElem", 26876 VERROR_INT("xmlSchemaValidateElem",
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
26897 goto exit; 26950 goto exit;
26898 } 26951 }
26899 /* 26952 /*
26900 * Validate against the type definition. 26953 * Validate against the type definition.
26901 */ 26954 */
26902 type_validation: 26955 type_validation:
26903 26956
26904 if (vctxt->inode->typeDef == NULL) { 26957 if (vctxt->inode->typeDef == NULL) {
26905 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; 26958 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26906 ret = XML_SCHEMAV_CVC_TYPE_1; 26959 ret = XML_SCHEMAV_CVC_TYPE_1;
26907 » VERROR(ret, NULL, 26960 » VERROR(ret, NULL,
26908 » "The type definition is absent"); 26961 » "The type definition is absent");
26909 goto exit; 26962 goto exit;
26910 } 26963 }
26911 if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) { 26964 if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) {
26912 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; 26965 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE;
26913 ret = XML_SCHEMAV_CVC_TYPE_2; 26966 ret = XML_SCHEMAV_CVC_TYPE_2;
26914 » VERROR(ret, NULL, 26967 » VERROR(ret, NULL,
26915 » "The type definition is abstract"); 26968 » "The type definition is abstract");
26916 goto exit; 26969 goto exit;
26917 } 26970 }
26918 /* 26971 /*
26919 * Evaluate IDCs. Do it here, since new IDC matchers are registered 26972 * Evaluate IDCs. Do it here, since new IDC matchers are registered
26920 * during validation against the declaration. This must be done 26973 * during validation against the declaration. This must be done
26921 * _before_ attribute validation. 26974 * _before_ attribute validation.
26922 */ 26975 */
26923 if (vctxt->xpathStates != NULL) { 26976 if (vctxt->xpathStates != NULL) {
26924 ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE); 26977 ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE);
26925 vctxt->inode->appliedXPath = 1; 26978 vctxt->inode->appliedXPath = 1;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
27152 } while (ret == 1); 27205 } while (ret == 1);
27153 27206
27154 exit: 27207 exit:
27155 return (ret); 27208 return (ret);
27156 internal_error: 27209 internal_error:
27157 return (-1); 27210 return (-1);
27158 } 27211 }
27159 #endif 27212 #endif
27160 27213
27161 /************************************************************************ 27214 /************************************************************************
27162 * » » » » » » » » » * 27215 *» » » » » » » » » *
27163 * » » » SAX validation handlers»» » » * 27216 *» » » SAX validation handlers»» » » *
27164 * » » » » » » » » » * 27217 *» » » » » » » » » *
27165 ************************************************************************/ 27218 ************************************************************************/
27166 27219
27167 /* 27220 /*
27168 * Process text content. 27221 * Process text content.
27169 */ 27222 */
27170 static void 27223 static void
27171 xmlSchemaSAXHandleText(void *ctx, 27224 xmlSchemaSAXHandleText(void *ctx,
27172 const xmlChar * ch, 27225 const xmlChar * ch,
27173 int len) 27226 int len)
27174 { 27227 {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
27405 } 27458 }
27406 exit: 27459 exit:
27407 return; 27460 return;
27408 internal_error: 27461 internal_error:
27409 vctxt->err = -1; 27462 vctxt->err = -1;
27410 xmlStopParser(vctxt->parserCtxt); 27463 xmlStopParser(vctxt->parserCtxt);
27411 return; 27464 return;
27412 } 27465 }
27413 27466
27414 /************************************************************************ 27467 /************************************************************************
27415 * » » » » » » » » » * 27468 *» » » » » » » » » *
27416 * » » » Validation interfaces» » » » * 27469 *» » » Validation interfaces» » » » *
27417 * » » » » » » » » » * 27470 *» » » » » » » » » *
27418 ************************************************************************/ 27471 ************************************************************************/
27419 27472
27420 /** 27473 /**
27421 * xmlSchemaNewValidCtxt: 27474 * xmlSchemaNewValidCtxt:
27422 * @schema: a precompiled XML Schemas 27475 * @schema: a precompiled XML Schemas
27423 * 27476 *
27424 * Create an XML Schemas validation context based on the given schema. 27477 * Create an XML Schemas validation context based on the given schema.
27425 * 27478 *
27426 * Returns the validation context or NULL in case of error 27479 * Returns the validation context or NULL in case of error
27427 */ 27480 */
27428 xmlSchemaValidCtxtPtr 27481 xmlSchemaValidCtxtPtr
27429 xmlSchemaNewValidCtxt(xmlSchemaPtr schema) 27482 xmlSchemaNewValidCtxt(xmlSchemaPtr schema)
27430 { 27483 {
27431 xmlSchemaValidCtxtPtr ret; 27484 xmlSchemaValidCtxtPtr ret;
27432 27485
27433 ret = (xmlSchemaValidCtxtPtr) xmlMalloc(sizeof(xmlSchemaValidCtxt)); 27486 ret = (xmlSchemaValidCtxtPtr) xmlMalloc(sizeof(xmlSchemaValidCtxt));
27434 if (ret == NULL) { 27487 if (ret == NULL) {
27435 xmlSchemaVErrMemory(NULL, "allocating validation context", NULL); 27488 xmlSchemaVErrMemory(NULL, "allocating validation context", NULL);
27436 return (NULL); 27489 return (NULL);
27437 } 27490 }
27438 memset(ret, 0, sizeof(xmlSchemaValidCtxt)); 27491 memset(ret, 0, sizeof(xmlSchemaValidCtxt));
27439 ret->type = XML_SCHEMA_CTXT_VALIDATOR; 27492 ret->type = XML_SCHEMA_CTXT_VALIDATOR;
27440 ret->dict = xmlDictCreate(); 27493 ret->dict = xmlDictCreate();
27441 ret->nodeQNames = xmlSchemaItemListCreate(); 27494 ret->nodeQNames = xmlSchemaItemListCreate();
27442 ret->schema = schema; 27495 ret->schema = schema;
27443 return (ret); 27496 return (ret);
27444 } 27497 }
27445 27498
27446 /** 27499 /**
27500 * xmlSchemaValidateSetFilename:
27501 * @vctxt: the schema validation context
27502 * @filename: the file name
27503 *
27504 * Workaround to provide file error reporting information when this is
27505 * not provided by current APIs
27506 */
27507 void
27508 xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, const char *filename) {
27509 if (vctxt == NULL)
27510 return;
27511 if (vctxt->filename != NULL)
27512 xmlFree(vctxt->filename);
27513 if (filename != NULL)
27514 vctxt->filename = (char *) xmlStrdup((const xmlChar *) filename);
27515 else
27516 vctxt->filename = NULL;
27517 }
27518
27519 /**
27447 * xmlSchemaClearValidCtxt: 27520 * xmlSchemaClearValidCtxt:
27448 * @ctxt: the schema validation context 27521 * @vctxt: the schema validation context
27449 * 27522 *
27450 * Free the resources associated to the schema validation context; 27523 * Free the resources associated to the schema validation context;
27451 * leaves some fields alive intended for reuse of the context. 27524 * leaves some fields alive intended for reuse of the context.
27452 */ 27525 */
27453 static void 27526 static void
27454 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) 27527 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
27455 { 27528 {
27456 if (vctxt == NULL) 27529 if (vctxt == NULL)
27457 return; 27530 return;
27458 27531
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
27539 } 27612 }
27540 } 27613 }
27541 xmlSchemaItemListClear(vctxt->nodeQNames); 27614 xmlSchemaItemListClear(vctxt->nodeQNames);
27542 /* Recreate the dict. */ 27615 /* Recreate the dict. */
27543 xmlDictFree(vctxt->dict); 27616 xmlDictFree(vctxt->dict);
27544 /* 27617 /*
27545 * TODO: Is is save to recreate it? Do we have a scenario 27618 * TODO: Is is save to recreate it? Do we have a scenario
27546 * where the user provides the dict? 27619 * where the user provides the dict?
27547 */ 27620 */
27548 vctxt->dict = xmlDictCreate(); 27621 vctxt->dict = xmlDictCreate();
27622
27623 if (vctxt->filename != NULL) {
27624 xmlFree(vctxt->filename);
27625 vctxt->filename = NULL;
27626 }
27549 } 27627 }
27550 27628
27551 /** 27629 /**
27552 * xmlSchemaFreeValidCtxt: 27630 * xmlSchemaFreeValidCtxt:
27553 * @ctxt: the schema validation context 27631 * @ctxt: the schema validation context
27554 * 27632 *
27555 * Free the resources associated to the schema validation context 27633 * Free the resources associated to the schema validation context
27556 */ 27634 */
27557 void 27635 void
27558 xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt) 27636 xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
27624 break; 27702 break;
27625 xmlSchemaClearElemInfo(ctxt, ei); 27703 xmlSchemaClearElemInfo(ctxt, ei);
27626 xmlFree(ei); 27704 xmlFree(ei);
27627 } 27705 }
27628 xmlFree(ctxt->elemInfos); 27706 xmlFree(ctxt->elemInfos);
27629 } 27707 }
27630 if (ctxt->nodeQNames != NULL) 27708 if (ctxt->nodeQNames != NULL)
27631 xmlSchemaItemListFree(ctxt->nodeQNames); 27709 xmlSchemaItemListFree(ctxt->nodeQNames);
27632 if (ctxt->dict != NULL) 27710 if (ctxt->dict != NULL)
27633 xmlDictFree(ctxt->dict); 27711 xmlDictFree(ctxt->dict);
27712 if (ctxt->filename != NULL)
27713 xmlFree(ctxt->filename);
27634 xmlFree(ctxt); 27714 xmlFree(ctxt);
27635 } 27715 }
27636 27716
27637 /** 27717 /**
27638 * xmlSchemaIsValid: 27718 * xmlSchemaIsValid:
27639 * @ctxt: the schema validation context 27719 * @ctxt: the schema validation context
27640 * 27720 *
27641 * Check if any error was detected during validation. 27721 * Check if any error was detected during validation.
27642 * 27722 *
27643 * Returns 1 if valid so far, 0 if errors were detected, and -1 in case 27723 * Returns 1 if valid so far, 0 if errors were detected, and -1 in case
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
27778 static int 27858 static int
27779 xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt) 27859 xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
27780 { 27860 {
27781 xmlAttrPtr attr; 27861 xmlAttrPtr attr;
27782 int ret = 0; 27862 int ret = 0;
27783 xmlSchemaNodeInfoPtr ielem = NULL; 27863 xmlSchemaNodeInfoPtr ielem = NULL;
27784 xmlNodePtr node, valRoot; 27864 xmlNodePtr node, valRoot;
27785 const xmlChar *nsName; 27865 const xmlChar *nsName;
27786 27866
27787 /* DOC VAL TODO: Move this to the start function. */ 27867 /* DOC VAL TODO: Move this to the start function. */
27788 valRoot = xmlDocGetRootElement(vctxt->doc); 27868 if (vctxt->validationRoot != NULL)
27869 valRoot = vctxt->validationRoot;
27870 else
27871 » valRoot = xmlDocGetRootElement(vctxt->doc);
27789 if (valRoot == NULL) { 27872 if (valRoot == NULL) {
27790 /* VAL TODO: Error code? */ 27873 /* VAL TODO: Error code? */
27791 VERROR(1, NULL, "The document has no document element"); 27874 VERROR(1, NULL, "The document has no document element");
27792 return (1); 27875 return (1);
27793 } 27876 }
27794 vctxt->depth = -1; 27877 vctxt->depth = -1;
27795 vctxt->validationRoot = valRoot; 27878 vctxt->validationRoot = valRoot;
27796 node = valRoot; 27879 node = valRoot;
27797 while (node != NULL) { 27880 while (node != NULL) {
27798 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth)) 27881 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth))
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
28099 (xmlNodePtr) doc, NULL, 28182 (xmlNodePtr) doc, NULL,
28100 "The document has no document element", NULL, NULL); 28183 "The document has no document element", NULL, NULL);
28101 return (ctxt->err); 28184 return (ctxt->err);
28102 } 28185 }
28103 ctxt->validationRoot = ctxt->node; 28186 ctxt->validationRoot = ctxt->node;
28104 return (xmlSchemaVStart(ctxt)); 28187 return (xmlSchemaVStart(ctxt));
28105 } 28188 }
28106 28189
28107 28190
28108 /************************************************************************ 28191 /************************************************************************
28109 * » » » » » » » » » * 28192 *» » » » » » » » » *
28110 * » » Function and data for SAX streaming API»» » * 28193 *» » Function and data for SAX streaming API»» » *
28111 * » » » » » » » » » * 28194 *» » » » » » » » » *
28112 ************************************************************************/ 28195 ************************************************************************/
28113 typedef struct _xmlSchemaSplitSAXData xmlSchemaSplitSAXData; 28196 typedef struct _xmlSchemaSplitSAXData xmlSchemaSplitSAXData;
28114 typedef xmlSchemaSplitSAXData *xmlSchemaSplitSAXDataPtr; 28197 typedef xmlSchemaSplitSAXData *xmlSchemaSplitSAXDataPtr;
28115 28198
28116 struct _xmlSchemaSplitSAXData { 28199 struct _xmlSchemaSplitSAXData {
28117 xmlSAXHandlerPtr user_sax; 28200 xmlSAXHandlerPtr user_sax;
28118 void *user_data; 28201 void *user_data;
28119 xmlSchemaValidCtxtPtr ctxt; 28202 xmlSchemaValidCtxtPtr ctxt;
28120 xmlSAXHandlerPtr schemas_sax; 28203 xmlSAXHandlerPtr schemas_sax;
28121 }; 28204 };
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
28618 user_data = plug->user_data_ptr; 28701 user_data = plug->user_data_ptr;
28619 *user_data = plug->user_data; 28702 *user_data = plug->user_data;
28620 } 28703 }
28621 28704
28622 /* free and return */ 28705 /* free and return */
28623 xmlFree(plug); 28706 xmlFree(plug);
28624 return(0); 28707 return(0);
28625 } 28708 }
28626 28709
28627 /** 28710 /**
28711 * xmlSchemaValidateSetLocator:
28712 * @vctxt: a schema validation context
28713 * @f: the locator function pointer
28714 * @ctxt: the locator context
28715 *
28716 * Allows to set a locator function to the validation context,
28717 * which will be used to provide file and line information since
28718 * those are not provided as part of the SAX validation flow
28719 * Setting @f to NULL disable the locator.
28720 */
28721
28722 void
28723 xmlSchemaValidateSetLocator(xmlSchemaValidCtxtPtr vctxt,
28724 xmlSchemaValidityLocatorFunc f,
28725 void *ctxt)
28726 {
28727 if (vctxt == NULL) return;
28728 vctxt->locFunc = f;
28729 vctxt->locCtxt = ctxt;
28730 }
28731
28732 /**
28733 * xmlSchemaValidateStreamLocator:
28734 * @ctx: the xmlTextReaderPtr used
28735 * @file: returned file information
28736 * @line: returned line information
28737 *
28738 * Internal locator function for the readers
28739 *
28740 * Returns 0 in case the Schema validation could be (des)activated and
28741 * -1 in case of error.
28742 */
28743 static int
28744 xmlSchemaValidateStreamLocator(void *ctx, const char **file,
28745 unsigned long *line) {
28746 xmlParserCtxtPtr ctxt;
28747
28748 if ((ctx == NULL) || ((file == NULL) && (line == NULL)))
28749 return(-1);
28750
28751 if (file != NULL)
28752 *file = NULL;
28753 if (line != NULL)
28754 *line = 0;
28755
28756 ctxt = (xmlParserCtxtPtr) ctx;
28757 if (ctxt->input != NULL) {
28758 if (file != NULL)
28759 *file = ctxt->input->filename;
28760 if (line != NULL)
28761 *line = ctxt->input->line;
28762 return(0);
28763 }
28764 return(-1);
28765 }
28766
28767 /**
28628 * xmlSchemaValidateStream: 28768 * xmlSchemaValidateStream:
28629 * @ctxt: a schema validation context 28769 * @ctxt: a schema validation context
28630 * @input: the input to use for reading the data 28770 * @input: the input to use for reading the data
28631 * @enc: an optional encoding information 28771 * @enc: an optional encoding information
28632 * @sax: a SAX handler for the resulting events 28772 * @sax: a SAX handler for the resulting events
28633 * @user_data: the context to provide to the SAX handler. 28773 * @user_data: the context to provide to the SAX handler.
28634 * 28774 *
28635 * Validate an input based on a flow of SAX event from the parser 28775 * Validate an input based on a flow of SAX event from the parser
28636 * and forward the events to the @sax handler with the provided @user_data 28776 * and forward the events to the @sax handler with the provided @user_data
28637 * the user provided @sax handler must be a SAX2 one. 28777 * the user provided @sax handler must be a SAX2 one.
(...skipping 22 matching lines...) Expand all
28660 if (pctxt == NULL) 28800 if (pctxt == NULL)
28661 return (-1); 28801 return (-1);
28662 old_sax = pctxt->sax; 28802 old_sax = pctxt->sax;
28663 pctxt->sax = sax; 28803 pctxt->sax = sax;
28664 pctxt->userData = user_data; 28804 pctxt->userData = user_data;
28665 #if 0 28805 #if 0
28666 if (options) 28806 if (options)
28667 xmlCtxtUseOptions(pctxt, options); 28807 xmlCtxtUseOptions(pctxt, options);
28668 #endif 28808 #endif
28669 pctxt->linenumbers = 1; 28809 pctxt->linenumbers = 1;
28810 xmlSchemaValidateSetLocator(ctxt, xmlSchemaValidateStreamLocator, pctxt);
28670 28811
28671 inputStream = xmlNewIOInputStream(pctxt, input, enc);; 28812 inputStream = xmlNewIOInputStream(pctxt, input, enc);;
28672 if (inputStream == NULL) { 28813 if (inputStream == NULL) {
28673 ret = -1; 28814 ret = -1;
28674 goto done; 28815 goto done;
28675 } 28816 }
28676 inputPush(pctxt, inputStream); 28817 inputPush(pctxt, inputStream);
28677 ctxt->parserCtxt = pctxt; 28818 ctxt->parserCtxt = pctxt;
28678 ctxt->input = input; 28819 ctxt->input = input;
28679 28820
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
28757 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt) 28898 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt)
28758 { 28899 {
28759 if (ctxt == NULL) 28900 if (ctxt == NULL)
28760 return(NULL); 28901 return(NULL);
28761 return (ctxt->parserCtxt); 28902 return (ctxt->parserCtxt);
28762 } 28903 }
28763 28904
28764 #define bottom_xmlschemas 28905 #define bottom_xmlschemas
28765 #include "elfgcchack.h" 28906 #include "elfgcchack.h"
28766 #endif /* LIBXML_SCHEMAS_ENABLED */ 28907 #endif /* LIBXML_SCHEMAS_ENABLED */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698