Lines Matching +full:- +full:- +full:disable +full:- +full:dtd +full:- +full:validation
12 * - when types are redefined in includes, check that all
14 * -> need a type equality operation.
15 * - if we don't intend to use the schema for schemas, we
18 * - Eliminate item creation for: ??
21 * - For xsi-driven schema acquisition, augment the IDCs after every
25 * - Elimated item creation for: <restriction>, <extension>,
29 * - http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/0337.html
37 * All Group Limited (cos-all-limited)
43 * TODO: Actually this should go to component-level checks,
50 #pragma convert("ISO8859-1")
130 "http://www.w3.org/2001/XMLSchema-instance";
165 #define WXS_ELEM_TYPEDEF(e) (e)->subtypes
167 #define WXS_SUBST_HEAD(item) (item)->refDecl
171 #define WXS_ATTR_TYPEDEF(a) (a)->subtypes
175 #define WXS_ATTRUSE_DECL(au) (WXS_ATTR_USE_CAST (au))->attrDecl
179 #define WXS_ATTRUSE_DECL_NAME(au) (WXS_ATTRUSE_DECL(au))->name
181 #define WXS_ATTRUSE_DECL_TNS(au) (WXS_ATTRUSE_DECL(au))->targetNamespace
185 #define WXS_ATTR_GROUP_HAS_REFS(ag) ((WXS_ATTR_GROUP_CAST (ag))->flags & XML_SCHEMAS_ATTRGROUP_HAS_…
186 #define WXS_ATTR_GROUP_EXPANDED(ag) ((WXS_ATTR_GROUP_CAST (ag))->flags & XML_SCHEMAS_ATTRGROUP_WILD…
192 #define WXS_PARTICLE_TERM(p) (WXS_PARTICLE(p))->children
196 #define WXS_PARTICLE_MODEL(p) WXS_MODEL_GROUP_CAST WXS_PARTICLE(p)->children
200 #define WXS_MODELGROUPDEF_MODEL(mgd) (WXS_MODEL_GROUP_CAST (mgd))->children
205 (((i)->type == XML_SCHEMA_TYPE_SEQUENCE) || \
206 ((i)->type == XML_SCHEMA_TYPE_CHOICE) || \
207 ((i)->type == XML_SCHEMA_TYPE_ALL))
209 #define WXS_MODELGROUP_PARTICLE(mg) WXS_PTC_CAST (mg)->children
226 (( (i)->type == XML_SCHEMA_TYPE_BASIC) && \
227 ( (WXS_TYPE_CAST (i))->builtInType == XML_SCHEMAS_ANYTYPE))
230 (((i)->type == XML_SCHEMA_TYPE_COMPLEX) || \
231 ((i)->builtInType == XML_SCHEMAS_ANYTYPE))
234 ((item->type == XML_SCHEMA_TYPE_SIMPLE) || \
235 ((item->type == XML_SCHEMA_TYPE_BASIC) && \
236 (item->builtInType != XML_SCHEMAS_ANYTYPE)))
239 (((i)->type == XML_SCHEMA_TYPE_BASIC) && \
240 ((i)->builtInType == XML_SCHEMAS_ANYSIMPLETYPE))
243 ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)
246 ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION)
249 (((i)->type != XML_SCHEMA_TYPE_BASIC) && \
250 (((i)->flags & XML_SCHEMAS_TYPE_INTERNAL_RESOLVED) == 0))
253 (((item)->type != XML_SCHEMA_TYPE_BASIC) && \
254 (((item)->flags & XML_SCHEMAS_TYPE_FIXUP_1) == 0))
256 #define WXS_TYPE_IS_GLOBAL(t) ((t)->flags & XML_SCHEMAS_TYPE_GLOBAL)
258 #define WXS_TYPE_IS_LOCAL(t) (((t)->flags & XML_SCHEMAS_TYPE_GLOBAL) == 0)
263 ((item->contentType == XML_SCHEMA_CONTENT_MIXED) || \
264 (item->contentType == XML_SCHEMA_CONTENT_EMPTY) || \
265 (item->contentType == XML_SCHEMA_CONTENT_ELEMENTS))
268 ((item->contentType == XML_SCHEMA_CONTENT_SIMPLE) || \
269 (item->contentType == XML_SCHEMA_CONTENT_BASIC))
272 (item->contentType == XML_SCHEMA_CONTENT_MIXED)
275 (xmlSchemaIsParticleEmptiable(WXS_PTC_CAST (t)->subtypes))
277 #define WXS_TYPE_CONTENTTYPE(t) (t)->subtypes
279 #define WXS_TYPE_PARTICLE(t) WXS_PTC_CAST (t)->subtypes
285 #define WXS_LIST_ITEMTYPE(t) (t)->subtypes
287 #define WXS_IS_ATOMIC(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_ATOMIC)
289 #define WXS_IS_LIST(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_LIST)
291 #define WXS_IS_UNION(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_UNION)
295 #define WXS_CONSTRUCTOR(ctx) (ctx)->constructor
298 ( (WXS_CONSTRUCTOR((ctx))->buckets != NULL) && \
299 (WXS_CONSTRUCTOR((ctx))->buckets->nbItems > 0) )
301 #define WXS_SUBST_GROUPS(ctx) WXS_CONSTRUCTOR((ctx))->substGroups
303 #define WXS_BUCKET(ctx) WXS_CONSTRUCTOR((ctx))->bucket
305 #define WXS_SCHEMA(ctx) (ctx)->schema
308 xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->locals), 10, item)
311 xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->globals), 5, item)
314 xmlSchemaAddItemSize(&((ctx)->constructor->pending), 10, item)
318 #define WXS_ILIST_IS_EMPTY(l) ((l == NULL) || ((l)->nbItems == 0))
323 ((node != NULL) && (node->ns != NULL) && \
324 (xmlStrEqual(node->name, (const xmlChar *) type)) && \
325 (xmlStrEqual(node->ns->href, xmlSchemaNs)))
336 #define INODE_NILLED(item) (item->flags & XML_SCHEMA_ELEM_INFO_NILLED)
338 #define CAN_PARSE_SCHEMA(b) (((b)->doc != NULL) && ((b)->parsed == 0))
340 #define HFAILURE if (res == -1) goto exit_failure;
344 #define HSTOP(ctx) if ((ctx)->stop) goto exit;
437 xmlDocPtr doc; /* The schema node-tree. */
502 * The abstract base type for tree-like structured schema components.
519 * The abstract base type for tree-like structured schema components.
529 * The attr. decl. OR a QName-ref. to an attr. decl. OR
530 * a QName-ref. to an attribute group definition.
566 xmlSchemaBasicItemPtr target; /* The to-be-redefined component. */
567 const xmlChar *refName; /* The name of the to-be-redefined component. */
569 to-be-redefined comp. */
724 * The identity-constraint "field" and "selector" item, holding the
732 int index; /* an index position if significant for IDC key-sequences */
740 * The identity-constraint definition component.
760 * The augmented IDC information used for validation.
801 * The identity-constraint binding item of the [identity-constraint table].
808 xmlSchemaPSVIIDCNodePtr *nodeTable; /* array of key-sequences */
818 #define XPATH_STATE_OBJ_MATCHES -2
819 #define XPATH_STATE_OBJ_BLOCKED -3
835 int *history; /* list of (depth, state-id) tuples */
858 xmlSchemaPSVIIDCKeyPtr **keySeqs; /* the key-sequences of the target
861 xmlSchemaItemListPtr targets; /* list of target-node
894 xmlSchemaValPtr val; /* the pre-computed value if any */
953 xmlSchemaValPtr val; /* the pre-computed value if any */
970 * A Schemas validation context
1015 xmlSchemaPSVIIDCNodePtr *idcNodes; /* list of all IDC node-table entries*/
1019 xmlSchemaPSVIIDCKeyPtr *idcKeys; /* list of all IDC node-table entries */
1155 return(BAD_CAST "unique identity-constraint"); in xmlSchemaItemTypeToStr()
1158 return(BAD_CAST "key identity-constraint"); in xmlSchemaItemTypeToStr()
1161 return(BAD_CAST "keyref identity-constraint"); in xmlSchemaItemTypeToStr()
1183 switch (item->type) { in xmlSchemaGetComponentTypeStr()
1190 return(xmlSchemaItemTypeToStr(item->type)); in xmlSchemaGetComponentTypeStr()
1201 * one-to-one relationship between the XML Schema representation and
1207 switch (item->type) { in xmlSchemaGetComponentNode()
1209 return (((xmlSchemaElementPtr) item)->node); in xmlSchemaGetComponentNode()
1211 return (((xmlSchemaAttributePtr) item)->node); in xmlSchemaGetComponentNode()
1214 return (((xmlSchemaTypePtr) item)->node); in xmlSchemaGetComponentNode()
1217 return (((xmlSchemaWildcardPtr) item)->node); in xmlSchemaGetComponentNode()
1219 return (((xmlSchemaParticlePtr) item)->node); in xmlSchemaGetComponentNode()
1223 return (((xmlSchemaModelGroupPtr) item)->node); in xmlSchemaGetComponentNode()
1225 return (((xmlSchemaModelGroupDefPtr) item)->node); in xmlSchemaGetComponentNode()
1227 return (((xmlSchemaAttributeGroupPtr) item)->node); in xmlSchemaGetComponentNode()
1231 return (((xmlSchemaIDCPtr) item)->node); in xmlSchemaGetComponentNode()
1233 return(((xmlSchemaQNameRefPtr) item)->node); in xmlSchemaGetComponentNode()
1236 return (((xmlSchemaNotationPtr) item)->node); in xmlSchemaGetComponentNode()
1239 return (((xmlSchemaAttributeUsePtr) item)->node); in xmlSchemaGetComponentNode()
1255 switch (item->type) {
1257 return ((xmlSchemaBasicItemPtr) ((xmlSchemaElementPtr) item)->next);
1259 return ((xmlSchemaBasicItemPtr) ((xmlSchemaAttributePtr) item)->next);
1262 return ((xmlSchemaBasicItemPtr) ((xmlSchemaTypePtr) item)->next);
1267 return ((xmlSchemaBasicItemPtr) ((xmlSchemaParticlePtr) item)->next);
1275 return ((xmlSchemaBasicItemPtr) ((xmlSchemaAttributeGroupPtr) item)->next);
1279 return ((xmlSchemaBasicItemPtr) ((xmlSchemaIDCPtr) item)->next);
1324 return (xmlSchemaFormatQName(buf, ns->href, localName)); in xmlSchemaFormatQNameNs()
1332 switch (item->type) { in xmlSchemaGetComponentName()
1334 return (((xmlSchemaElementPtr) item)->name); in xmlSchemaGetComponentName()
1336 return (((xmlSchemaAttributePtr) item)->name); in xmlSchemaGetComponentName()
1338 return (((xmlSchemaAttributeGroupPtr) item)->name); in xmlSchemaGetComponentName()
1342 return (((xmlSchemaTypePtr) item)->name); in xmlSchemaGetComponentName()
1344 return (((xmlSchemaModelGroupDefPtr) item)->name); in xmlSchemaGetComponentName()
1348 return (((xmlSchemaIDCPtr) item)->name); in xmlSchemaGetComponentName()
1356 return (((xmlSchemaQNameRefPtr) item)->name); in xmlSchemaGetComponentName()
1358 return (((xmlSchemaNotationPtr) item)->name); in xmlSchemaGetComponentName()
1368 #define xmlSchemaGetQNameRefName(r) (WXS_QNAME_CAST (r))->name
1369 #define xmlSchemaGetQNameRefTargetNs(r) (WXS_QNAME_CAST (r))->targetNamespace
1374 return(((xmlSchemaQNameRefPtr) ref)->name);
1380 return(((xmlSchemaQNameRefPtr) ref)->targetNamespace);
1387 switch (item->type) { in xmlSchemaGetComponentTargetNs()
1389 return (((xmlSchemaElementPtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1391 return (((xmlSchemaAttributePtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1393 return (((xmlSchemaAttributeGroupPtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1398 return (((xmlSchemaTypePtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1400 return (((xmlSchemaModelGroupDefPtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1404 return (((xmlSchemaIDCPtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1413 return (((xmlSchemaQNameRefPtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1415 return (((xmlSchemaNotationPtr) item)->targetNamespace); in xmlSchemaGetComponentTargetNs()
1485 * Returns 0 if the value could be built and -1 in case of
1499 return (-1); in xmlSchemaGetCanonValueWhtspExt()
1520 if (xmlSchemaGetCanonValue(val, &value2) == -1) { in xmlSchemaGetCanonValueWhtspExt()
1548 return (-1); in xmlSchemaGetCanonValueWhtspExt()
1566 * 1a. If itemDes not NULL -> itemDes
1568 * -> itemDes + itemName
1569 * 2. If the preceding was NULL and (item not NULL) -> item
1570 * 3. If the preceding was NULL and (itemNode not NULL) -> itemNode
1594 switch (item->type) { in xmlSchemaFormatItemForReport()
1606 *buf = xmlStrcat(*buf, type->name); in xmlSchemaFormatItemForReport()
1613 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) { in xmlSchemaFormatItemForReport()
1626 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) { in xmlSchemaFormatItemForReport()
1628 *buf = xmlStrcat(*buf, type->name); in xmlSchemaFormatItemForReport()
1636 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) in xmlSchemaFormatItemForReport()
1641 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) { in xmlSchemaFormatItemForReport()
1643 *buf = xmlStrcat(*buf, type->name); in xmlSchemaFormatItemForReport()
1671 attr->targetNamespace, attr->name)); in xmlSchemaFormatItemForReport()
1686 elem->targetNamespace, elem->name)); in xmlSchemaFormatItemForReport()
1693 if (item->type == XML_SCHEMA_TYPE_IDC_UNIQUE) in xmlSchemaFormatItemForReport()
1695 else if (item->type == XML_SCHEMA_TYPE_IDC_KEY) in xmlSchemaFormatItemForReport()
1699 *buf = xmlStrcat(*buf, ((xmlSchemaIDCPtr) item)->name); in xmlSchemaFormatItemForReport()
1705 ((xmlSchemaWildcardPtr) item)->processContents)); in xmlSchemaFormatItemForReport()
1721 *buf = xmlStrcat(*buf, xmlSchemaFacetTypeToString(item->type)); in xmlSchemaFormatItemForReport()
1755 if (itemNode->type == XML_ATTRIBUTE_NODE) in xmlSchemaFormatItemForReport()
1756 elem = itemNode->parent; in xmlSchemaFormatItemForReport()
1760 if (elem->ns != NULL) { in xmlSchemaFormatItemForReport()
1762 xmlSchemaFormatQName(&str, elem->ns->href, elem->name)); in xmlSchemaFormatItemForReport()
1765 *buf = xmlStrcat(*buf, elem->name); in xmlSchemaFormatItemForReport()
1769 if ((itemNode != NULL) && (itemNode->type == XML_ATTRIBUTE_NODE)) { in xmlSchemaFormatItemForReport()
1771 if (itemNode->ns != NULL) { in xmlSchemaFormatItemForReport()
1773 itemNode->ns->href, itemNode->name)); in xmlSchemaFormatItemForReport()
1776 *buf = xmlStrcat(*buf, itemNode->name); in xmlSchemaFormatItemForReport()
1810 ws = xmlSchemaGetWhiteSpaceFacetValue(type->baseType); in xmlSchemaFormatFacetEnumSet()
1811 for (facet = type->facets; facet != NULL; facet = facet->next) { in xmlSchemaFormatFacetEnumSet()
1812 if (facet->type != XML_SCHEMA_FACET_ENUMERATION) in xmlSchemaFormatFacetEnumSet()
1815 res = xmlSchemaGetCanonValueWhtspExt(facet->val, in xmlSchemaFormatFacetEnumSet()
1817 if (res == -1) { in xmlSchemaFormatFacetEnumSet()
1845 type = type->baseType; in xmlSchemaFormatFacetEnumSet()
1846 } while ((type != NULL) && (type->type != XML_SCHEMA_TYPE_BASIC)); in xmlSchemaFormatFacetEnumSet()
1885 ctxt->nberrors++; in xmlSchemaPErrMemory()
1910 ctxt->nberrors++; in xmlSchemaPErr()
1911 ctxt->err = error; in xmlSchemaPErr()
1912 channel = ctxt->error; in xmlSchemaPErr()
1913 data = ctxt->errCtxt; in xmlSchemaPErr()
1914 schannel = ctxt->serror; in xmlSchemaPErr()
1976 ctxt->nberrors++; in xmlSchemaPErrExt()
1977 ctxt->err = error; in xmlSchemaPErrExt()
1978 channel = ctxt->error; in xmlSchemaPErrExt()
1979 data = ctxt->errCtxt; in xmlSchemaPErrExt()
1980 schannel = ctxt->serror; in xmlSchemaPErrExt()
2007 ctxt->nberrors++; in xmlSchemaVErrMemory()
2008 ctxt->err = XML_SCHEMAV_INTERNAL; in xmlSchemaVErrMemory()
2026 * @ctxt: the validation context
2037 * Handle a validation error
2051 if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) { in xmlSchemaErr4Line()
2056 vctxt->nberrors++; in xmlSchemaErr4Line()
2057 vctxt->err = error; in xmlSchemaErr4Line()
2058 channel = vctxt->error; in xmlSchemaErr4Line()
2060 channel = vctxt->warning; in xmlSchemaErr4Line()
2062 schannel = vctxt->serror; in xmlSchemaErr4Line()
2063 data = vctxt->errCtxt; in xmlSchemaErr4Line()
2071 (vctxt->depth >= 0) && in xmlSchemaErr4Line()
2072 (vctxt->inode != NULL)) { in xmlSchemaErr4Line()
2073 node = vctxt->inode->node; in xmlSchemaErr4Line()
2076 * Get filename and line if no node-tree. in xmlSchemaErr4Line()
2079 (vctxt->parserCtxt != NULL) && in xmlSchemaErr4Line()
2080 (vctxt->parserCtxt->input != NULL)) { in xmlSchemaErr4Line()
2081 file = vctxt->parserCtxt->input->filename; in xmlSchemaErr4Line()
2082 line = vctxt->parserCtxt->input->line; in xmlSchemaErr4Line()
2083 col = vctxt->parserCtxt->input->col; in xmlSchemaErr4Line()
2094 if (vctxt->doc != NULL) in xmlSchemaErr4Line()
2095 file = (const char *) vctxt->doc->URL; in xmlSchemaErr4Line()
2096 else if ((vctxt->parserCtxt != NULL) && in xmlSchemaErr4Line()
2097 (vctxt->parserCtxt->input != NULL)) in xmlSchemaErr4Line()
2098 file = vctxt->parserCtxt->input->filename; in xmlSchemaErr4Line()
2100 if (vctxt->locFunc != NULL) { in xmlSchemaErr4Line()
2104 vctxt->locFunc(vctxt->locCtxt, &f, &l); in xmlSchemaErr4Line()
2111 if ((file == NULL) && (vctxt->filename != NULL)) in xmlSchemaErr4Line()
2112 file = vctxt->filename; in xmlSchemaErr4Line()
2120 } else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) { in xmlSchemaErr4Line()
2123 pctxt->nberrors++; in xmlSchemaErr4Line()
2124 pctxt->err = error; in xmlSchemaErr4Line()
2125 channel = pctxt->error; in xmlSchemaErr4Line()
2127 channel = pctxt->warning; in xmlSchemaErr4Line()
2129 schannel = pctxt->serror; in xmlSchemaErr4Line()
2130 data = pctxt->errCtxt; in xmlSchemaErr4Line()
2144 * @ctxt: the validation context
2152 * Handle a validation error
2190 (node->type != XML_ELEMENT_NODE) && in xmlSchemaFormatNodeForError()
2191 (node->type != XML_ATTRIBUTE_NODE)) in xmlSchemaFormatNodeForError()
2205 if (node->type == XML_ATTRIBUTE_NODE) { in xmlSchemaFormatNodeForError()
2206 xmlNodePtr elem = node->parent; in xmlSchemaFormatNodeForError()
2209 if (elem->ns != NULL) in xmlSchemaFormatNodeForError()
2211 elem->ns->href, elem->name)); in xmlSchemaFormatNodeForError()
2214 NULL, elem->name)); in xmlSchemaFormatNodeForError()
2221 if (node->ns != NULL) in xmlSchemaFormatNodeForError()
2223 node->ns->href, node->name)); in xmlSchemaFormatNodeForError()
2226 NULL, node->name)); in xmlSchemaFormatNodeForError()
2229 } else if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) { in xmlSchemaFormatNodeForError()
2234 if (vctxt->inode->nodeType == XML_ATTRIBUTE_NODE) { in xmlSchemaFormatNodeForError()
2236 vctxt->elemInfos[vctxt->depth]; in xmlSchemaFormatNodeForError()
2240 ielem->nsName, ielem->localName)); in xmlSchemaFormatNodeForError()
2248 vctxt->inode->nsName, vctxt->inode->localName)); in xmlSchemaFormatNodeForError()
2251 } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { in xmlSchemaFormatNodeForError()
2299 if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) in xmlSchemaInternalErr2()
2302 else if (actxt->type == XML_SCHEMA_CTXT_PARSER) in xmlSchemaInternalErr2()
2342 (actxt->type == XML_SCHEMA_CTXT_PARSER)) { in xmlSchemaCustomErr4()
2410 error, NULL, idcNode->nodeLine, (const char *) msg, in xmlSchemaKeyrefErr()
2412 vctxt->nodeQNames->items[idcNode->nodeQNameID +1], in xmlSchemaKeyrefErr()
2413 vctxt->nodeQNames->items[idcNode->nodeQNameID]), in xmlSchemaKeyrefErr()
2424 return (node->type); in xmlSchemaEvalErrorNodeType()
2425 if ((actxt->type == XML_SCHEMA_CTXT_VALIDATOR) && in xmlSchemaEvalErrorNodeType()
2426 (((xmlSchemaValidCtxtPtr) actxt)->inode != NULL)) in xmlSchemaEvalErrorNodeType()
2427 return ( ((xmlSchemaValidCtxtPtr) actxt)->inode->nodeType); in xmlSchemaEvalErrorNodeType()
2428 return (-1); in xmlSchemaEvalErrorNodeType()
2434 switch (item->type) { in xmlSchemaIsGlobalItem()
2437 if (item->flags & XML_SCHEMAS_TYPE_GLOBAL) in xmlSchemaIsGlobalItem()
2443 if ( ((xmlSchemaElementPtr) item)->flags & in xmlSchemaIsGlobalItem()
2448 if ( ((xmlSchemaAttributePtr) item)->flags & in xmlSchemaIsGlobalItem()
2493 if (type->builtInType != 0) { in xmlSchemaSimpleTypeErr()
2495 str = xmlStrdup(type->name); in xmlSchemaSimpleTypeErr()
2497 const xmlChar *qName = xmlSchemaFormatQName(&str, type->targetNamespace, type->name); in xmlSchemaSimpleTypeErr()
2520 if (node->ns != NULL) in xmlSchemaFormatErrorNodeQName()
2521 return (xmlSchemaFormatQName(str, node->ns->href, node->name)); in xmlSchemaFormatErrorNodeQName()
2523 return (xmlSchemaFormatQName(str, NULL, node->name)); in xmlSchemaFormatErrorNodeQName()
2525 return (xmlSchemaFormatQName(str, ni->nsName, ni->localName)); in xmlSchemaFormatErrorNodeQName()
2597 localName = xmlStrncat(localName, BAD_CAST cur, end - cur); in xmlSchemaComplexTypeErr()
2621 nsName = xmlStrncat(nsName, BAD_CAST cur, end - cur); in xmlSchemaComplexTypeErr()
2634 if (i < nbval + nbneg -1) in xmlSchemaComplexTypeErr()
2670 facetType = facet->type; in xmlSchemaFacetErr()
2722 facet->value); in xmlSchemaFacetErr()
2727 facet->value); in xmlSchemaFacetErr()
2732 facet->value); in xmlSchemaFacetErr()
2737 facet->value); in xmlSchemaFacetErr()
2742 facet->value); in xmlSchemaFacetErr()
2747 facet->value); in xmlSchemaFacetErr()
2752 facet->value); in xmlSchemaFacetErr()
2754 msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not facet-valid.\n"); in xmlSchemaFacetErr()
2757 msg = xmlStrcat(msg, BAD_CAST "The value is not facet-valid.\n"); in xmlSchemaFacetErr()
2782 * @ctxt: the schema validation context
2816 * @ctxt: the schema validation context
2876 xmlSchemaFormatItemForReport(&des, NULL, ownerItem, attr->parent); in xmlSchemaPCustomAttrErr()
2878 xmlSchemaFormatItemForReport(ownerDes, NULL, ownerItem, attr->parent); in xmlSchemaPCustomAttrErr()
2890 BAD_CAST des, attr->name, (const xmlChar *) msg, NULL, NULL); in xmlSchemaPCustomAttrErr()
2914 xmlSchemaFormatNodeForError(&strA, ACTXT_CAST ctxt, attr->parent); in xmlSchemaPIllegalAttrErr()
2917 xmlSchemaFormatQNameNs(&strB, attr->ns, attr->name), in xmlSchemaPIllegalAttrErr()
3043 xmlSchemaFormatItemForReport(&des, NULL, WXS_BASIC_CAST type, type->node); in xmlSchemaPIllegalFacetAtomicErr()
3044 xmlSchemaPErrExt(ctxt, type->node, error, NULL, NULL, NULL, in xmlSchemaPIllegalFacetAtomicErr()
3047 BAD_CAST des, xmlSchemaFacetTypeToString(facet->type), in xmlSchemaPIllegalFacetAtomicErr()
3073 type->node); in xmlSchemaPIllegalFacetListUnionErr()
3074 xmlSchemaPErr(ctxt, type->node, error, in xmlSchemaPIllegalFacetListUnionErr()
3076 BAD_CAST des, xmlSchemaFacetTypeToString(facet->type)); in xmlSchemaPIllegalFacetListUnionErr()
3082 * @ctxt: the schema validation context
3100 xmlSchemaFormatItemForReport(&des, NULL, WXS_BASIC_CAST ownerItem, attr->parent); in xmlSchemaPMutualExclAttrErr()
3109 * @ctxt: the schema validation context
3117 * Reports a simple type validation error.
3140 if (node->type == XML_ATTRIBUTE_NODE) in xmlSchemaPSimpleTypeErr()
3160 if (type->builtInType != 0) { in xmlSchemaPSimpleTypeErr()
3162 str = xmlStrdup(type->name); in xmlSchemaPSimpleTypeErr()
3164 const xmlChar *qName = xmlSchemaFormatQName(&str, type->targetNamespace, type->name); in xmlSchemaPSimpleTypeErr()
3173 if (node->type == XML_ATTRIBUTE_NODE) in xmlSchemaPSimpleTypeErr()
3187 if (node->type == XML_ATTRIBUTE_NODE) in xmlSchemaPSimpleTypeErr()
3255 * Validation helper functions *
3268 * @ctxt: a schema validation context
3285 ret->dict = ctxt->dict; in xmlSchemaNewSchema()
3286 xmlDictReference(ret->dict); in xmlSchemaNewSchema()
3314 * @ctxt: a schema validation context
3332 ret->content = node; in xmlSchemaNewAnnot()
3354 if (list->items != NULL) { in xmlSchemaItemListClear()
3355 xmlFree(list->items); in xmlSchemaItemListClear()
3356 list->items = NULL; in xmlSchemaItemListClear()
3358 list->nbItems = 0; in xmlSchemaItemListClear()
3359 list->sizeItems = 0; in xmlSchemaItemListClear()
3365 if (list->items == NULL) { in xmlSchemaItemListAdd()
3366 list->items = (void **) xmlMalloc( in xmlSchemaItemListAdd()
3368 if (list->items == NULL) { in xmlSchemaItemListAdd()
3370 return(-1); in xmlSchemaItemListAdd()
3372 list->sizeItems = 20; in xmlSchemaItemListAdd()
3373 } else if (list->sizeItems <= list->nbItems) { in xmlSchemaItemListAdd()
3374 list->sizeItems *= 2; in xmlSchemaItemListAdd()
3375 list->items = (void **) xmlRealloc(list->items, in xmlSchemaItemListAdd()
3376 list->sizeItems * sizeof(void *)); in xmlSchemaItemListAdd()
3377 if (list->items == NULL) { in xmlSchemaItemListAdd()
3379 list->sizeItems = 0; in xmlSchemaItemListAdd()
3380 return(-1); in xmlSchemaItemListAdd()
3383 list->items[list->nbItems++] = item; in xmlSchemaItemListAdd()
3392 if (list->items == NULL) { in xmlSchemaItemListAddSize()
3395 list->items = (void **) xmlMalloc( in xmlSchemaItemListAddSize()
3397 if (list->items == NULL) { in xmlSchemaItemListAddSize()
3399 return(-1); in xmlSchemaItemListAddSize()
3401 list->sizeItems = initialSize; in xmlSchemaItemListAddSize()
3402 } else if (list->sizeItems <= list->nbItems) { in xmlSchemaItemListAddSize()
3403 list->sizeItems *= 2; in xmlSchemaItemListAddSize()
3404 list->items = (void **) xmlRealloc(list->items, in xmlSchemaItemListAddSize()
3405 list->sizeItems * sizeof(void *)); in xmlSchemaItemListAddSize()
3406 if (list->items == NULL) { in xmlSchemaItemListAddSize()
3408 list->sizeItems = 0; in xmlSchemaItemListAddSize()
3409 return(-1); in xmlSchemaItemListAddSize()
3412 list->items[list->nbItems++] = item; in xmlSchemaItemListAddSize()
3419 if (list->items == NULL) { in xmlSchemaItemListInsert()
3420 list->items = (void **) xmlMalloc( in xmlSchemaItemListInsert()
3422 if (list->items == NULL) { in xmlSchemaItemListInsert()
3424 return(-1); in xmlSchemaItemListInsert()
3426 list->sizeItems = 20; in xmlSchemaItemListInsert()
3427 } else if (list->sizeItems <= list->nbItems) { in xmlSchemaItemListInsert()
3428 list->sizeItems *= 2; in xmlSchemaItemListInsert()
3429 list->items = (void **) xmlRealloc(list->items, in xmlSchemaItemListInsert()
3430 list->sizeItems * sizeof(void *)); in xmlSchemaItemListInsert()
3431 if (list->items == NULL) { in xmlSchemaItemListInsert()
3433 list->sizeItems = 0; in xmlSchemaItemListInsert()
3434 return(-1); in xmlSchemaItemListInsert()
3440 if (idx >= list->nbItems) { in xmlSchemaItemListInsert()
3441 list->items[list->nbItems++] = item; in xmlSchemaItemListInsert()
3444 for (i = list->nbItems; i > idx; i--) in xmlSchemaItemListInsert()
3445 list->items[i] = list->items[i-1]; in xmlSchemaItemListInsert()
3446 list->items[idx] = item; in xmlSchemaItemListInsert()
3447 list->nbItems++; in xmlSchemaItemListInsert()
3459 if (list->items == NULL) {
3462 list->items = (void **) xmlMalloc(
3464 if (list->items == NULL) {
3466 return(-1);
3468 list->sizeItems = initialSize;
3469 } else if (list->sizeItems <= list->nbItems) {
3470 list->sizeItems *= 2;
3471 list->items = (void **) xmlRealloc(list->items,
3472 list->sizeItems * sizeof(void *));
3473 if (list->items == NULL) {
3475 list->sizeItems = 0;
3476 return(-1);
3482 if (idx >= list->nbItems) {
3483 list->items[list->nbItems++] = item;
3486 for (i = list->nbItems; i > idx; i--)
3487 list->items[i] = list->items[i-1];
3488 list->items[idx] = item;
3489 list->nbItems++;
3499 if ((list->items == NULL) || (idx >= list->nbItems)) { in xmlSchemaItemListRemove()
3502 return(-1); in xmlSchemaItemListRemove()
3505 if (list->nbItems == 1) { in xmlSchemaItemListRemove()
3507 xmlFree(list->items); in xmlSchemaItemListRemove()
3508 list->items = NULL; in xmlSchemaItemListRemove()
3509 list->nbItems = 0; in xmlSchemaItemListRemove()
3510 list->sizeItems = 0; in xmlSchemaItemListRemove()
3511 } else if (list->nbItems -1 == idx) { in xmlSchemaItemListRemove()
3512 list->nbItems--; in xmlSchemaItemListRemove()
3514 for (i = idx; i < list->nbItems -1; i++) in xmlSchemaItemListRemove()
3515 list->items[i] = list->items[i+1]; in xmlSchemaItemListRemove()
3516 list->nbItems--; in xmlSchemaItemListRemove()
3532 if (list->items != NULL) in xmlSchemaItemListFree()
3533 xmlFree(list->items); in xmlSchemaItemListFree()
3542 if (bucket->globals != NULL) { in xmlSchemaBucketFree()
3543 xmlSchemaComponentListFree(bucket->globals); in xmlSchemaBucketFree()
3544 xmlSchemaItemListFree(bucket->globals); in xmlSchemaBucketFree()
3546 if (bucket->locals != NULL) { in xmlSchemaBucketFree()
3547 xmlSchemaComponentListFree(bucket->locals); in xmlSchemaBucketFree()
3548 xmlSchemaItemListFree(bucket->locals); in xmlSchemaBucketFree()
3550 if (bucket->relations != NULL) { in xmlSchemaBucketFree()
3551 xmlSchemaSchemaRelationPtr prev, cur = bucket->relations; in xmlSchemaBucketFree()
3554 cur = cur->next; in xmlSchemaBucketFree()
3558 if ((! bucket->preserveDoc) && (bucket->doc != NULL)) { in xmlSchemaBucketFree()
3559 xmlFreeDoc(bucket->doc); in xmlSchemaBucketFree()
3561 if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) { in xmlSchemaBucketFree()
3562 if (WXS_IMPBUCKET(bucket)->schema != NULL) in xmlSchemaBucketFree()
3563 xmlSchemaFree(WXS_IMPBUCKET(bucket)->schema); in xmlSchemaBucketFree()
3582 if (WXS_CONSTRUCTOR(pctxt)->mainSchema == NULL) { in xmlSchemaBucketCreate()
3587 mainSchema = WXS_CONSTRUCTOR(pctxt)->mainSchema; in xmlSchemaBucketCreate()
3599 ret->targetNamespace = targetNamespace; in xmlSchemaBucketCreate()
3600 ret->type = type; in xmlSchemaBucketCreate()
3601 ret->globals = xmlSchemaItemListCreate(); in xmlSchemaBucketCreate()
3602 if (ret->globals == NULL) { in xmlSchemaBucketCreate()
3606 ret->locals = xmlSchemaItemListCreate(); in xmlSchemaBucketCreate()
3607 if (ret->locals == NULL) { in xmlSchemaBucketCreate()
3626 ret->type = XML_SCHEMA_SCHEMA_MAIN; in xmlSchemaBucketCreate()
3628 WXS_CONSTRUCTOR(pctxt)->mainBucket = ret; in xmlSchemaBucketCreate()
3629 WXS_IMPBUCKET(ret)->schema = mainSchema; in xmlSchemaBucketCreate()
3633 mainSchema->targetNamespace = targetNamespace; in xmlSchemaBucketCreate()
3645 WXS_IMPBUCKET(ret)->schema = xmlSchemaNewSchema(pctxt); in xmlSchemaBucketCreate()
3646 if (WXS_IMPBUCKET(ret)->schema == NULL) { in xmlSchemaBucketCreate()
3650 WXS_IMPBUCKET(ret)->schema->targetNamespace = targetNamespace; in xmlSchemaBucketCreate()
3660 if (mainSchema->schemasImports == NULL) { in xmlSchemaBucketCreate()
3661 mainSchema->schemasImports = xmlHashCreateDict(5, in xmlSchemaBucketCreate()
3662 WXS_CONSTRUCTOR(pctxt)->dict); in xmlSchemaBucketCreate()
3663 if (mainSchema->schemasImports == NULL) { in xmlSchemaBucketCreate()
3669 res = xmlHashAddEntry(mainSchema->schemasImports, in xmlSchemaBucketCreate()
3672 res = xmlHashAddEntry(mainSchema->schemasImports, in xmlSchemaBucketCreate()
3682 if (WXS_IS_BUCKET_IMPMAIN(WXS_CONSTRUCTOR(pctxt)->bucket->type)) in xmlSchemaBucketCreate()
3683 WXS_INCBUCKET(ret)->ownerImport = in xmlSchemaBucketCreate()
3684 WXS_IMPBUCKET(WXS_CONSTRUCTOR(pctxt)->bucket); in xmlSchemaBucketCreate()
3686 WXS_INCBUCKET(ret)->ownerImport = in xmlSchemaBucketCreate()
3687 WXS_INCBUCKET(WXS_CONSTRUCTOR(pctxt)->bucket)->ownerImport; in xmlSchemaBucketCreate()
3690 if (mainSchema->includes == NULL) { in xmlSchemaBucketCreate()
3691 mainSchema->includes = xmlSchemaItemListCreate(); in xmlSchemaBucketCreate()
3692 if (mainSchema->includes == NULL) { in xmlSchemaBucketCreate()
3697 xmlSchemaItemListAdd(mainSchema->includes, ret); in xmlSchemaBucketCreate()
3703 if (xmlSchemaItemListAdd(WXS_CONSTRUCTOR(pctxt)->buckets, ret) == -1) in xmlSchemaBucketCreate()
3714 return(-1); in xmlSchemaAddItemSize()
3731 if (annot->next == NULL) { in xmlSchemaFreeAnnot()
3738 annot = annot->next; in xmlSchemaFreeAnnot()
3769 if (attr->annot != NULL) in xmlSchemaFreeAttribute()
3770 xmlSchemaFreeAnnot(attr->annot); in xmlSchemaFreeAttribute()
3771 if (attr->defVal != NULL) in xmlSchemaFreeAttribute()
3772 xmlSchemaFreeValue(attr->defVal); in xmlSchemaFreeAttribute()
3787 if (use->annot != NULL) in xmlSchemaFreeAttributeUse()
3788 xmlSchemaFreeAnnot(use->annot); in xmlSchemaFreeAttributeUse()
3789 if (use->defVal != NULL) in xmlSchemaFreeAttributeUse()
3790 xmlSchemaFreeValue(use->defVal); in xmlSchemaFreeAttributeUse()
3820 next = set->next; in xmlSchemaFreeWildcardNsSet()
3837 if (wildcard->annot != NULL) in xmlSchemaFreeWildcard()
3838 xmlSchemaFreeAnnot(wildcard->annot); in xmlSchemaFreeWildcard()
3839 if (wildcard->nsSet != NULL) in xmlSchemaFreeWildcard()
3840 xmlSchemaFreeWildcardNsSet(wildcard->nsSet); in xmlSchemaFreeWildcard()
3841 if (wildcard->negNsSet != NULL) in xmlSchemaFreeWildcard()
3842 xmlFree(wildcard->negNsSet); in xmlSchemaFreeWildcard()
3857 if (attrGr->annot != NULL) in xmlSchemaFreeAttributeGroup()
3858 xmlSchemaFreeAnnot(attrGr->annot); in xmlSchemaFreeAttributeGroup()
3859 if (attrGr->attrUses != NULL) in xmlSchemaFreeAttributeGroup()
3860 xmlSchemaItemListFree(WXS_LIST_CAST attrGr->attrUses); in xmlSchemaFreeAttributeGroup()
3888 next = link->next; in xmlSchemaFreeTypeLinkList()
3899 next = sto->next; in xmlSchemaFreeIDCStateObjList()
3900 if (sto->history != NULL) in xmlSchemaFreeIDCStateObjList()
3901 xmlFree(sto->history); in xmlSchemaFreeIDCStateObjList()
3902 if (sto->xpathCtxt != NULL) in xmlSchemaFreeIDCStateObjList()
3903 xmlFreeStreamCtxt((xmlStreamCtxtPtr) sto->xpathCtxt); in xmlSchemaFreeIDCStateObjList()
3911 * @idc: a identity-constraint definition
3913 * Deallocates an identity-constraint definition.
3922 if (idcDef->annot != NULL) in xmlSchemaFreeIDC()
3923 xmlSchemaFreeAnnot(idcDef->annot); in xmlSchemaFreeIDC()
3925 if (idcDef->selector != NULL) { in xmlSchemaFreeIDC()
3926 if (idcDef->selector->xpathComp != NULL) in xmlSchemaFreeIDC()
3927 xmlFreePattern((xmlPatternPtr) idcDef->selector->xpathComp); in xmlSchemaFreeIDC()
3928 xmlFree(idcDef->selector); in xmlSchemaFreeIDC()
3931 if (idcDef->fields != NULL) { in xmlSchemaFreeIDC()
3932 cur = idcDef->fields; in xmlSchemaFreeIDC()
3935 cur = cur->next; in xmlSchemaFreeIDC()
3936 if (prev->xpathComp != NULL) in xmlSchemaFreeIDC()
3937 xmlFreePattern((xmlPatternPtr) prev->xpathComp); in xmlSchemaFreeIDC()
3955 if (elem->annot != NULL) in xmlSchemaFreeElement()
3956 xmlSchemaFreeAnnot(elem->annot); in xmlSchemaFreeElement()
3957 if (elem->contModel != NULL) in xmlSchemaFreeElement()
3958 xmlRegFreeRegexp(elem->contModel); in xmlSchemaFreeElement()
3959 if (elem->defVal != NULL) in xmlSchemaFreeElement()
3960 xmlSchemaFreeValue(elem->defVal); in xmlSchemaFreeElement()
3975 if (facet->val != NULL) in xmlSchemaFreeFacet()
3976 xmlSchemaFreeValue(facet->val); in xmlSchemaFreeFacet()
3977 if (facet->regexp != NULL) in xmlSchemaFreeFacet()
3978 xmlRegFreeRegexp(facet->regexp); in xmlSchemaFreeFacet()
3979 if (facet->annot != NULL) in xmlSchemaFreeFacet()
3980 xmlSchemaFreeAnnot(facet->annot); in xmlSchemaFreeFacet()
3995 if (type->annot != NULL) in xmlSchemaFreeType()
3996 xmlSchemaFreeAnnot(type->annot); in xmlSchemaFreeType()
3997 if (type->facets != NULL) { in xmlSchemaFreeType()
4000 facet = type->facets; in xmlSchemaFreeType()
4002 next = facet->next; in xmlSchemaFreeType()
4007 if (type->attrUses != NULL) in xmlSchemaFreeType()
4008 xmlSchemaItemListFree((xmlSchemaItemListPtr) type->attrUses); in xmlSchemaFreeType()
4009 if (type->memberTypes != NULL) in xmlSchemaFreeType()
4010 xmlSchemaFreeTypeLinkList(type->memberTypes); in xmlSchemaFreeType()
4011 if (type->facetSet != NULL) { in xmlSchemaFreeType()
4014 link = type->facetSet; in xmlSchemaFreeType()
4016 next = link->next; in xmlSchemaFreeType()
4021 if (type->contModel != NULL) in xmlSchemaFreeType()
4022 xmlRegFreeRegexp(type->contModel); in xmlSchemaFreeType()
4035 if (item->annot != NULL) in xmlSchemaFreeModelGroupDef()
4036 xmlSchemaFreeAnnot(item->annot); in xmlSchemaFreeModelGroupDef()
4049 if (item->annot != NULL) in xmlSchemaFreeModelGroup()
4050 xmlSchemaFreeAnnot(item->annot); in xmlSchemaFreeModelGroup()
4057 if ((list == NULL) || (list->nbItems == 0)) in xmlSchemaComponentListFree()
4061 xmlSchemaTreeItemPtr *items = (xmlSchemaTreeItemPtr *) list->items; in xmlSchemaComponentListFree()
4064 for (i = 0; i < list->nbItems; i++) { in xmlSchemaComponentListFree()
4068 switch (item->type) { in xmlSchemaComponentListFree()
4087 if (item->annot != NULL) in xmlSchemaComponentListFree()
4088 xmlSchemaFreeAnnot(item->annot); in xmlSchemaComponentListFree()
4129 list->nbItems = 0; in xmlSchemaComponentListFree()
4144 /* @volatiles is not used anymore :-/ */ in xmlSchemaFree()
4145 if (schema->volatiles != NULL) in xmlSchemaFree()
4152 if (schema->notaDecl != NULL) in xmlSchemaFree()
4153 xmlHashFree(schema->notaDecl, NULL); in xmlSchemaFree()
4154 if (schema->attrDecl != NULL) in xmlSchemaFree()
4155 xmlHashFree(schema->attrDecl, NULL); in xmlSchemaFree()
4156 if (schema->attrgrpDecl != NULL) in xmlSchemaFree()
4157 xmlHashFree(schema->attrgrpDecl, NULL); in xmlSchemaFree()
4158 if (schema->elemDecl != NULL) in xmlSchemaFree()
4159 xmlHashFree(schema->elemDecl, NULL); in xmlSchemaFree()
4160 if (schema->typeDecl != NULL) in xmlSchemaFree()
4161 xmlHashFree(schema->typeDecl, NULL); in xmlSchemaFree()
4162 if (schema->groupDecl != NULL) in xmlSchemaFree()
4163 xmlHashFree(schema->groupDecl, NULL); in xmlSchemaFree()
4164 if (schema->idcDef != NULL) in xmlSchemaFree()
4165 xmlHashFree(schema->idcDef, NULL); in xmlSchemaFree()
4167 if (schema->schemasImports != NULL) in xmlSchemaFree()
4168 xmlHashFree(schema->schemasImports, xmlSchemaBucketFreeEntry); in xmlSchemaFree()
4169 if (schema->includes != NULL) { in xmlSchemaFree()
4170 xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) schema->includes; in xmlSchemaFree()
4172 for (i = 0; i < list->nbItems; i++) { in xmlSchemaFree()
4173 xmlSchemaBucketFree((xmlSchemaBucketPtr) list->items[i]); in xmlSchemaFree()
4177 if (schema->annot != NULL) in xmlSchemaFree()
4178 xmlSchemaFreeAnnot(schema->annot); in xmlSchemaFree()
4181 xmlDictFree(schema->dict); in xmlSchemaFree()
4216 if (elem->flags & XML_SCHEMAS_ELEM_GLOBAL) in xmlSchemaElementDump()
4218 fprintf(output, ": '%s' ", elem->name); in xmlSchemaElementDump()
4223 if ((elem->minOccurs != 1) || (elem->maxOccurs != 1)) { in xmlSchemaElementDump()
4224 fprintf(output, " min %d ", elem->minOccurs); in xmlSchemaElementDump()
4225 if (elem->maxOccurs >= UNBOUNDED) in xmlSchemaElementDump()
4227 else if (elem->maxOccurs != 1) in xmlSchemaElementDump()
4228 fprintf(output, "max: %d\n", elem->maxOccurs); in xmlSchemaElementDump()
4236 if ((elem->flags & XML_SCHEMAS_ELEM_NILLABLE) || in xmlSchemaElementDump()
4237 (elem->flags & XML_SCHEMAS_ELEM_ABSTRACT) || in xmlSchemaElementDump()
4238 (elem->flags & XML_SCHEMAS_ELEM_FIXED) || in xmlSchemaElementDump()
4239 (elem->flags & XML_SCHEMAS_ELEM_DEFAULT)) { in xmlSchemaElementDump()
4241 if (elem->flags & XML_SCHEMAS_ELEM_FIXED) in xmlSchemaElementDump()
4243 if (elem->flags & XML_SCHEMAS_ELEM_DEFAULT) in xmlSchemaElementDump()
4245 if (elem->flags & XML_SCHEMAS_ELEM_ABSTRACT) in xmlSchemaElementDump()
4247 if (elem->flags & XML_SCHEMAS_ELEM_NILLABLE) in xmlSchemaElementDump()
4254 if (elem->value != NULL) in xmlSchemaElementDump()
4255 fprintf(output, " value: '%s'\n", elem->value); in xmlSchemaElementDump()
4259 if (elem->namedType != NULL) { in xmlSchemaElementDump()
4260 fprintf(output, " type: '%s' ", elem->namedType); in xmlSchemaElementDump()
4261 if (elem->namedTypeNs != NULL) in xmlSchemaElementDump()
4262 fprintf(output, "ns '%s'\n", elem->namedTypeNs); in xmlSchemaElementDump()
4265 } else if (elem->subtypes != NULL) { in xmlSchemaElementDump()
4269 xmlSchemaTypeDump(elem->subtypes, output); in xmlSchemaElementDump()
4274 if (elem->substGroup != NULL) { in xmlSchemaElementDump()
4275 fprintf(output, " substitutionGroup: '%s' ", elem->substGroup); in xmlSchemaElementDump()
4276 if (elem->substGroupNs != NULL) in xmlSchemaElementDump()
4277 fprintf(output, "ns '%s'\n", elem->substGroupNs); in xmlSchemaElementDump()
4298 content = xmlNodeGetContent(annot->content); in xmlSchemaAnnotDump()
4328 if (particle->children == NULL) { in xmlSchemaContentModelDump()
4332 term = particle->children; in xmlSchemaContentModelDump()
4336 switch (term->type) { in xmlSchemaContentModelDump()
4339 ((xmlSchemaElementPtr)term)->targetNamespace, in xmlSchemaContentModelDump()
4340 ((xmlSchemaElementPtr)term)->name)); in xmlSchemaContentModelDump()
4360 if (particle->minOccurs != 1) in xmlSchemaContentModelDump()
4361 fprintf(output, " min: %d", particle->minOccurs); in xmlSchemaContentModelDump()
4362 if (particle->maxOccurs >= UNBOUNDED) in xmlSchemaContentModelDump()
4364 else if (particle->maxOccurs != 1) in xmlSchemaContentModelDump()
4365 fprintf(output, " max: %d", particle->maxOccurs); in xmlSchemaContentModelDump()
4368 ((term->type == XML_SCHEMA_TYPE_SEQUENCE) || in xmlSchemaContentModelDump()
4369 (term->type == XML_SCHEMA_TYPE_CHOICE) || in xmlSchemaContentModelDump()
4370 (term->type == XML_SCHEMA_TYPE_ALL)) && in xmlSchemaContentModelDump()
4371 (term->children != NULL)) { in xmlSchemaContentModelDump()
4372 xmlSchemaContentModelDump((xmlSchemaParticlePtr) term->children, in xmlSchemaContentModelDump()
4375 if (particle->next != NULL) in xmlSchemaContentModelDump()
4376 xmlSchemaContentModelDump((xmlSchemaParticlePtr) particle->next, in xmlSchemaContentModelDump()
4397 if ((uses == NULL) || (uses->nbItems == 0)) in xmlSchemaAttrUsesDump()
4401 for (i = 0; i < uses->nbItems; i++) { in xmlSchemaAttrUsesDump()
4402 use = uses->items[i]; in xmlSchemaAttrUsesDump()
4403 if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { in xmlSchemaAttrUsesDump()
4406 name = prohib->name; in xmlSchemaAttrUsesDump()
4407 tns = prohib->targetNamespace; in xmlSchemaAttrUsesDump()
4408 } else if (use->type == XML_SCHEMA_EXTRA_QNAMEREF) { in xmlSchemaAttrUsesDump()
4411 name = ref->name; in xmlSchemaAttrUsesDump()
4412 tns = ref->targetNamespace; in xmlSchemaAttrUsesDump()
4439 if (type->name != NULL) in xmlSchemaTypeDump()
4440 fprintf(output, "'%s' ", type->name); in xmlSchemaTypeDump()
4443 if (type->targetNamespace != NULL) in xmlSchemaTypeDump()
4444 fprintf(output, "ns '%s' ", type->targetNamespace); in xmlSchemaTypeDump()
4445 switch (type->type) { in xmlSchemaTypeDump()
4474 fprintf(output, "[unknown type %d] ", type->type); in xmlSchemaTypeDump()
4478 switch (type->contentType) { in xmlSchemaTypeDump()
4505 if (type->base != NULL) { in xmlSchemaTypeDump()
4506 fprintf(output, " base type: '%s'", type->base); in xmlSchemaTypeDump()
4507 if (type->baseNs != NULL) in xmlSchemaTypeDump()
4508 fprintf(output, " ns '%s'\n", type->baseNs); in xmlSchemaTypeDump()
4512 if (type->attrUses != NULL) in xmlSchemaTypeDump()
4513 xmlSchemaAttrUsesDump(type->attrUses, output); in xmlSchemaTypeDump()
4514 if (type->annot != NULL) in xmlSchemaTypeDump()
4515 xmlSchemaAnnotDump(output, type->annot); in xmlSchemaTypeDump()
4517 if ((type->type == XML_SCHEMA_TYPE_COMPLEX) && in xmlSchemaTypeDump()
4518 (type->subtypes != NULL)) { in xmlSchemaTypeDump()
4519 xmlSchemaContentModelDump((xmlSchemaParticlePtr) type->subtypes, in xmlSchemaTypeDump()
4549 if (schema->name != NULL) in xmlSchemaDump()
4550 fprintf(output, "%s, ", schema->name); in xmlSchemaDump()
4553 if (schema->targetNamespace != NULL) in xmlSchemaDump()
4554 fprintf(output, "%s", (const char *) schema->targetNamespace); in xmlSchemaDump()
4558 if (schema->annot != NULL) in xmlSchemaDump()
4559 xmlSchemaAnnotDump(output, schema->annot); in xmlSchemaDump()
4560 xmlHashScan(schema->typeDecl, xmlSchemaTypeDumpEntry, output); in xmlSchemaDump()
4561 xmlHashScanFull(schema->elemDecl, xmlSchemaElementDump, output); in xmlSchemaDump()
4567 * @vctxt: the WXS validation context
4592 bind->definition), bind->nbNodes); in xmlSchemaDebugDumpIDCTable()
4594 for (i = 0; i < bind->nbNodes; i++) { in xmlSchemaDebugDumpIDCTable()
4595 tab = bind->nodeTable[i]; in xmlSchemaDebugDumpIDCTable()
4597 for (j = 0; j < bind->definition->nbFields; j++) { in xmlSchemaDebugDumpIDCTable()
4598 key = tab->keys[j]; in xmlSchemaDebugDumpIDCTable()
4599 if ((key != NULL) && (key->val != NULL)) { in xmlSchemaDebugDumpIDCTable()
4600 res = xmlSchemaGetCanonValue(key->val, &value); in xmlSchemaDebugDumpIDCTable()
4604 fprintf(output, "CANON-VALUE-FAILED "); in xmlSchemaDebugDumpIDCTable()
4614 if (bind->dupls && bind->dupls->nbItems) { in xmlSchemaDebugDumpIDCTable()
4615 fprintf(output, "IDC: dupls (%d):\n", bind->dupls->nbItems); in xmlSchemaDebugDumpIDCTable()
4616 for (i = 0; i < bind->dupls->nbItems; i++) { in xmlSchemaDebugDumpIDCTable()
4617 tab = bind->dupls->items[i]; in xmlSchemaDebugDumpIDCTable()
4619 for (j = 0; j < bind->definition->nbFields; j++) { in xmlSchemaDebugDumpIDCTable()
4620 key = tab->keys[j]; in xmlSchemaDebugDumpIDCTable()
4621 if ((key != NULL) && (key->val != NULL)) { in xmlSchemaDebugDumpIDCTable()
4622 res = xmlSchemaGetCanonValue(key->val, &value); in xmlSchemaDebugDumpIDCTable()
4626 fprintf(output, "CANON-VALUE-FAILED "); in xmlSchemaDebugDumpIDCTable()
4637 bind = bind->next; in xmlSchemaDebugDumpIDCTable()
4666 prop = node->properties; in xmlSchemaGetPropNode()
4668 if ((prop->ns == NULL) && xmlStrEqual(prop->name, BAD_CAST name)) in xmlSchemaGetPropNode()
4670 prop = prop->next; in xmlSchemaGetPropNode()
4693 prop = node->properties; in xmlSchemaGetPropNodeNs()
4695 if ((prop->ns != NULL) && in xmlSchemaGetPropNodeNs()
4696 xmlStrEqual(prop->name, BAD_CAST name) && in xmlSchemaGetPropNodeNs()
4697 xmlStrEqual(prop->ns->href, BAD_CAST uri)) in xmlSchemaGetPropNodeNs()
4699 prop = prop->next; in xmlSchemaGetPropNodeNs()
4713 ret = xmlDictLookup(ctxt->dict, val, -1); in xmlSchemaGetNodeContent()
4744 ret = xmlDictLookup(ctxt->dict, val, -1); in xmlSchemaGetProp()
4756 if (xmlStrEqual(nsName, schema->targetNamespace)) { \
4757 ret = xmlHashLookup(schema->slot, name); \
4760 if (xmlHashSize(schema->schemasImports) > 1) { \
4763 import = xmlHashLookup(schema->schemasImports, \
4766 import = xmlHashLookup(schema->schemasImports, nsName); \
4769 ret = xmlHashLookup(import->schema->slot, name); \
4824 /* First try the built-in types. */ in xmlSchemaGetType()
4832 * than the built-in types. in xmlSchemaGetType()
4910 if ((ret != NULL) && (ret->redef != NULL)) { in xmlSchemaGetAttributeGroup()
4912 ret = ret->redef; in xmlSchemaGetAttributeGroup()
5030 (((n)->type == XML_TEXT_NODE) && (xmlSchemaIsBlank((n)->content, -1)))
5035 * @len: the length of the string or -1
5056 len--; in xmlSchemaIsBlank()
5062 #define WXS_COMP_NAME(c, t) ((t) (c))->name
5063 #define WXS_COMP_TNS(c, t) ((t) (c))->targetNamespace
5079 if ((bucket->globals == NULL) || in xmlSchemaFindRedefCompInGraph()
5080 (bucket->globals->nbItems == 0)) in xmlSchemaFindRedefCompInGraph()
5085 for (i = 0; i < bucket->globals->nbItems; i++) { in xmlSchemaFindRedefCompInGraph()
5086 ret = bucket->globals->items[i]; in xmlSchemaFindRedefCompInGraph()
5087 if (ret->type == type) { in xmlSchemaFindRedefCompInGraph()
5126 if (bucket->relations != NULL) { in xmlSchemaFindRedefCompInGraph()
5127 xmlSchemaSchemaRelationPtr rel = bucket->relations; in xmlSchemaFindRedefCompInGraph()
5133 bucket->flags |= XML_SCHEMA_BUCKET_MARKED; in xmlSchemaFindRedefCompInGraph()
5135 if ((rel->bucket != NULL) && in xmlSchemaFindRedefCompInGraph()
5136 ((rel->bucket->flags & XML_SCHEMA_BUCKET_MARKED) == 0)) { in xmlSchemaFindRedefCompInGraph()
5137 ret = xmlSchemaFindRedefCompInGraph(rel->bucket, in xmlSchemaFindRedefCompInGraph()
5142 rel = rel->next; in xmlSchemaFindRedefCompInGraph()
5144 bucket->flags ^= XML_SCHEMA_BUCKET_MARKED; in xmlSchemaFindRedefCompInGraph()
5176 ret->type = XML_SCHEMA_TYPE_NOTATION; in xmlSchemaAddNotation()
5177 ret->name = name; in xmlSchemaAddNotation()
5178 ret->targetNamespace = nsName; in xmlSchemaAddNotation()
5180 * ret->node = node;*/ in xmlSchemaAddNotation()
5213 ret->type = XML_SCHEMA_TYPE_ATTRIBUTE; in xmlSchemaAddAttribute()
5214 ret->node = node; in xmlSchemaAddAttribute()
5215 ret->name = name; in xmlSchemaAddAttribute()
5216 ret->targetNamespace = nsName; in xmlSchemaAddAttribute()
5253 ret->type = XML_SCHEMA_TYPE_ATTRIBUTE_USE; in xmlSchemaAddAttributeUse()
5254 ret->node = node; in xmlSchemaAddAttributeUse()
5283 ret->item = item; in xmlSchemaAddRedef()
5284 ret->targetBucket = targetBucket; in xmlSchemaAddRedef()
5285 ret->refName = refName; in xmlSchemaAddRedef()
5286 ret->refTargetNs = refTargetNs; in xmlSchemaAddRedef()
5287 if (WXS_CONSTRUCTOR(pctxt)->redefs == NULL) in xmlSchemaAddRedef()
5288 WXS_CONSTRUCTOR(pctxt)->redefs = ret; in xmlSchemaAddRedef()
5290 WXS_CONSTRUCTOR(pctxt)->lastRedef->next = ret; in xmlSchemaAddRedef()
5291 WXS_CONSTRUCTOR(pctxt)->lastRedef = ret; in xmlSchemaAddRedef()
5327 ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP; in xmlSchemaAddAttributeGroupDefinition()
5328 ret->name = name; in xmlSchemaAddAttributeGroupDefinition()
5329 ret->targetNamespace = nsName; in xmlSchemaAddAttributeGroupDefinition()
5330 ret->node = node; in xmlSchemaAddAttributeGroupDefinition()
5333 ret->flags |= XML_SCHEMAS_ATTRGROUP_GLOBAL; in xmlSchemaAddAttributeGroupDefinition()
5334 if (pctxt->isRedefine) { in xmlSchemaAddAttributeGroupDefinition()
5335 pctxt->redef = xmlSchemaAddRedef(pctxt, pctxt->redefined, in xmlSchemaAddAttributeGroupDefinition()
5337 if (pctxt->redef == NULL) { in xmlSchemaAddAttributeGroupDefinition()
5341 pctxt->redefCounter = 0; in xmlSchemaAddAttributeGroupDefinition()
5376 ret->type = XML_SCHEMA_TYPE_ELEMENT; in xmlSchemaAddElement()
5377 ret->name = name; in xmlSchemaAddElement()
5378 ret->targetNamespace = nsName; in xmlSchemaAddElement()
5379 ret->node = node; in xmlSchemaAddElement()
5418 ret->type = type; in xmlSchemaAddType()
5419 ret->name = name; in xmlSchemaAddType()
5420 ret->targetNamespace = nsName; in xmlSchemaAddType()
5421 ret->node = node; in xmlSchemaAddType()
5423 if (ctxt->isRedefine) { in xmlSchemaAddType()
5424 ctxt->redef = xmlSchemaAddRedef(ctxt, ctxt->redefined, in xmlSchemaAddType()
5426 if (ctxt->redef == NULL) { in xmlSchemaAddType()
5430 ctxt->redefCounter = 0; in xmlSchemaAddType()
5454 ret->node = NULL; in xmlSchemaNewQNameRef()
5455 ret->type = XML_SCHEMA_EXTRA_QNAMEREF; in xmlSchemaNewQNameRef()
5456 ret->name = refName; in xmlSchemaNewQNameRef()
5457 ret->targetNamespace = refNs; in xmlSchemaNewQNameRef()
5458 ret->item = NULL; in xmlSchemaNewQNameRef()
5459 ret->itemType = refType; in xmlSchemaNewQNameRef()
5480 ret->type = XML_SCHEMA_EXTRA_ATTR_USE_PROHIB; in xmlSchemaAddAttributeUseProhib()
5517 ret->type = type; in xmlSchemaAddModelGroup()
5518 ret->node = node; in xmlSchemaAddModelGroup()
5558 ret->type = XML_SCHEMA_TYPE_PARTICLE; in xmlSchemaAddParticle()
5559 ret->annot = NULL; in xmlSchemaAddParticle()
5560 ret->node = node; in xmlSchemaAddParticle()
5561 ret->minOccurs = min; in xmlSchemaAddParticle()
5562 ret->maxOccurs = max; in xmlSchemaAddParticle()
5563 ret->next = NULL; in xmlSchemaAddParticle()
5564 ret->children = NULL; in xmlSchemaAddParticle()
5578 * @ctxt: a schema validation context
5605 ret->name = name; in xmlSchemaAddModelGroupDefinition()
5606 ret->type = XML_SCHEMA_TYPE_GROUP; in xmlSchemaAddModelGroupDefinition()
5607 ret->node = node; in xmlSchemaAddModelGroupDefinition()
5608 ret->targetNamespace = nsName; in xmlSchemaAddModelGroupDefinition()
5610 if (ctxt->isRedefine) { in xmlSchemaAddModelGroupDefinition()
5611 ctxt->redef = xmlSchemaAddRedef(ctxt, ctxt->redefined, in xmlSchemaAddModelGroupDefinition()
5613 if (ctxt->redef == NULL) { in xmlSchemaAddModelGroupDefinition()
5617 ctxt->redefCounter = 0; in xmlSchemaAddModelGroupDefinition()
5626 * @ctxt: a schema validation context
5643 ret->value = NULL; in xmlSchemaNewWildcardNsConstraint()
5644 ret->next = NULL; in xmlSchemaNewWildcardNsConstraint()
5661 "allocating an identity-constraint definition", NULL); in xmlSchemaAddIDC()
5666 ret->targetNamespace = nsName; in xmlSchemaAddIDC()
5667 ret->name = name; in xmlSchemaAddIDC()
5668 ret->type = category; in xmlSchemaAddIDC()
5669 ret->node = node; in xmlSchemaAddIDC()
5682 * @ctxt: a schema validation context
5705 ret->type = type; in xmlSchemaAddWildcard()
5706 ret->node = node; in xmlSchemaAddWildcard()
5716 if (group->members != NULL) in xmlSchemaSubstGroupFree()
5717 xmlSchemaItemListFree(group->members); in xmlSchemaSubstGroupFree()
5735 WXS_SUBST_GROUPS(pctxt) = xmlHashCreateDict(10, pctxt->dict); in xmlSchemaSubstGroupAdd()
5747 ret->head = head; in xmlSchemaSubstGroupAdd()
5749 ret->members = xmlSchemaItemListCreate(); in xmlSchemaSubstGroupAdd()
5750 if (ret->members == NULL) { in xmlSchemaSubstGroupAdd()
5756 head->name, head->targetNamespace, ret) != 0) { in xmlSchemaSubstGroupAdd()
5772 head->name, head->targetNamespace)); in xmlSchemaSubstGroupGet()
5794 return (-1); in xmlSchemaAddElementSubstitutionMember()
5800 return(-1); in xmlSchemaAddElementSubstitutionMember()
5801 if (xmlSchemaItemListAdd(substGroup->members, member) == -1) in xmlSchemaAddElementSubstitutionMember()
5802 return(-1); in xmlSchemaAddElementSubstitutionMember()
5827 * if not valid and -1 if an internal error occurs.
5852 return (ctxt->err); in xmlSchemaPValAttrNodeQNameValue()
5854 return (-1); in xmlSchemaPValAttrNodeQNameValue()
5857 ns = xmlSearchNs(attr->doc, attr->parent, NULL); in xmlSchemaPValAttrNodeQNameValue()
5859 *uri = xmlDictLookup(ctxt->dict, ns->href, -1); in xmlSchemaPValAttrNodeQNameValue()
5860 else if (schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS) { in xmlSchemaPValAttrNodeQNameValue()
5867 *uri = ctxt->targetNamespace; in xmlSchemaPValAttrNodeQNameValue()
5869 *local = xmlDictLookup(ctxt->dict, value, -1); in xmlSchemaPValAttrNodeQNameValue()
5876 *local = xmlDictLookup(ctxt->dict, *local, -1); in xmlSchemaPValAttrNodeQNameValue()
5877 pref = xmlDictLookup(ctxt->dict, value, len); in xmlSchemaPValAttrNodeQNameValue()
5878 ns = xmlSearchNs(attr->doc, attr->parent, pref); in xmlSchemaPValAttrNodeQNameValue()
5886 return (ctxt->err); in xmlSchemaPValAttrNodeQNameValue()
5888 *uri = xmlDictLookup(ctxt->dict, ns->href, -1); in xmlSchemaPValAttrNodeQNameValue()
5908 * if not valid and -1 if an internal error occurs.
5939 * if not valid and -1 if an internal error occurs.
5974 * if not valid and -1 if an internal error occurs.
5988 * NOTE: the IDness might have already be declared in the DTD in xmlSchemaPValAttrNodeID()
5990 if (attr->atype != XML_ATTRIBUTE_ID) { in xmlSchemaPValAttrNodeID()
6003 res = xmlAddID(NULL, attr->doc, value, attr); in xmlSchemaPValAttrNodeID()
6013 attr->atype = XML_ATTRIBUTE_ID; in xmlSchemaPValAttrNodeID()
6047 * @ctxt: a schema validation context
6076 return (UNBOUNDED); /* encoding it with -1 might be another option */ in xmlGetMaxOccurs()
6091 ret = ret * 10 + (*cur - '0'); in xmlGetMaxOccurs()
6099 if ((*cur != 0) || (ret < min) || ((max != -1) && (ret > max))) { in xmlGetMaxOccurs()
6112 * @ctxt: a schema validation context
6143 ret = ret * 10 + (*cur - '0'); in xmlGetMinOccurs()
6151 if ((*cur != 0) || (ret < min) || ((max != -1) && (ret > max))) { in xmlGetMinOccurs()
6164 * @ctxt: a schema validation context
6210 * @ctxt: a schema validation context
6294 * @type: the built-in type to be validated against
6296 * Validates a value against the given built-in type.
6297 * This one is intended to be used internally for validation
6301 * number otherwise and -1 in case of an internal or API error.
6318 return (-1); in xmlSchemaPValAttrNodeValue()
6319 if (type->type != XML_SCHEMA_TYPE_BASIC) { in xmlSchemaPValAttrNodeValue()
6321 "the given type is not a built-in type"); in xmlSchemaPValAttrNodeValue()
6322 return (-1); in xmlSchemaPValAttrNodeValue()
6324 switch (type->builtInType) { in xmlSchemaPValAttrNodeValue()
6335 "validation using the given type is not supported while " in xmlSchemaPValAttrNodeValue()
6337 return (-1); in xmlSchemaPValAttrNodeValue()
6346 return (-1); in xmlSchemaPValAttrNodeValue()
6366 * @type: the built-in type to be validated against
6369 * Extracts and validates a value against the given built-in type.
6370 * This one is intended to be used internally for validation
6374 * number otherwise and -1 in case of an internal or API error.
6386 return (-1); in xmlSchemaPValAttrNode()
6405 * @type: the built-in type to be validated against
6408 * Extracts and validates a value against the given built-in type.
6409 * This one is intended to be used internally for validation
6413 * number otherwise and -1 in case of an internal or API error.
6428 return (-1); in xmlSchemaPValAttr()
6430 if (type->type != XML_SCHEMA_TYPE_BASIC) { in xmlSchemaPValAttr()
6436 "type '%s' is not a built-in type.\n", in xmlSchemaPValAttr()
6437 type->name, NULL); in xmlSchemaPValAttr()
6438 return (-1); in xmlSchemaPValAttr()
6458 if (xmlStrEqual(pctxt->targetNamespace, namespaceName)) in xmlSchemaCheckReference()
6465 if (WXS_BUCKET(pctxt)->relations != NULL) { in xmlSchemaCheckReference()
6468 rel = WXS_BUCKET(pctxt)->relations; in xmlSchemaCheckReference()
6470 if (WXS_IS_BUCKET_IMPMAIN(rel->type) && in xmlSchemaCheckReference()
6471 xmlStrEqual(namespaceName, rel->importNamespace)) in xmlSchemaCheckReference()
6473 rel = rel->next; in xmlSchemaCheckReference()
6500 * @ctxt: a schema validation context
6530 return(-1); in xmlSchemaParseLocalAttributes()
6532 if (xmlSchemaItemListAddSize(*list, 2, item) == -1) in xmlSchemaParseLocalAttributes()
6533 return(-1); in xmlSchemaParseLocalAttributes()
6535 *child = (*child)->next; in xmlSchemaParseLocalAttributes()
6542 * @ctxt: a schema validation context
6549 * Returns -1 in case of error, 0 if the declaration is improper and
6565 * {any attributes with non-schema namespace . . .}> in xmlSchemaParseAnnotation()
6574 attr = node->properties; in xmlSchemaParseAnnotation()
6576 if (((attr->ns == NULL) && in xmlSchemaParseAnnotation()
6577 (!xmlStrEqual(attr->name, BAD_CAST "id"))) || in xmlSchemaParseAnnotation()
6578 ((attr->ns != NULL) && in xmlSchemaParseAnnotation()
6579 xmlStrEqual(attr->ns->href, xmlSchemaNs))) { in xmlSchemaParseAnnotation()
6584 attr = attr->next; in xmlSchemaParseAnnotation()
6590 child = node->children; in xmlSchemaParseAnnotation()
6596 * {any attributes with non-schema namespace . . .}> in xmlSchemaParseAnnotation()
6599 attr = child->properties; in xmlSchemaParseAnnotation()
6601 if (((attr->ns == NULL) && in xmlSchemaParseAnnotation()
6602 (!xmlStrEqual(attr->name, BAD_CAST "source"))) || in xmlSchemaParseAnnotation()
6603 ((attr->ns != NULL) && in xmlSchemaParseAnnotation()
6604 xmlStrEqual(attr->ns->href, xmlSchemaNs))) { in xmlSchemaParseAnnotation()
6609 attr = attr->next; in xmlSchemaParseAnnotation()
6613 child = child->next; in xmlSchemaParseAnnotation()
6618 * {any attributes with non-schema namespace . . .}> in xmlSchemaParseAnnotation()
6621 attr = child->properties; in xmlSchemaParseAnnotation()
6623 if (attr->ns == NULL) { in xmlSchemaParseAnnotation()
6624 if (!xmlStrEqual(attr->name, BAD_CAST "source")) { in xmlSchemaParseAnnotation()
6629 if (xmlStrEqual(attr->ns->href, xmlSchemaNs) || in xmlSchemaParseAnnotation()
6630 (xmlStrEqual(attr->name, BAD_CAST "lang") && in xmlSchemaParseAnnotation()
6631 (!xmlStrEqual(attr->ns->href, XML_XML_NAMESPACE)))) { in xmlSchemaParseAnnotation()
6637 attr = attr->next; in xmlSchemaParseAnnotation()
6646 child = child->next; in xmlSchemaParseAnnotation()
6653 child = child->next; in xmlSchemaParseAnnotation()
6662 * @ctxt: a schema validation context
6687 facet->node = node; in xmlSchemaParseFacet()
6691 "Facet %s has no value\n", node->name, NULL); in xmlSchemaParseFacet()
6696 facet->type = XML_SCHEMA_FACET_MININCLUSIVE; in xmlSchemaParseFacet()
6698 facet->type = XML_SCHEMA_FACET_MINEXCLUSIVE; in xmlSchemaParseFacet()
6700 facet->type = XML_SCHEMA_FACET_MAXINCLUSIVE; in xmlSchemaParseFacet()
6702 facet->type = XML_SCHEMA_FACET_MAXEXCLUSIVE; in xmlSchemaParseFacet()
6704 facet->type = XML_SCHEMA_FACET_TOTALDIGITS; in xmlSchemaParseFacet()
6706 facet->type = XML_SCHEMA_FACET_FRACTIONDIGITS; in xmlSchemaParseFacet()
6708 facet->type = XML_SCHEMA_FACET_PATTERN; in xmlSchemaParseFacet()
6710 facet->type = XML_SCHEMA_FACET_ENUMERATION; in xmlSchemaParseFacet()
6712 facet->type = XML_SCHEMA_FACET_WHITESPACE; in xmlSchemaParseFacet()
6714 facet->type = XML_SCHEMA_FACET_LENGTH; in xmlSchemaParseFacet()
6716 facet->type = XML_SCHEMA_FACET_MAXLENGTH; in xmlSchemaParseFacet()
6718 facet->type = XML_SCHEMA_FACET_MINLENGTH; in xmlSchemaParseFacet()
6721 "Unknown facet type %s\n", node->name, NULL); in xmlSchemaParseFacet()
6726 facet->value = value; in xmlSchemaParseFacet()
6727 if ((facet->type != XML_SCHEMA_FACET_PATTERN) && in xmlSchemaParseFacet()
6728 (facet->type != XML_SCHEMA_FACET_ENUMERATION)) { in xmlSchemaParseFacet()
6734 facet->fixed = 1; in xmlSchemaParseFacet()
6737 child = node->children; in xmlSchemaParseFacet()
6740 facet->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseFacet()
6741 child = child->next; in xmlSchemaParseFacet()
6746 node->name, NULL); in xmlSchemaParseFacet()
6762 * if something is not valid and -1 if an internal error occurs.
6779 wildc->processContents = XML_SCHEMAS_ANY_STRICT; in xmlSchemaParseWildcardNs()
6781 wildc->processContents = XML_SCHEMAS_ANY_SKIP; in xmlSchemaParseWildcardNs()
6783 wildc->processContents = XML_SCHEMAS_ANY_LAX; in xmlSchemaParseWildcardNs()
6790 wildc->processContents = XML_SCHEMAS_ANY_STRICT; in xmlSchemaParseWildcardNs()
6799 wildc->any = 1; in xmlSchemaParseWildcardNs()
6801 wildc->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); in xmlSchemaParseWildcardNs()
6802 if (wildc->negNsSet == NULL) { in xmlSchemaParseWildcardNs()
6803 return (-1); in xmlSchemaParseWildcardNs()
6805 wildc->negNsSet->value = ctxt->targetNamespace; in xmlSchemaParseWildcardNs()
6818 nsItem = xmlStrndup(cur, end - cur); in xmlSchemaParseWildcardNs()
6831 dictnsItem = ctxt->targetNamespace; in xmlSchemaParseWildcardNs()
6840 dictnsItem = xmlDictLookup(ctxt->dict, nsItem, -1); in xmlSchemaParseWildcardNs()
6845 tmp = wildc->nsSet; in xmlSchemaParseWildcardNs()
6847 if (dictnsItem == tmp->value) in xmlSchemaParseWildcardNs()
6849 tmp = tmp->next; in xmlSchemaParseWildcardNs()
6855 return (-1); in xmlSchemaParseWildcardNs()
6857 tmp->value = dictnsItem; in xmlSchemaParseWildcardNs()
6858 tmp->next = NULL; in xmlSchemaParseWildcardNs()
6859 if (wildc->nsSet == NULL) in xmlSchemaParseWildcardNs()
6860 wildc->nsSet = tmp; in xmlSchemaParseWildcardNs()
6862 lastNs->next = tmp; in xmlSchemaParseWildcardNs()
6920 * @ctxt: a schema validation context
6947 attr = node->properties; in xmlSchemaParseAny()
6949 if (attr->ns == NULL) { in xmlSchemaParseAny()
6950 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseAny()
6951 (!xmlStrEqual(attr->name, BAD_CAST "minOccurs")) && in xmlSchemaParseAny()
6952 (!xmlStrEqual(attr->name, BAD_CAST "maxOccurs")) && in xmlSchemaParseAny()
6953 (!xmlStrEqual(attr->name, BAD_CAST "namespace")) && in xmlSchemaParseAny()
6954 (!xmlStrEqual(attr->name, BAD_CAST "processContents"))) { in xmlSchemaParseAny()
6958 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseAny()
6962 attr = attr->next; in xmlSchemaParseAny()
6970 min = xmlGetMinOccurs(ctxt, node, 0, -1, 1, in xmlSchemaParseAny()
6983 child = node->children; in xmlSchemaParseAny()
6986 child = child->next; in xmlSchemaParseAny()
7007 particle->annot = annot; in xmlSchemaParseAny()
7008 particle->children = (xmlSchemaTreeItemPtr) wild; in xmlSchemaParseAny()
7015 * @ctxt: a schema validation context
7040 ctxt->targetNamespace, node); in xmlSchemaParseNotation()
7045 child = node->children; in xmlSchemaParseNotation()
7047 ret->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseNotation()
7048 child = child->next; in xmlSchemaParseNotation()
7062 * @ctxt: a schema validation context
7090 attr = node->properties; in xmlSchemaParseAnyAttribute()
7092 if (attr->ns == NULL) { in xmlSchemaParseAnyAttribute()
7093 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseAnyAttribute()
7094 (!xmlStrEqual(attr->name, BAD_CAST "namespace")) && in xmlSchemaParseAnyAttribute()
7095 (!xmlStrEqual(attr->name, BAD_CAST "processContents"))) { in xmlSchemaParseAnyAttribute()
7099 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseAnyAttribute()
7103 attr = attr->next; in xmlSchemaParseAnyAttribute()
7114 child = node->children; in xmlSchemaParseAnyAttribute()
7116 ret->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseAnyAttribute()
7117 child = child->next; in xmlSchemaParseAnyAttribute()
7132 * @ctxt: a schema validation context
7175 nberrors = pctxt->nberrors; in xmlSchemaParseLocalAttribute()
7179 attr = node->properties; in xmlSchemaParseLocalAttribute()
7181 if (attr->ns == NULL) { in xmlSchemaParseLocalAttribute()
7183 if (xmlStrEqual(attr->name, BAD_CAST "id")) { in xmlSchemaParseLocalAttribute()
7186 } else if (xmlStrEqual(attr->name, BAD_CAST "ref")) { in xmlSchemaParseLocalAttribute()
7190 if (xmlStrEqual(attr->name, BAD_CAST "name")) { in xmlSchemaParseLocalAttribute()
7192 } else if (xmlStrEqual(attr->name, BAD_CAST "id")) { in xmlSchemaParseLocalAttribute()
7195 } else if (xmlStrEqual(attr->name, BAD_CAST "type")) { in xmlSchemaParseLocalAttribute()
7199 } else if (xmlStrEqual(attr->name, BAD_CAST "form")) { in xmlSchemaParseLocalAttribute()
7207 ns = pctxt->targetNamespace; in xmlSchemaParseLocalAttribute()
7219 if (xmlStrEqual(attr->name, BAD_CAST "use")) { in xmlSchemaParseLocalAttribute()
7237 } else if (xmlStrEqual(attr->name, BAD_CAST "default")) { in xmlSchemaParseLocalAttribute()
7251 } else if (xmlStrEqual(attr->name, BAD_CAST "fixed")) { in xmlSchemaParseLocalAttribute()
7266 } else if (! xmlStrEqual(attr->ns->href, xmlSchemaNs)) in xmlSchemaParseLocalAttribute()
7273 attr = attr->next; in xmlSchemaParseLocalAttribute()
7293 if (nberrors != pctxt->nberrors) in xmlSchemaParseLocalAttribute()
7299 if ((! hasForm) && (schema->flags & XML_SCHEMAS_QUALIF_ATTR)) in xmlSchemaParseLocalAttribute()
7300 ns = pctxt->targetNamespace; in xmlSchemaParseLocalAttribute()
7343 use->occurs = occurs; in xmlSchemaParseLocalAttribute()
7351 attrDecl->typeName = tmpName; in xmlSchemaParseLocalAttribute()
7352 attrDecl->typeNs = tmpNs; in xmlSchemaParseLocalAttribute()
7354 use->attrDecl = attrDecl; in xmlSchemaParseLocalAttribute()
7359 attrDecl->defValue = defValue; in xmlSchemaParseLocalAttribute()
7361 attrDecl->flags |= XML_SCHEMAS_ATTR_FIXED; in xmlSchemaParseLocalAttribute()
7376 use->occurs = occurs; in xmlSchemaParseLocalAttribute()
7388 use->attrDecl = WXS_ATTR_CAST ref; in xmlSchemaParseLocalAttribute()
7393 use->defValue = defValue; in xmlSchemaParseLocalAttribute()
7395 use->flags |= XML_SCHEMA_ATTR_USE_FIXED; in xmlSchemaParseLocalAttribute()
7402 child = node->children; in xmlSchemaParseLocalAttribute()
7408 child = child->next; in xmlSchemaParseLocalAttribute()
7446 for (i = 0; i < uses->nbItems; i++) { in xmlSchemaParseLocalAttribute()
7447 use = uses->items[i]; in xmlSchemaParseLocalAttribute()
7448 if ((use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) && in xmlSchemaParseLocalAttribute()
7449 (tmpName == (WXS_ATTR_PROHIB_CAST use)->name) && in xmlSchemaParseLocalAttribute()
7450 (tmpNs == (WXS_ATTR_PROHIB_CAST use)->targetNamespace)) in xmlSchemaParseLocalAttribute()
7471 prohib->node = node; in xmlSchemaParseLocalAttribute()
7472 prohib->name = tmpName; in xmlSchemaParseLocalAttribute()
7473 prohib->targetNamespace = tmpNs; in xmlSchemaParseLocalAttribute()
7486 use->annot = xmlSchemaParseAnnotation(pctxt, child, 1); in xmlSchemaParseLocalAttribute()
7487 child = child->next; in xmlSchemaParseLocalAttribute()
7509 if (WXS_ATTRUSE_DECL(use)->typeName != NULL) { in xmlSchemaParseLocalAttribute()
7521 child = child->next; in xmlSchemaParseLocalAttribute()
7584 if (xmlStrEqual(pctxt->targetNamespace, xmlSchemaInstanceNs)) { in xmlSchemaParseGlobalAttribute()
7592 pctxt->targetNamespace, node, 1); in xmlSchemaParseGlobalAttribute()
7595 ret->flags |= XML_SCHEMAS_ATTR_GLOBAL; in xmlSchemaParseGlobalAttribute()
7600 attr = node->properties; in xmlSchemaParseGlobalAttribute()
7602 if (attr->ns == NULL) { in xmlSchemaParseGlobalAttribute()
7603 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseGlobalAttribute()
7604 (!xmlStrEqual(attr->name, BAD_CAST "default")) && in xmlSchemaParseGlobalAttribute()
7605 (!xmlStrEqual(attr->name, BAD_CAST "fixed")) && in xmlSchemaParseGlobalAttribute()
7606 (!xmlStrEqual(attr->name, BAD_CAST "name")) && in xmlSchemaParseGlobalAttribute()
7607 (!xmlStrEqual(attr->name, BAD_CAST "type"))) in xmlSchemaParseGlobalAttribute()
7612 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseGlobalAttribute()
7616 attr = attr->next; in xmlSchemaParseGlobalAttribute()
7619 node, "type", &ret->typeNs, &ret->typeName); in xmlSchemaParseGlobalAttribute()
7625 ret->defValue = xmlSchemaGetProp(pctxt, node, "fixed"); in xmlSchemaParseGlobalAttribute()
7626 if (ret->defValue != NULL) in xmlSchemaParseGlobalAttribute()
7627 ret->flags |= XML_SCHEMAS_ATTR_FIXED; in xmlSchemaParseGlobalAttribute()
7637 if (ret->flags & XML_SCHEMAS_ATTR_FIXED) { in xmlSchemaParseGlobalAttribute()
7641 ret->defValue = xmlSchemaGetNodeContent(pctxt, (xmlNodePtr) attr); in xmlSchemaParseGlobalAttribute()
7646 child = node->children; in xmlSchemaParseGlobalAttribute()
7648 ret->annot = xmlSchemaParseAnnotation(pctxt, child, 1); in xmlSchemaParseGlobalAttribute()
7649 child = child->next; in xmlSchemaParseGlobalAttribute()
7652 if (ret->typeName != NULL) { in xmlSchemaParseGlobalAttribute()
7662 ret->subtypes = xmlSchemaParseSimpleType(pctxt, schema, child, 0); in xmlSchemaParseGlobalAttribute()
7663 child = child->next; in xmlSchemaParseGlobalAttribute()
7675 * @ctxt: a schema validation context
7714 attr = node->properties; in xmlSchemaParseAttributeGroupRef()
7716 if (attr->ns == NULL) { in xmlSchemaParseAttributeGroupRef()
7717 if ((!xmlStrEqual(attr->name, BAD_CAST "ref")) && in xmlSchemaParseAttributeGroupRef()
7718 (!xmlStrEqual(attr->name, BAD_CAST "id"))) in xmlSchemaParseAttributeGroupRef()
7723 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseAttributeGroupRef()
7727 attr = attr->next; in xmlSchemaParseAttributeGroupRef()
7735 child = node->children; in xmlSchemaParseAttributeGroupRef()
7741 child = child->next; in xmlSchemaParseAttributeGroupRef()
7753 if (pctxt->isRedefine && pctxt->redef && in xmlSchemaParseAttributeGroupRef()
7754 (pctxt->redef->item->type == in xmlSchemaParseAttributeGroupRef()
7756 (ref == pctxt->redef->refName) && in xmlSchemaParseAttributeGroupRef()
7757 (refNs == pctxt->redef->refTargetNs)) in xmlSchemaParseAttributeGroupRef()
7760 * SPEC src-redefine: in xmlSchemaParseAttributeGroupRef()
7766 if (pctxt->redefCounter != 0) { in xmlSchemaParseAttributeGroupRef()
7778 pctxt->redefCounter++; in xmlSchemaParseAttributeGroupRef()
7787 ret->node = node; in xmlSchemaParseAttributeGroupRef()
7788 pctxt->redef->reference = WXS_BASIC_CAST ret; in xmlSchemaParseAttributeGroupRef()
7791 * Create a QName-reference helper component. We will substitute this in xmlSchemaParseAttributeGroupRef()
7799 ret->node = node; in xmlSchemaParseAttributeGroupRef()
7808 * @pctxt: a schema validation context
7847 name, pctxt->targetNamespace, node); in xmlSchemaParseAttributeGroupDefinition()
7853 attr = node->properties; in xmlSchemaParseAttributeGroupDefinition()
7855 if (attr->ns == NULL) { in xmlSchemaParseAttributeGroupDefinition()
7856 if ((!xmlStrEqual(attr->name, BAD_CAST "name")) && in xmlSchemaParseAttributeGroupDefinition()
7857 (!xmlStrEqual(attr->name, BAD_CAST "id"))) in xmlSchemaParseAttributeGroupDefinition()
7862 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseAttributeGroupDefinition()
7866 attr = attr->next; in xmlSchemaParseAttributeGroupDefinition()
7873 child = node->children; in xmlSchemaParseAttributeGroupDefinition()
7875 ret->annot = xmlSchemaParseAnnotation(pctxt, child, 1); in xmlSchemaParseAttributeGroupDefinition()
7876 child = child->next; in xmlSchemaParseAttributeGroupDefinition()
7882 (xmlSchemaItemListPtr *) &(ret->attrUses), in xmlSchemaParseAttributeGroupDefinition()
7883 XML_SCHEMA_TYPE_ATTRIBUTEGROUP, &hasRefs) == -1) in xmlSchemaParseAttributeGroupDefinition()
7886 ret->flags |= XML_SCHEMAS_ATTRGROUP_HAS_REFS; in xmlSchemaParseAttributeGroupDefinition()
7891 ret->attributeWildcard = xmlSchemaParseAnyAttribute(pctxt, in xmlSchemaParseAttributeGroupDefinition()
7893 child = child->next; in xmlSchemaParseAttributeGroupDefinition()
7959 return (-1); in xmlSchemaPValAttrBlockFinal()
7963 if (flagAll != -1) in xmlSchemaPValAttrBlockFinal()
7966 if (flagExtension != -1) in xmlSchemaPValAttrBlockFinal()
7968 if (flagRestriction != -1) in xmlSchemaPValAttrBlockFinal()
7970 if (flagSubstitution != -1) in xmlSchemaPValAttrBlockFinal()
7972 if (flagList != -1) in xmlSchemaPValAttrBlockFinal()
7974 if (flagUnion != -1) in xmlSchemaPValAttrBlockFinal()
7989 item = xmlStrndup(cur, end - cur); in xmlSchemaPValAttrBlockFinal()
7991 if (flagExtension != -1) { in xmlSchemaPValAttrBlockFinal()
7997 if (flagRestriction != -1) { in xmlSchemaPValAttrBlockFinal()
8003 if (flagSubstitution != -1) { in xmlSchemaPValAttrBlockFinal()
8009 if (flagList != -1) { in xmlSchemaPValAttrBlockFinal()
8015 if (flagUnion != -1) { in xmlSchemaPValAttrBlockFinal()
8041 * c-selector-xpath: in xmlSchemaCheckCSelectorXPath()
8048 xmlSchemaPErr(ctxt, idc->node, in xmlSchemaCheckCSelectorXPath()
8052 return (-1); in xmlSchemaCheckCSelectorXPath()
8055 node = idc->node; in xmlSchemaCheckCSelectorXPath()
8058 if (selector->xpath == NULL) { in xmlSchemaCheckCSelectorXPath()
8072 * TODO: We need the array of in-scope namespaces for compilation. in xmlSchemaCheckCSelectorXPath()
8079 nsList = xmlGetNsList(attr->doc, attr->parent); in xmlSchemaCheckCSelectorXPath()
8095 return (-1); in xmlSchemaCheckCSelectorXPath()
8098 nsArray[2 * i] = nsList[i]->href; in xmlSchemaCheckCSelectorXPath()
8099 nsArray[2 * i + 1] = nsList[i]->prefix; in xmlSchemaCheckCSelectorXPath()
8108 selector->xpathComp = (void *) xmlPatterncompile(selector->xpath, in xmlSchemaCheckCSelectorXPath()
8111 selector->xpathComp = (void *) xmlPatterncompile(selector->xpath, in xmlSchemaCheckCSelectorXPath()
8116 if (selector->xpathComp == NULL) { in xmlSchemaCheckCSelectorXPath()
8122 "compiled", selector->xpath); in xmlSchemaCheckCSelectorXPath()
8130 xmlSchemaAnnotPtr cur = item->annot; \
8131 if (item->annot == NULL) { \
8132 item->annot = annot; \
8135 cur = item->annot; \
8136 if (cur->next != NULL) { \
8137 cur = cur->next; \
8139 cur->next = annot;
8156 switch (annItem->type) { in xmlSchemaAddAnnotation()
8239 * @ctxt: a schema validation context
8243 * Parses a XML Schema identity-contraint definition's
8246 * Returns the parsed identity-constraint definition.
8261 attr = node->properties; in xmlSchemaParseIDCSelectorAndField()
8263 if (attr->ns == NULL) { in xmlSchemaParseIDCSelectorAndField()
8264 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseIDCSelectorAndField()
8265 (!xmlStrEqual(attr->name, BAD_CAST "xpath"))) { in xmlSchemaParseIDCSelectorAndField()
8269 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseIDCSelectorAndField()
8273 attr = attr->next; in xmlSchemaParseIDCSelectorAndField()
8281 "allocating a 'selector' of an identity-constraint definition", in xmlSchemaParseIDCSelectorAndField()
8296 item->xpath = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); in xmlSchemaParseIDCSelectorAndField()
8302 isField) == -1) { in xmlSchemaParseIDCSelectorAndField()
8316 child = node->children; in xmlSchemaParseIDCSelectorAndField()
8323 child = child->next; in xmlSchemaParseIDCSelectorAndField()
8337 * @ctxt: a schema validation context
8341 * Parses a XML Schema identity-contraint definition.
8343 * Returns the parsed identity-constraint definition.
8361 attr = node->properties; in xmlSchemaParseIDC()
8363 if (attr->ns == NULL) { in xmlSchemaParseIDC()
8364 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseIDC()
8365 (!xmlStrEqual(attr->name, BAD_CAST "name")) && in xmlSchemaParseIDC()
8367 (!xmlStrEqual(attr->name, BAD_CAST "refer")))) { in xmlSchemaParseIDC()
8371 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseIDC()
8375 attr = attr->next; in xmlSchemaParseIDC()
8413 item->ref = xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_IDC_KEY, in xmlSchemaParseIDC()
8415 if (item->ref == NULL) in xmlSchemaParseIDC()
8419 &(item->ref->targetNamespace), in xmlSchemaParseIDC()
8420 &(item->ref->name)); in xmlSchemaParseIDC()
8422 item->ref->targetNamespace); in xmlSchemaParseIDC()
8428 child = node->children; in xmlSchemaParseIDC()
8430 item->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseIDC()
8431 child = child->next; in xmlSchemaParseIDC()
8444 item->selector = xmlSchemaParseIDCSelectorAndField(ctxt, in xmlSchemaParseIDC()
8446 child = child->next; in xmlSchemaParseIDC()
8455 field->index = item->nbFields; in xmlSchemaParseIDC()
8456 item->nbFields++; in xmlSchemaParseIDC()
8458 lastField->next = field; in xmlSchemaParseIDC()
8460 item->fields = field; in xmlSchemaParseIDC()
8463 child = child->next; in xmlSchemaParseIDC()
8484 * @ctxt: a schema validation context
8517 * a reference - even if there's a "name" attribute; this seems to be more in xmlSchemaParseElement()
8533 child = node->children; in xmlSchemaParseElement()
8536 child = child->next; in xmlSchemaParseElement()
8546 min = xmlGetMinOccurs(ctxt, node, 0, -1, 1, "xs:nonNegativeInteger"); in xmlSchemaParseElement()
8553 /* ret->flags |= XML_SCHEMAS_ELEM_REF; */ in xmlSchemaParseElement()
8577 attr = node->properties; in xmlSchemaParseElement()
8579 if (attr->ns == NULL) { in xmlSchemaParseElement()
8580 if (xmlStrEqual(attr->name, BAD_CAST "ref") || in xmlSchemaParseElement()
8581 xmlStrEqual(attr->name, BAD_CAST "name") || in xmlSchemaParseElement()
8582 xmlStrEqual(attr->name, BAD_CAST "id") || in xmlSchemaParseElement()
8583 xmlStrEqual(attr->name, BAD_CAST "maxOccurs") || in xmlSchemaParseElement()
8584 xmlStrEqual(attr->name, BAD_CAST "minOccurs")) in xmlSchemaParseElement()
8586 attr = attr->next; in xmlSchemaParseElement()
8597 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseElement()
8601 attr = attr->next; in xmlSchemaParseElement()
8619 particle->children = (xmlSchemaTreeItemPtr) refer; in xmlSchemaParseElement()
8620 particle->annot = annot; in xmlSchemaParseElement()
8643 ns = ctxt->targetNamespace; in xmlSchemaParseElement()
8649 ns = ctxt->targetNamespace; in xmlSchemaParseElement()
8657 } else if (schema->flags & XML_SCHEMAS_QUALIF_ELEM) in xmlSchemaParseElement()
8658 ns = ctxt->targetNamespace; in xmlSchemaParseElement()
8667 attr = node->properties; in xmlSchemaParseElement()
8669 if (attr->ns == NULL) { in xmlSchemaParseElement()
8670 if ((!xmlStrEqual(attr->name, BAD_CAST "name")) && in xmlSchemaParseElement()
8671 (!xmlStrEqual(attr->name, BAD_CAST "type")) && in xmlSchemaParseElement()
8672 (!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseElement()
8673 (!xmlStrEqual(attr->name, BAD_CAST "default")) && in xmlSchemaParseElement()
8674 (!xmlStrEqual(attr->name, BAD_CAST "fixed")) && in xmlSchemaParseElement()
8675 (!xmlStrEqual(attr->name, BAD_CAST "block")) && in xmlSchemaParseElement()
8676 (!xmlStrEqual(attr->name, BAD_CAST "nillable"))) in xmlSchemaParseElement()
8679 if ((!xmlStrEqual(attr->name, BAD_CAST "maxOccurs")) && in xmlSchemaParseElement()
8680 (!xmlStrEqual(attr->name, BAD_CAST "minOccurs")) && in xmlSchemaParseElement()
8681 (!xmlStrEqual(attr->name, BAD_CAST "form"))) in xmlSchemaParseElement()
8686 } else if ((!xmlStrEqual(attr->name, BAD_CAST "final")) && in xmlSchemaParseElement()
8687 (!xmlStrEqual(attr->name, BAD_CAST "abstract")) && in xmlSchemaParseElement()
8688 (!xmlStrEqual(attr->name, BAD_CAST "substitutionGroup"))) { in xmlSchemaParseElement()
8694 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseElement()
8699 attr = attr->next; in xmlSchemaParseElement()
8708 decl->flags |= XML_SCHEMAS_ELEM_GLOBAL; in xmlSchemaParseElement()
8709 decl->flags |= XML_SCHEMAS_ELEM_TOPLEVEL; in xmlSchemaParseElement()
8712 &(decl->substGroupNs), &(decl->substGroup)); in xmlSchemaParseElement()
8714 decl->flags |= XML_SCHEMAS_ELEM_ABSTRACT; in xmlSchemaParseElement()
8720 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_EXTENSION) in xmlSchemaParseElement()
8721 decl->flags |= XML_SCHEMAS_ELEM_FINAL_EXTENSION; in xmlSchemaParseElement()
8722 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION) in xmlSchemaParseElement()
8723 decl->flags |= XML_SCHEMAS_ELEM_FINAL_RESTRICTION; in xmlSchemaParseElement()
8726 if (xmlSchemaPValAttrBlockFinal(attrValue, &(decl->flags), in xmlSchemaParseElement()
8727 -1, in xmlSchemaParseElement()
8729 XML_SCHEMAS_ELEM_FINAL_RESTRICTION, -1, -1, -1) != 0) { in xmlSchemaParseElement()
8746 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION) in xmlSchemaParseElement()
8747 decl->flags |= XML_SCHEMAS_ELEM_BLOCK_RESTRICTION; in xmlSchemaParseElement()
8748 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION) in xmlSchemaParseElement()
8749 decl->flags |= XML_SCHEMAS_ELEM_BLOCK_EXTENSION; in xmlSchemaParseElement()
8750 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION) in xmlSchemaParseElement()
8751 decl->flags |= XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION; in xmlSchemaParseElement()
8754 if (xmlSchemaPValAttrBlockFinal(attrValue, &(decl->flags), in xmlSchemaParseElement()
8755 -1, in xmlSchemaParseElement()
8758 XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION, -1, -1) != 0) { in xmlSchemaParseElement()
8768 decl->flags |= XML_SCHEMAS_ELEM_NILLABLE; in xmlSchemaParseElement()
8774 &(decl->namedTypeNs), &(decl->namedType)); in xmlSchemaParseElement()
8776 attr, decl->namedTypeNs); in xmlSchemaParseElement()
8778 decl->value = xmlSchemaGetProp(ctxt, node, "default"); in xmlSchemaParseElement()
8782 if (decl->value != NULL) { in xmlSchemaParseElement()
8791 decl->flags |= XML_SCHEMAS_ELEM_FIXED; in xmlSchemaParseElement()
8792 decl->value = fixed; in xmlSchemaParseElement()
8804 if (decl->namedType != NULL) { in xmlSchemaParseElement()
8812 child = child->next; in xmlSchemaParseElement()
8819 if (decl->namedType != NULL) { in xmlSchemaParseElement()
8827 child = child->next; in xmlSchemaParseElement()
8833 XML_SCHEMA_TYPE_IDC_UNIQUE, decl->targetNamespace); in xmlSchemaParseElement()
8836 XML_SCHEMA_TYPE_IDC_KEY, decl->targetNamespace); in xmlSchemaParseElement()
8839 XML_SCHEMA_TYPE_IDC_KEYREF, decl->targetNamespace); in xmlSchemaParseElement()
8842 lastIDC->next = curIDC; in xmlSchemaParseElement()
8844 decl->idcs = (void *) curIDC; in xmlSchemaParseElement()
8846 child = child->next; in xmlSchemaParseElement()
8855 decl->annot = annot; in xmlSchemaParseElement()
8865 particle->children = (xmlSchemaTreeItemPtr) decl; in xmlSchemaParseElement()
8873 particle->annot = NULL; in xmlSchemaParseElement()
8875 decl->annot = NULL; in xmlSchemaParseElement()
8883 * @ctxt: a schema validation context
8890 * Returns -1 in case of internal error, 0 in case of success and a positive
8903 return (-1); in xmlSchemaParseUnion()
8905 type = ctxt->ctxtType; in xmlSchemaParseUnion()
8909 type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION; in xmlSchemaParseUnion()
8912 * then the `simple ur-type definition`." in xmlSchemaParseUnion()
8914 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); in xmlSchemaParseUnion()
8918 attr = node->properties; in xmlSchemaParseUnion()
8920 if (attr->ns == NULL) { in xmlSchemaParseUnion()
8921 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseUnion()
8922 (!xmlStrEqual(attr->name, BAD_CAST "memberTypes"))) { in xmlSchemaParseUnion()
8926 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseUnion()
8930 attr = attr->next; in xmlSchemaParseUnion()
8946 type->base = cur; in xmlSchemaParseUnion()
8955 tmp = xmlStrndup(cur, end - cur); in xmlSchemaParseUnion()
8966 return (-1); in xmlSchemaParseUnion()
8968 link->type = NULL; in xmlSchemaParseUnion()
8969 link->next = NULL; in xmlSchemaParseUnion()
8971 type->memberTypes = link; in xmlSchemaParseUnion()
8973 lastLink->next = link; in xmlSchemaParseUnion()
8982 return (-1); in xmlSchemaParseUnion()
8988 link->type = (xmlSchemaTypePtr) ref; in xmlSchemaParseUnion()
8998 child = node->children; in xmlSchemaParseUnion()
9005 child = child->next; in xmlSchemaParseUnion()
9019 type->subtypes = subtype; in xmlSchemaParseUnion()
9022 last->next = subtype; in xmlSchemaParseUnion()
9025 last->next = NULL; in xmlSchemaParseUnion()
9027 child = child->next; in xmlSchemaParseUnion()
9035 if ((attr == NULL) && (type->subtypes == NULL)) { in xmlSchemaParseUnion()
9037 * src-union-memberTypes-or-simpleTypes in xmlSchemaParseUnion()
9039 * be non-empty or there must be at least one simpleType [child]. in xmlSchemaParseUnion()
9052 * @ctxt: a schema validation context
9059 * Returns -1 in case of error, 0 if the declaration is improper and
9073 type = ctxt->ctxtType; in xmlSchemaParseList()
9077 type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST; in xmlSchemaParseList()
9080 * then the `simple ur-type definition`." in xmlSchemaParseList()
9082 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); in xmlSchemaParseList()
9086 attr = node->properties; in xmlSchemaParseList()
9088 if (attr->ns == NULL) { in xmlSchemaParseList()
9089 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseList()
9090 (!xmlStrEqual(attr->name, BAD_CAST "itemType"))) { in xmlSchemaParseList()
9094 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseList()
9098 attr = attr->next; in xmlSchemaParseList()
9111 node, "itemType", &(type->baseNs), &(type->base)); in xmlSchemaParseList()
9115 child = node->children; in xmlSchemaParseList()
9119 child = child->next; in xmlSchemaParseList()
9123 * src-list-itemType-or-simpleType in xmlSchemaParseList()
9127 if (type->base != NULL) { in xmlSchemaParseList()
9134 type->subtypes = xmlSchemaParseSimpleType(ctxt, schema, child, 0); in xmlSchemaParseList()
9136 child = child->next; in xmlSchemaParseList()
9137 } else if (type->base == NULL) { in xmlSchemaParseList()
9149 if ((type->base == NULL) && in xmlSchemaParseList()
9150 (type->subtypes == NULL) && in xmlSchemaParseList()
9163 * @ctxt: a schema validation context
9170 * Returns -1 in case of error, 0 if the declaration is improper and
9200 * Skip built-in types. in xmlSchemaParseSimpleType()
9202 if (ctxt->isS4S) { in xmlSchemaParseSimpleType()
9205 if (ctxt->isRedefine) { in xmlSchemaParseSimpleType()
9207 * REDEFINE: Disallow redefinition of built-in-types. in xmlSchemaParseSimpleType()
9213 "Redefinition of built-in simple types is not " in xmlSchemaParseSimpleType()
9237 snprintf(buf, 39, "#ST%d", ctxt->counter++ + 1); in xmlSchemaParseSimpleType()
9240 xmlDictLookup(ctxt->dict, (const xmlChar *)buf, -1), in xmlSchemaParseSimpleType()
9241 ctxt->targetNamespace, node, 0); in xmlSchemaParseSimpleType()
9245 NULL, ctxt->targetNamespace, node, 0); in xmlSchemaParseSimpleType()
9249 type->type = XML_SCHEMA_TYPE_SIMPLE; in xmlSchemaParseSimpleType()
9250 type->contentType = XML_SCHEMA_CONTENT_SIMPLE; in xmlSchemaParseSimpleType()
9254 attr = node->properties; in xmlSchemaParseSimpleType()
9256 if (attr->ns == NULL) { in xmlSchemaParseSimpleType()
9257 if (!xmlStrEqual(attr->name, BAD_CAST "id")) { in xmlSchemaParseSimpleType()
9261 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseSimpleType()
9265 attr = attr->next; in xmlSchemaParseSimpleType()
9274 attrValue, ctxt->targetNamespace, node, 1); in xmlSchemaParseSimpleType()
9277 type->type = XML_SCHEMA_TYPE_SIMPLE; in xmlSchemaParseSimpleType()
9278 type->contentType = XML_SCHEMA_CONTENT_SIMPLE; in xmlSchemaParseSimpleType()
9279 type->flags |= XML_SCHEMAS_TYPE_GLOBAL; in xmlSchemaParseSimpleType()
9283 attr = node->properties; in xmlSchemaParseSimpleType()
9285 if (attr->ns == NULL) { in xmlSchemaParseSimpleType()
9286 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseSimpleType()
9287 (!xmlStrEqual(attr->name, BAD_CAST "name")) && in xmlSchemaParseSimpleType()
9288 (!xmlStrEqual(attr->name, BAD_CAST "final"))) { in xmlSchemaParseSimpleType()
9292 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseSimpleType()
9296 attr = attr->next; in xmlSchemaParseSimpleType()
9303 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION) in xmlSchemaParseSimpleType()
9304 type->flags |= XML_SCHEMAS_TYPE_FINAL_RESTRICTION; in xmlSchemaParseSimpleType()
9305 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_LIST) in xmlSchemaParseSimpleType()
9306 type->flags |= XML_SCHEMAS_TYPE_FINAL_LIST; in xmlSchemaParseSimpleType()
9307 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_UNION) in xmlSchemaParseSimpleType()
9308 type->flags |= XML_SCHEMAS_TYPE_FINAL_UNION; in xmlSchemaParseSimpleType()
9311 if (xmlSchemaPValAttrBlockFinal(attrValue, &(type->flags), in xmlSchemaParseSimpleType()
9312 -1, -1, XML_SCHEMAS_TYPE_FINAL_RESTRICTION, -1, in xmlSchemaParseSimpleType()
9324 type->targetNamespace = ctxt->targetNamespace; in xmlSchemaParseSimpleType()
9329 oldCtxtType = ctxt->ctxtType; in xmlSchemaParseSimpleType()
9331 ctxt->ctxtType = type; in xmlSchemaParseSimpleType()
9333 child = node->children; in xmlSchemaParseSimpleType()
9335 type->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseSimpleType()
9336 child = child->next; in xmlSchemaParseSimpleType()
9346 child = child->next; in xmlSchemaParseSimpleType()
9349 child = child->next; in xmlSchemaParseSimpleType()
9352 child = child->next; in xmlSchemaParseSimpleType()
9360 * REDEFINE: SPEC src-redefine (5) in xmlSchemaParseSimpleType()
9366 if (topLevel && ctxt->isRedefine && (! hasRestriction)) { in xmlSchemaParseSimpleType()
9372 ctxt->ctxtType = oldCtxtType; in xmlSchemaParseSimpleType()
9384 * We will return a particle component with a qname-component or
9412 min = xmlGetMinOccurs(ctxt, node, 0, -1, 1, "xs:nonNegativeInteger"); in xmlSchemaParseModelGroupDefRef()
9418 attr = node->properties; in xmlSchemaParseModelGroupDefRef()
9420 if (attr->ns == NULL) { in xmlSchemaParseModelGroupDefRef()
9421 if ((!xmlStrEqual(attr->name, BAD_CAST "ref")) && in xmlSchemaParseModelGroupDefRef()
9422 (!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseModelGroupDefRef()
9423 (!xmlStrEqual(attr->name, BAD_CAST "minOccurs")) && in xmlSchemaParseModelGroupDefRef()
9424 (!xmlStrEqual(attr->name, BAD_CAST "maxOccurs"))) { in xmlSchemaParseModelGroupDefRef()
9428 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseModelGroupDefRef()
9432 attr = attr->next; in xmlSchemaParseModelGroupDefRef()
9439 * Create a qname-reference and set as the term; it will be substituted in xmlSchemaParseModelGroupDefRef()
9442 item->children = (xmlSchemaTreeItemPtr) in xmlSchemaParseModelGroupDefRef()
9448 child = node->children; in xmlSchemaParseModelGroupDefRef()
9454 item->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseModelGroupDefRef()
9455 child = child->next; in xmlSchemaParseModelGroupDefRef()
9474 * @ctxt: a schema validation context
9480 * Note that the contraint src-redefine (6.2) can't be applied until
9486 * Returns -1 in case of error, 0 if the declaration is improper and
9514 ctxt->targetNamespace, node); in xmlSchemaParseModelGroupDefinition()
9520 attr = node->properties; in xmlSchemaParseModelGroupDefinition()
9522 if (attr->ns == NULL) { in xmlSchemaParseModelGroupDefinition()
9523 if ((!xmlStrEqual(attr->name, BAD_CAST "name")) && in xmlSchemaParseModelGroupDefinition()
9524 (!xmlStrEqual(attr->name, BAD_CAST "id"))) { in xmlSchemaParseModelGroupDefinition()
9528 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseModelGroupDefinition()
9532 attr = attr->next; in xmlSchemaParseModelGroupDefinition()
9538 child = node->children; in xmlSchemaParseModelGroupDefinition()
9540 item->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseModelGroupDefinition()
9541 child = child->next; in xmlSchemaParseModelGroupDefinition()
9544 item->children = xmlSchemaParseModelGroup(ctxt, schema, child, in xmlSchemaParseModelGroupDefinition()
9546 child = child->next; in xmlSchemaParseModelGroupDefinition()
9548 item->children = xmlSchemaParseModelGroup(ctxt, schema, child, in xmlSchemaParseModelGroupDefinition()
9550 child = child->next; in xmlSchemaParseModelGroupDefinition()
9552 item->children = xmlSchemaParseModelGroup(ctxt, schema, child, in xmlSchemaParseModelGroupDefinition()
9554 child = child->next; in xmlSchemaParseModelGroupDefinition()
9570 * @ctxt: a schema validation context
9593 if (cur->type == XML_TEXT_NODE) { in xmlSchemaCleanupDoc()
9599 } else if ((cur->type != XML_ELEMENT_NODE) && in xmlSchemaCleanupDoc()
9600 (cur->type != XML_CDATA_SECTION_NODE)) { in xmlSchemaCleanupDoc()
9608 if (cur->children != NULL) { in xmlSchemaCleanupDoc()
9609 if ((cur->children->type != XML_ENTITY_DECL) && in xmlSchemaCleanupDoc()
9610 (cur->children->type != XML_ENTITY_REF_NODE) && in xmlSchemaCleanupDoc()
9611 (cur->children->type != XML_ENTITY_NODE)) { in xmlSchemaCleanupDoc()
9612 cur = cur->children; in xmlSchemaCleanupDoc()
9617 if (cur->next != NULL) { in xmlSchemaCleanupDoc()
9618 cur = cur->next; in xmlSchemaCleanupDoc()
9623 cur = cur->parent; in xmlSchemaCleanupDoc()
9630 if (cur->next != NULL) { in xmlSchemaCleanupDoc()
9631 cur = cur->next; in xmlSchemaCleanupDoc()
9647 if (schema->flags & XML_SCHEMAS_QUALIF_ELEM) in xmlSchemaClearSchemaDefaults()
9648 schema->flags ^= XML_SCHEMAS_QUALIF_ELEM; in xmlSchemaClearSchemaDefaults()
9650 if (schema->flags & XML_SCHEMAS_QUALIF_ATTR) in xmlSchemaClearSchemaDefaults()
9651 schema->flags ^= XML_SCHEMAS_QUALIF_ATTR; in xmlSchemaClearSchemaDefaults()
9653 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_EXTENSION) in xmlSchemaClearSchemaDefaults()
9654 schema->flags ^= XML_SCHEMAS_FINAL_DEFAULT_EXTENSION; in xmlSchemaClearSchemaDefaults()
9655 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION) in xmlSchemaClearSchemaDefaults()
9656 schema->flags ^= XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION; in xmlSchemaClearSchemaDefaults()
9657 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_LIST) in xmlSchemaClearSchemaDefaults()
9658 schema->flags ^= XML_SCHEMAS_FINAL_DEFAULT_LIST; in xmlSchemaClearSchemaDefaults()
9659 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_UNION) in xmlSchemaClearSchemaDefaults()
9660 schema->flags ^= XML_SCHEMAS_FINAL_DEFAULT_UNION; in xmlSchemaClearSchemaDefaults()
9662 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION) in xmlSchemaClearSchemaDefaults()
9663 schema->flags ^= XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION; in xmlSchemaClearSchemaDefaults()
9664 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION) in xmlSchemaClearSchemaDefaults()
9665 schema->flags ^= XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION; in xmlSchemaClearSchemaDefaults()
9666 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION) in xmlSchemaClearSchemaDefaults()
9667 schema->flags ^= XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION; in xmlSchemaClearSchemaDefaults()
9677 int res = 0, oldErrs = ctxt->nberrors; in xmlSchemaParseSchemaElement()
9705 ctxt->stop = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; in xmlSchemaParseSchemaElement()
9712 res = xmlSchemaPValAttrFormDefault(val, &schema->flags, in xmlSchemaParseSchemaElement()
9725 res = xmlSchemaPValAttrFormDefault(val, &schema->flags, in xmlSchemaParseSchemaElement()
9738 res = xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1, in xmlSchemaParseSchemaElement()
9741 -1, in xmlSchemaParseSchemaElement()
9756 res = xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1, in xmlSchemaParseSchemaElement()
9759 XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION, -1, -1); in xmlSchemaParseSchemaElement()
9771 if (oldErrs != ctxt->nberrors) in xmlSchemaParseSchemaElement()
9772 res = ctxt->err; in xmlSchemaParseSchemaElement()
9775 return(-1); in xmlSchemaParseSchemaElement()
9780 * @ctxt: a schema validation context
9796 return(-1); in xmlSchemaParseSchemaTopLevel()
9798 oldErrs = ctxt->nberrors; in xmlSchemaParseSchemaTopLevel()
9806 if (schema->annot == NULL) in xmlSchemaParseSchemaTopLevel()
9807 schema->annot = annot; in xmlSchemaParseSchemaTopLevel()
9811 tmpOldErrs = ctxt->nberrors; in xmlSchemaParseSchemaTopLevel()
9815 if (tmpOldErrs != ctxt->nberrors) in xmlSchemaParseSchemaTopLevel()
9818 tmpOldErrs = ctxt->nberrors; in xmlSchemaParseSchemaTopLevel()
9822 if (tmpOldErrs != ctxt->nberrors) in xmlSchemaParseSchemaTopLevel()
9825 tmpOldErrs = ctxt->nberrors; in xmlSchemaParseSchemaTopLevel()
9829 if (tmpOldErrs != ctxt->nberrors) in xmlSchemaParseSchemaTopLevel()
9832 child = child->next; in xmlSchemaParseSchemaTopLevel()
9841 child = child->next; in xmlSchemaParseSchemaTopLevel()
9844 child = child->next; in xmlSchemaParseSchemaTopLevel()
9847 child = child->next; in xmlSchemaParseSchemaTopLevel()
9850 child = child->next; in xmlSchemaParseSchemaTopLevel()
9853 child = child->next; in xmlSchemaParseSchemaTopLevel()
9856 child = child->next; in xmlSchemaParseSchemaTopLevel()
9859 child = child->next; in xmlSchemaParseSchemaTopLevel()
9863 NULL, child->parent, child, in xmlSchemaParseSchemaTopLevel()
9867 child = child->next; in xmlSchemaParseSchemaTopLevel()
9874 if (schema->annot == NULL) in xmlSchemaParseSchemaTopLevel()
9875 schema->annot = annot; in xmlSchemaParseSchemaTopLevel()
9878 child = child->next; in xmlSchemaParseSchemaTopLevel()
9882 ctxt->ctxtType = NULL; in xmlSchemaParseSchemaTopLevel()
9883 if (oldErrs != ctxt->nberrors) in xmlSchemaParseSchemaTopLevel()
9884 res = ctxt->err; in xmlSchemaParseSchemaTopLevel()
9887 return(-1); in xmlSchemaParseSchemaTopLevel()
9920 redef = redef->next; in xmlSchemaRedefListFree()
9934 if (con->buckets != NULL) in xmlSchemaConstructionCtxtFree()
9935 xmlSchemaItemListFree(con->buckets); in xmlSchemaConstructionCtxtFree()
9936 if (con->pending != NULL) in xmlSchemaConstructionCtxtFree()
9937 xmlSchemaItemListFree(con->pending); in xmlSchemaConstructionCtxtFree()
9938 if (con->substGroups != NULL) in xmlSchemaConstructionCtxtFree()
9939 xmlHashFree(con->substGroups, xmlSchemaSubstGroupFreeEntry); in xmlSchemaConstructionCtxtFree()
9940 if (con->redefs != NULL) in xmlSchemaConstructionCtxtFree()
9941 xmlSchemaRedefListFree(con->redefs); in xmlSchemaConstructionCtxtFree()
9942 if (con->dict != NULL) in xmlSchemaConstructionCtxtFree()
9943 xmlDictFree(con->dict); in xmlSchemaConstructionCtxtFree()
9961 ret->buckets = xmlSchemaItemListCreate(); in xmlSchemaConstructionCtxtCreate()
9962 if (ret->buckets == NULL) { in xmlSchemaConstructionCtxtCreate()
9968 ret->pending = xmlSchemaItemListCreate(); in xmlSchemaConstructionCtxtCreate()
9969 if (ret->pending == NULL) { in xmlSchemaConstructionCtxtCreate()
9975 ret->dict = dict; in xmlSchemaConstructionCtxtCreate()
9992 ret->type = XML_SCHEMA_CTXT_PARSER; in xmlSchemaParserCtxtCreate()
9993 ret->attrProhibs = xmlSchemaItemListCreate(); in xmlSchemaParserCtxtCreate()
9994 if (ret->attrProhibs == NULL) { in xmlSchemaParserCtxtCreate()
10019 ret->dict = dict; in xmlSchemaNewParserCtxtUseDict()
10022 ret->URL = xmlDictLookup(dict, (const xmlChar *) URL, -1); in xmlSchemaNewParserCtxtUseDict()
10029 if (vctxt->pctxt == NULL) { in xmlSchemaCreatePCtxtOnVCtxt()
10030 if (vctxt->schema != NULL) in xmlSchemaCreatePCtxtOnVCtxt()
10031 vctxt->pctxt = in xmlSchemaCreatePCtxtOnVCtxt()
10032 xmlSchemaNewParserCtxtUseDict("*", vctxt->schema->dict); in xmlSchemaCreatePCtxtOnVCtxt()
10034 vctxt->pctxt = xmlSchemaNewParserCtxt("*"); in xmlSchemaCreatePCtxtOnVCtxt()
10035 if (vctxt->pctxt == NULL) { in xmlSchemaCreatePCtxtOnVCtxt()
10038 return (-1); in xmlSchemaCreatePCtxtOnVCtxt()
10041 xmlSchemaSetParserErrors(vctxt->pctxt, vctxt->error, in xmlSchemaCreatePCtxtOnVCtxt()
10042 vctxt->warning, vctxt->errCtxt); in xmlSchemaCreatePCtxtOnVCtxt()
10043 xmlSchemaSetParserStructuredErrors(vctxt->pctxt, vctxt->serror, in xmlSchemaCreatePCtxtOnVCtxt()
10044 vctxt->errCtxt); in xmlSchemaCreatePCtxtOnVCtxt()
10066 list = pctxt->constructor->buckets; in xmlSchemaGetSchemaBucket()
10067 if (list->nbItems == 0) in xmlSchemaGetSchemaBucket()
10071 for (i = 0; i < list->nbItems; i++) { in xmlSchemaGetSchemaBucket()
10072 cur = (xmlSchemaBucketPtr) list->items[i]; in xmlSchemaGetSchemaBucket()
10074 if (cur->schemaLocation == schemaLocation) in xmlSchemaGetSchemaBucket()
10089 list = pctxt->constructor->buckets; in xmlSchemaGetChameleonSchemaBucket()
10090 if (list->nbItems == 0) in xmlSchemaGetChameleonSchemaBucket()
10094 for (i = 0; i < list->nbItems; i++) { in xmlSchemaGetChameleonSchemaBucket()
10095 cur = (xmlSchemaBucketPtr) list->items[i]; in xmlSchemaGetChameleonSchemaBucket()
10097 if ((cur->origTargetNamespace == NULL) && in xmlSchemaGetChameleonSchemaBucket()
10098 (cur->schemaLocation == schemaLocation) && in xmlSchemaGetChameleonSchemaBucket()
10099 (cur->targetNamespace == targetNamespace)) in xmlSchemaGetChameleonSchemaBucket()
10108 (((b)->doc == NULL) && ((b)->schemaLocation != NULL))
10118 list = pctxt->constructor->buckets; in xmlSchemaGetSchemaBucketByTNS()
10119 if (list->nbItems == 0) in xmlSchemaGetSchemaBucketByTNS()
10123 for (i = 0; i < list->nbItems; i++) { in xmlSchemaGetSchemaBucketByTNS()
10124 cur = (xmlSchemaBucketPtr) list->items[i]; in xmlSchemaGetSchemaBucketByTNS()
10126 (cur->origTargetNamespace == targetNamespace) && in xmlSchemaGetSchemaBucketByTNS()
10127 ((imported && cur->imported) || in xmlSchemaGetSchemaBucketByTNS()
10128 ((!imported) && (!cur->imported)))) in xmlSchemaGetSchemaBucketByTNS()
10144 xmlSchemaBucketPtr oldbucket = pctxt->constructor->bucket; in xmlSchemaParseNewDocWithContext()
10148 * URGENT TODO: This is not good; move the per-document information in xmlSchemaParseNewDocWithContext()
10152 oldFlags = schema->flags; in xmlSchemaParseNewDocWithContext()
10153 oldDoc = schema->doc; in xmlSchemaParseNewDocWithContext()
10154 if (schema->flags != 0) in xmlSchemaParseNewDocWithContext()
10156 schema->doc = bucket->doc; in xmlSchemaParseNewDocWithContext()
10157 pctxt->schema = schema; in xmlSchemaParseNewDocWithContext()
10162 pctxt->targetNamespace = bucket->targetNamespace; in xmlSchemaParseNewDocWithContext()
10163 WXS_CONSTRUCTOR(pctxt)->bucket = bucket; in xmlSchemaParseNewDocWithContext()
10165 if ((bucket->targetNamespace != NULL) && in xmlSchemaParseNewDocWithContext()
10166 xmlStrEqual(bucket->targetNamespace, xmlSchemaNs)) { in xmlSchemaParseNewDocWithContext()
10170 pctxt->isS4S = 1; in xmlSchemaParseNewDocWithContext()
10173 bucket->parsed++; in xmlSchemaParseNewDocWithContext()
10175 node = xmlDocGetRootElement(bucket->doc); in xmlSchemaParseNewDocWithContext()
10180 if (node->children == NULL) in xmlSchemaParseNewDocWithContext()
10182 oldErrs = pctxt->nberrors; in xmlSchemaParseNewDocWithContext()
10183 ret = xmlSchemaParseSchemaTopLevel(pctxt, schema, node->children); in xmlSchemaParseNewDocWithContext()
10188 * as a result of the obove functions; so better rely on pctxt->err in xmlSchemaParseNewDocWithContext()
10191 if ((ret == 0) && (oldErrs != pctxt->nberrors)) { in xmlSchemaParseNewDocWithContext()
10192 ret = pctxt->err; in xmlSchemaParseNewDocWithContext()
10197 WXS_CONSTRUCTOR(pctxt)->bucket = oldbucket; in xmlSchemaParseNewDocWithContext()
10199 schema->doc = oldDoc; in xmlSchemaParseNewDocWithContext()
10200 schema->flags = oldFlags; in xmlSchemaParseNewDocWithContext()
10214 if (bucket->parsed) { in xmlSchemaParseNewDoc()
10217 return(-1); in xmlSchemaParseNewDoc()
10219 if (bucket->doc == NULL) { in xmlSchemaParseNewDoc()
10222 return(-1); in xmlSchemaParseNewDoc()
10224 if (pctxt->constructor == NULL) { in xmlSchemaParseNewDoc()
10227 return(-1); in xmlSchemaParseNewDoc()
10231 (const char *) bucket->schemaLocation, pctxt->dict); in xmlSchemaParseNewDoc()
10233 return(-1); in xmlSchemaParseNewDoc()
10234 newpctxt->constructor = pctxt->constructor; in xmlSchemaParseNewDoc()
10240 newpctxt->schema = schema; in xmlSchemaParseNewDoc()
10241 xmlSchemaSetParserErrors(newpctxt, pctxt->error, pctxt->warning, in xmlSchemaParseNewDoc()
10242 pctxt->errCtxt); in xmlSchemaParseNewDoc()
10243 xmlSchemaSetParserStructuredErrors(newpctxt, pctxt->serror, in xmlSchemaParseNewDoc()
10244 pctxt->errCtxt); in xmlSchemaParseNewDoc()
10245 newpctxt->counter = pctxt->counter; in xmlSchemaParseNewDoc()
10252 pctxt->err = res; in xmlSchemaParseNewDoc()
10253 pctxt->nberrors += newpctxt->nberrors; in xmlSchemaParseNewDoc()
10254 pctxt->counter = newpctxt->counter; in xmlSchemaParseNewDoc()
10255 newpctxt->constructor = NULL; in xmlSchemaParseNewDoc()
10265 xmlSchemaSchemaRelationPtr cur = bucket->relations; in xmlSchemaSchemaRelationAddChild()
10268 bucket->relations = rel; in xmlSchemaSchemaRelationAddChild()
10271 while (cur->next != NULL) in xmlSchemaSchemaRelationAddChild()
10272 cur = cur->next; in xmlSchemaSchemaRelationAddChild()
10273 cur->next = rel; in xmlSchemaSchemaRelationAddChild()
10291 base = xmlNodeGetBase(ctxtNode->doc, ctxtNode); in xmlSchemaBuildAbsoluteURI()
10293 URI = xmlBuildURI(location, ctxtNode->doc->URL); in xmlSchemaBuildAbsoluteURI()
10299 ret = xmlDictLookup(dict, URI, -1); in xmlSchemaBuildAbsoluteURI()
10312 * @pctxt: a schema validation context
10316 * Parse an included (and to-be-redefined) XML schema document.
10319 * -1 in case of an internal or API error.
10368 (pctxt->constructor->bucket == bkt)) { in xmlSchemaAddSchemaDoc()
10369 /* Report self-imports/inclusions/redefinitions. */ in xmlSchemaAddSchemaDoc()
10383 return(-1); in xmlSchemaAddSchemaDoc()
10384 xmlSchemaSchemaRelationAddChild(pctxt->constructor->bucket, in xmlSchemaAddSchemaDoc()
10386 relation->type = type; in xmlSchemaAddSchemaDoc()
10392 relation->importNamespace = importNamespace; in xmlSchemaAddSchemaDoc()
10406 if ((WXS_IS_BUCKET_IMPMAIN(type)) && (! bkt->imported)) { in xmlSchemaAddSchemaDoc()
10414 bkt->schemaLocation)) { in xmlSchemaAddSchemaDoc()
10422 } else if ((! WXS_IS_BUCKET_IMPMAIN(type)) && (bkt->imported)) { in xmlSchemaAddSchemaDoc()
10431 bkt->schemaLocation)) { in xmlSchemaAddSchemaDoc()
10464 relation->bucket = bkt; in xmlSchemaAddSchemaDoc()
10471 relation->bucket = bkt; in xmlSchemaAddSchemaDoc()
10472 if (bkt->schemaLocation == NULL) { in xmlSchemaAddSchemaDoc()
10474 bkt->schemaLocation = schemaLocation; in xmlSchemaAddSchemaDoc()
10477 bkt->schemaLocation)) { in xmlSchemaAddSchemaDoc()
10492 schemaLocation, importNamespace, bkt->schemaLocation); in xmlSchemaAddSchemaDoc()
10505 if ((bkt->origTargetNamespace == NULL) && in xmlSchemaAddSchemaDoc()
10506 (bkt->targetNamespace != sourceTargetNamespace)) { in xmlSchemaAddSchemaDoc()
10515 * URGENT TODO: If the schema is a chameleon-include then copy in xmlSchemaAddSchemaDoc()
10518 * NOTE: This is currently worked-around by compiling the in xmlSchemaAddSchemaDoc()
10530 relation->bucket = chamel; in xmlSchemaAddSchemaDoc()
10542 relation->bucket = bkt; in xmlSchemaAddSchemaDoc()
10547 if ((bkt != NULL) && (bkt->doc != NULL)) { in xmlSchemaAddSchemaDoc()
10563 if (schemaDoc->URL != NULL) in xmlSchemaAddSchemaDoc()
10564 schemaLocation = xmlDictLookup(pctxt->dict, in xmlSchemaAddSchemaDoc()
10565 schemaDoc->URL, -1); in xmlSchemaAddSchemaDoc()
10577 if ((pctxt->dict != NULL) && (parserCtxt->dict != NULL)) { in xmlSchemaAddSchemaDoc()
10582 xmlDictFree(parserCtxt->dict); in xmlSchemaAddSchemaDoc()
10583 parserCtxt->dict = pctxt->dict; in xmlSchemaAddSchemaDoc()
10584 xmlDictReference(parserCtxt->dict); in xmlSchemaAddSchemaDoc()
10596 doc->URL = xmlStrdup(schemaLocation); in xmlSchemaAddSchemaDoc()
10602 * a <schema> element information item in a well-formed information in xmlSchemaAddSchemaDoc()
10607 * a well-formed information set, which in turn corresponds in xmlSchemaAddSchemaDoc()
10620 if ((lerr == NULL) || (lerr->domain != XML_FROM_IO)) { in xmlSchemaAddSchemaDoc()
10690 bkt->schemaLocation = schemaLocation; in xmlSchemaAddSchemaDoc()
10691 bkt->located = located; in xmlSchemaAddSchemaDoc()
10693 bkt->doc = doc; in xmlSchemaAddSchemaDoc()
10694 bkt->targetNamespace = targetNamespace; in xmlSchemaAddSchemaDoc()
10695 bkt->origTargetNamespace = targetNamespace; in xmlSchemaAddSchemaDoc()
10697 bkt->preserveDoc = 1; in xmlSchemaAddSchemaDoc()
10700 bkt->imported++; in xmlSchemaAddSchemaDoc()
10705 relation->bucket = bkt; in xmlSchemaAddSchemaDoc()
10721 bkt->doc = NULL; in xmlSchemaAddSchemaDoc()
10723 return(pctxt->err); in xmlSchemaAddSchemaDoc()
10729 bkt->doc = NULL; in xmlSchemaAddSchemaDoc()
10731 return (-1); in xmlSchemaAddSchemaDoc()
10736 * @ctxt: a schema validation context
10744 * not valid and -1 in case of an internal error.
10758 return (-1); in xmlSchemaParseImport()
10763 attr = node->properties; in xmlSchemaParseImport()
10765 if (attr->ns == NULL) { in xmlSchemaParseImport()
10766 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseImport()
10767 (!xmlStrEqual(attr->name, BAD_CAST "namespace")) && in xmlSchemaParseImport()
10768 (!xmlStrEqual(attr->name, BAD_CAST "schemaLocation"))) { in xmlSchemaParseImport()
10772 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseImport()
10776 attr = attr->next; in xmlSchemaParseImport()
10789 return (pctxt->err); in xmlSchemaParseImport()
10800 return (pctxt->err); in xmlSchemaParseImport()
10805 child = node->children; in xmlSchemaParseImport()
10811 child = child->next; in xmlSchemaParseImport()
10827 thisTargetNamespace = WXS_BUCKET(pctxt)->origTargetNamespace; in xmlSchemaParseImport()
10841 return (pctxt->err); in xmlSchemaParseImport()
10855 return (pctxt->err); in xmlSchemaParseImport()
10862 schemaLocation = xmlSchemaBuildAbsoluteURI(pctxt->dict, in xmlSchemaParseImport()
10904 return (-1); in xmlSchemaParseIncludeOrRedefineAttrs()
10911 attr = node->properties; in xmlSchemaParseIncludeOrRedefineAttrs()
10913 if (attr->ns == NULL) { in xmlSchemaParseIncludeOrRedefineAttrs()
10914 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseIncludeOrRedefineAttrs()
10915 (!xmlStrEqual(attr->name, BAD_CAST "schemaLocation"))) { in xmlSchemaParseIncludeOrRedefineAttrs()
10919 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseIncludeOrRedefineAttrs()
10923 attr = attr->next; in xmlSchemaParseIncludeOrRedefineAttrs()
10927 * Preliminary step, extract the URI-Reference and make an URI in xmlSchemaParseIncludeOrRedefineAttrs()
10942 base = xmlNodeGetBase(node->doc, node); in xmlSchemaParseIncludeOrRedefineAttrs()
10944 uri = xmlBuildURI(*schemaLocation, node->doc->URL); in xmlSchemaParseIncludeOrRedefineAttrs()
10954 (*schemaLocation) = (xmlChar *) xmlDictLookup(pctxt->dict, uri, -1); in xmlSchemaParseIncludeOrRedefineAttrs()
10963 * Report self-inclusion and self-redefinition. in xmlSchemaParseIncludeOrRedefineAttrs()
10965 if (xmlStrEqual(*schemaLocation, pctxt->URL)) { in xmlSchemaParseIncludeOrRedefineAttrs()
10984 return(pctxt->err); in xmlSchemaParseIncludeOrRedefineAttrs()
10986 return(-1); in xmlSchemaParseIncludeOrRedefineAttrs()
11002 return (-1); in xmlSchemaParseIncludeOrRedefine()
11016 NULL, 0, node, pctxt->targetNamespace, NULL, &bucket); in xmlSchemaParseIncludeOrRedefine()
11024 if ((bucket == NULL) || (bucket->doc == NULL)) { in xmlSchemaParseIncludeOrRedefine()
11032 * SPEC src-include: "It is not an error for the `actual value` of the in xmlSchemaParseIncludeOrRedefine()
11047 * SPEC src-redefine (1) in xmlSchemaParseIncludeOrRedefine()
11066 if (bucket->origTargetNamespace != NULL) { in xmlSchemaParseIncludeOrRedefine()
11068 * SPEC src-include (2.1) in xmlSchemaParseIncludeOrRedefine()
11073 if (pctxt->targetNamespace == NULL) { in xmlSchemaParseIncludeOrRedefine()
11082 } else if (!xmlStrEqual(bucket->origTargetNamespace, in xmlSchemaParseIncludeOrRedefine()
11083 pctxt->targetNamespace)) { in xmlSchemaParseIncludeOrRedefine()
11091 bucket->origTargetNamespace, schemaLocation, in xmlSchemaParseIncludeOrRedefine()
11092 pctxt->targetNamespace); in xmlSchemaParseIncludeOrRedefine()
11095 } else if (pctxt->targetNamespace != NULL) { in xmlSchemaParseIncludeOrRedefine()
11101 if (bucket->parsed && in xmlSchemaParseIncludeOrRedefine()
11102 bucket->origTargetNamespace != NULL) { in xmlSchemaParseIncludeOrRedefine()
11112 bucket->targetNamespace = pctxt->targetNamespace; in xmlSchemaParseIncludeOrRedefine()
11118 if (bucket && (!bucket->parsed) && (bucket->doc != NULL)) { in xmlSchemaParseIncludeOrRedefine()
11121 if ((schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS) == 0) { in xmlSchemaParseIncludeOrRedefine()
11122 schema->flags |= XML_SCHEMAS_INCLUDING_CONVERT_NS; in xmlSchemaParseIncludeOrRedefine()
11129 schema->flags ^= XML_SCHEMAS_INCLUDING_CONVERT_NS; in xmlSchemaParseIncludeOrRedefine()
11134 child = node->children; in xmlSchemaParseIncludeOrRedefine()
11139 pctxt->redefined = bucket; in xmlSchemaParseIncludeOrRedefine()
11143 pctxt->isRedefine = 1; in xmlSchemaParseIncludeOrRedefine()
11167 child = child->next; in xmlSchemaParseIncludeOrRedefine()
11169 pctxt->redefined = NULL; in xmlSchemaParseIncludeOrRedefine()
11170 pctxt->isRedefine = 0; in xmlSchemaParseIncludeOrRedefine()
11176 child = child->next; in xmlSchemaParseIncludeOrRedefine()
11194 return(pctxt->err); in xmlSchemaParseIncludeOrRedefine()
11228 * @ctxt: a schema validation context
11237 * Redefinition Constraints and Semantics (src-redefine)
11241 * All Group Limited (cos-all-limited) (2)
11242 * TODO: Actually this should go to component-level checks,
11248 * Returns -1 in case of error, 0 if the declaration is improper and
11277 min = xmlGetMinOccurs(ctxt, node, 0, -1, 1, "xs:nonNegativeInteger"); in xmlSchemaParseModelGroup()
11288 particle->children = (xmlSchemaTreeItemPtr) item; in xmlSchemaParseModelGroup()
11292 attr = node->properties; in xmlSchemaParseModelGroup()
11294 if (attr->ns == NULL) { in xmlSchemaParseModelGroup()
11295 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseModelGroup()
11296 (!xmlStrEqual(attr->name, BAD_CAST "maxOccurs")) && in xmlSchemaParseModelGroup()
11297 (!xmlStrEqual(attr->name, BAD_CAST "minOccurs"))) { in xmlSchemaParseModelGroup()
11301 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseModelGroup()
11305 attr = attr->next; in xmlSchemaParseModelGroup()
11311 attr = node->properties; in xmlSchemaParseModelGroup()
11313 if (attr->ns == NULL) { in xmlSchemaParseModelGroup()
11314 if (!xmlStrEqual(attr->name, BAD_CAST "id")) { in xmlSchemaParseModelGroup()
11318 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseModelGroup()
11322 attr = attr->next; in xmlSchemaParseModelGroup()
11333 child = node->children; in xmlSchemaParseModelGroup()
11335 item->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseModelGroup()
11336 child = child->next; in xmlSchemaParseModelGroup()
11345 * SPEC cos-all-limited (2) in xmlSchemaParseModelGroup()
11352 if (part->minOccurs > 1) { in xmlSchemaParseModelGroup()
11359 part->minOccurs = 1; in xmlSchemaParseModelGroup()
11361 if (part->maxOccurs > 1) { in xmlSchemaParseModelGroup()
11368 part->maxOccurs = 1; in xmlSchemaParseModelGroup()
11371 item->children = (xmlSchemaTreeItemPtr) part; in xmlSchemaParseModelGroup()
11373 last->next = (xmlSchemaTreeItemPtr) part; in xmlSchemaParseModelGroup()
11376 child = child->next; in xmlSchemaParseModelGroup()
11407 if (ctxt->isRedefine && ctxt->redef && in xmlSchemaParseModelGroup()
11408 (ctxt->redef->item->type == XML_SCHEMA_TYPE_GROUP) && in xmlSchemaParseModelGroup()
11409 part && part->children) in xmlSchemaParseModelGroup()
11411 if ((xmlSchemaGetQNameRefName(part->children) == in xmlSchemaParseModelGroup()
11412 ctxt->redef->refName) && in xmlSchemaParseModelGroup()
11413 (xmlSchemaGetQNameRefTargetNs(part->children) == in xmlSchemaParseModelGroup()
11414 ctxt->redef->refTargetNs)) in xmlSchemaParseModelGroup()
11417 * SPEC src-redefine: in xmlSchemaParseModelGroup()
11425 if (ctxt->redefCounter != 0) { in xmlSchemaParseModelGroup()
11434 ctxt->redef->refTargetNs, in xmlSchemaParseModelGroup()
11435 ctxt->redef->refName), in xmlSchemaParseModelGroup()
11439 } else if (((WXS_PARTICLE(part))->minOccurs != 1) || in xmlSchemaParseModelGroup()
11440 ((WXS_PARTICLE(part))->maxOccurs != 1)) in xmlSchemaParseModelGroup()
11444 * SPEC src-redefine: in xmlSchemaParseModelGroup()
11456 ctxt->redef->refTargetNs, in xmlSchemaParseModelGroup()
11457 ctxt->redef->refName), in xmlSchemaParseModelGroup()
11462 ctxt->redef->reference = WXS_BASIC_CAST part; in xmlSchemaParseModelGroup()
11463 ctxt->redefCounter++; in xmlSchemaParseModelGroup()
11478 item->children = part; in xmlSchemaParseModelGroup()
11480 last->next = part; in xmlSchemaParseModelGroup()
11483 child = child->next; in xmlSchemaParseModelGroup()
11508 * @ctxt: a schema validation context
11528 type = ctxt->ctxtType; in xmlSchemaParseRestriction()
11529 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION; in xmlSchemaParseRestriction()
11534 attr = node->properties; in xmlSchemaParseRestriction()
11536 if (attr->ns == NULL) { in xmlSchemaParseRestriction()
11537 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseRestriction()
11538 (!xmlStrEqual(attr->name, BAD_CAST "base"))) { in xmlSchemaParseRestriction()
11542 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseRestriction()
11546 attr = attr->next; in xmlSchemaParseRestriction()
11565 &(type->baseNs), &(type->base)) == 0) in xmlSchemaParseRestriction()
11567 if ((type->base == NULL) && (type->type == XML_SCHEMA_TYPE_COMPLEX)) { in xmlSchemaParseRestriction()
11571 } else if ((ctxt->isRedefine) && in xmlSchemaParseRestriction()
11572 (type->flags & XML_SCHEMAS_TYPE_GLOBAL)) in xmlSchemaParseRestriction()
11574 if (type->base == NULL) { in xmlSchemaParseRestriction()
11578 } else if ((! xmlStrEqual(type->base, type->name)) || in xmlSchemaParseRestriction()
11579 (! xmlStrEqual(type->baseNs, type->targetNamespace))) in xmlSchemaParseRestriction()
11583 * REDEFINE: SPEC src-redefine (5) in xmlSchemaParseRestriction()
11593 xmlSchemaFormatQName(&str1, type->baseNs, type->base), in xmlSchemaParseRestriction()
11594 xmlSchemaFormatQName(&str2, type->targetNamespace, in xmlSchemaParseRestriction()
11595 type->name), NULL); in xmlSchemaParseRestriction()
11599 type->base = NULL; in xmlSchemaParseRestriction()
11600 type->baseNs = NULL; in xmlSchemaParseRestriction()
11607 child = node->children; in xmlSchemaParseRestriction()
11614 child = child->next; in xmlSchemaParseRestriction()
11621 if (type->base != NULL) { in xmlSchemaParseRestriction()
11623 * src-restriction-base-or-simpleType in xmlSchemaParseRestriction()
11633 type->baseType = (xmlSchemaTypePtr) in xmlSchemaParseRestriction()
11636 child = child->next; in xmlSchemaParseRestriction()
11637 } else if (type->base == NULL) { in xmlSchemaParseRestriction()
11652 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseRestriction()
11655 child = child->next; in xmlSchemaParseRestriction()
11657 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseRestriction()
11660 child = child->next; in xmlSchemaParseRestriction()
11662 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseRestriction()
11665 child = child->next; in xmlSchemaParseRestriction()
11670 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseRestriction()
11676 child = child->next; in xmlSchemaParseRestriction()
11687 * We will store the to-be-restricted simple type in in xmlSchemaParseRestriction()
11688 * type->contentTypeDef *temporarily*. in xmlSchemaParseRestriction()
11690 type->contentTypeDef = (xmlSchemaTypePtr) in xmlSchemaParseRestriction()
11692 if ( type->contentTypeDef == NULL) in xmlSchemaParseRestriction()
11694 child = child->next; in xmlSchemaParseRestriction()
11729 type->facets = facet; in xmlSchemaParseRestriction()
11731 lastfacet->next = facet; in xmlSchemaParseRestriction()
11733 lastfacet->next = NULL; in xmlSchemaParseRestriction()
11735 child = child->next; in xmlSchemaParseRestriction()
11738 * Create links for derivation and validation. in xmlSchemaParseRestriction()
11740 if (type->facets != NULL) { in xmlSchemaParseRestriction()
11743 facet = type->facets; in xmlSchemaParseRestriction()
11752 facetLink->facet = facet; in xmlSchemaParseRestriction()
11753 facetLink->next = NULL; in xmlSchemaParseRestriction()
11755 type->facetSet = facetLink; in xmlSchemaParseRestriction()
11757 lastFacetLink->next = facetLink; in xmlSchemaParseRestriction()
11759 facet = facet->next; in xmlSchemaParseRestriction()
11763 if (type->type == XML_SCHEMA_TYPE_COMPLEX) { in xmlSchemaParseRestriction()
11768 (xmlSchemaItemListPtr *) &(type->attrUses), in xmlSchemaParseRestriction()
11769 XML_SCHEMA_TYPE_RESTRICTION, NULL) == -1) in xmlSchemaParseRestriction()
11775 type->attributeWildcard = in xmlSchemaParseRestriction()
11777 child = child->next; in xmlSchemaParseRestriction()
11811 * @ctxt: a schema validation context
11832 type = ctxt->ctxtType; in xmlSchemaParseExtension()
11833 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION; in xmlSchemaParseExtension()
11838 attr = node->properties; in xmlSchemaParseExtension()
11840 if (attr->ns == NULL) { in xmlSchemaParseExtension()
11841 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseExtension()
11842 (!xmlStrEqual(attr->name, BAD_CAST "base"))) { in xmlSchemaParseExtension()
11846 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseExtension()
11850 attr = attr->next; in xmlSchemaParseExtension()
11856 * Attribute "base" - mandatory. in xmlSchemaParseExtension()
11859 "base", &(type->baseNs), &(type->base)) == 0) && in xmlSchemaParseExtension()
11860 (type->base == NULL)) { in xmlSchemaParseExtension()
11868 child = node->children; in xmlSchemaParseExtension()
11875 child = child->next; in xmlSchemaParseExtension()
11884 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseExtension()
11887 child = child->next; in xmlSchemaParseExtension()
11889 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseExtension()
11892 child = child->next; in xmlSchemaParseExtension()
11894 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseExtension()
11897 child = child->next; in xmlSchemaParseExtension()
11899 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseExtension()
11905 child = child->next; in xmlSchemaParseExtension()
11913 (xmlSchemaItemListPtr *) &(type->attrUses), in xmlSchemaParseExtension()
11914 XML_SCHEMA_TYPE_EXTENSION, NULL) == -1) in xmlSchemaParseExtension()
11920 ctxt->ctxtType->attributeWildcard = in xmlSchemaParseExtension()
11922 child = child->next; in xmlSchemaParseExtension()
11947 * @ctxt: a schema validation context
11967 return (-1); in xmlSchemaParseSimpleContent()
11970 type = ctxt->ctxtType; in xmlSchemaParseSimpleContent()
11971 type->contentType = XML_SCHEMA_CONTENT_SIMPLE; in xmlSchemaParseSimpleContent()
11975 attr = node->properties; in xmlSchemaParseSimpleContent()
11977 if (attr->ns == NULL) { in xmlSchemaParseSimpleContent()
11978 if ((!xmlStrEqual(attr->name, BAD_CAST "id"))) { in xmlSchemaParseSimpleContent()
11982 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseSimpleContent()
11986 attr = attr->next; in xmlSchemaParseSimpleContent()
11994 child = node->children; in xmlSchemaParseSimpleContent()
12001 child = child->next; in xmlSchemaParseSimpleContent()
12019 child = child->next; in xmlSchemaParseSimpleContent()
12024 child = child->next; in xmlSchemaParseSimpleContent()
12037 * @ctxt: a schema validation context
12057 return (-1); in xmlSchemaParseComplexContent()
12060 type = ctxt->ctxtType; in xmlSchemaParseComplexContent()
12064 attr = node->properties; in xmlSchemaParseComplexContent()
12066 if (attr->ns == NULL) { in xmlSchemaParseComplexContent()
12067 if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && in xmlSchemaParseComplexContent()
12068 (!xmlStrEqual(attr->name, BAD_CAST "mixed"))) in xmlSchemaParseComplexContent()
12073 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseComplexContent()
12077 attr = attr->next; in xmlSchemaParseComplexContent()
12086 if ((type->flags & XML_SCHEMAS_TYPE_MIXED) == 0) in xmlSchemaParseComplexContent()
12087 type->flags |= XML_SCHEMAS_TYPE_MIXED; in xmlSchemaParseComplexContent()
12089 child = node->children; in xmlSchemaParseComplexContent()
12096 child = child->next; in xmlSchemaParseComplexContent()
12114 child = child->next; in xmlSchemaParseComplexContent()
12119 child = child->next; in xmlSchemaParseComplexContent()
12132 * @ctxt: a schema validation context
12159 ctxtType = ctxt->ctxtType; in xmlSchemaParseComplexType()
12178 snprintf(buf, 39, "#CT%d", ctxt->counter++ + 1); in xmlSchemaParseComplexType()
12181 xmlDictLookup(ctxt->dict, (const xmlChar *)buf, -1), in xmlSchemaParseComplexType()
12182 ctxt->targetNamespace, node, 0); in xmlSchemaParseComplexType()
12186 NULL, ctxt->targetNamespace, node, 0); in xmlSchemaParseComplexType()
12190 name = type->name; in xmlSchemaParseComplexType()
12191 type->node = node; in xmlSchemaParseComplexType()
12192 type->type = XML_SCHEMA_TYPE_COMPLEX; in xmlSchemaParseComplexType()
12202 name, ctxt->targetNamespace, node, 1); in xmlSchemaParseComplexType()
12205 type->node = node; in xmlSchemaParseComplexType()
12206 type->type = XML_SCHEMA_TYPE_COMPLEX; in xmlSchemaParseComplexType()
12207 type->flags |= XML_SCHEMAS_TYPE_GLOBAL; in xmlSchemaParseComplexType()
12209 type->targetNamespace = ctxt->targetNamespace; in xmlSchemaParseComplexType()
12213 attr = node->properties; in xmlSchemaParseComplexType()
12215 if (attr->ns == NULL) { in xmlSchemaParseComplexType()
12216 if (xmlStrEqual(attr->name, BAD_CAST "id")) { in xmlSchemaParseComplexType()
12221 } else if (xmlStrEqual(attr->name, BAD_CAST "mixed")) { in xmlSchemaParseComplexType()
12227 type->flags |= XML_SCHEMAS_TYPE_MIXED; in xmlSchemaParseComplexType()
12232 if (xmlStrEqual(attr->name, BAD_CAST "name")) { in xmlSchemaParseComplexType()
12234 } else if (xmlStrEqual(attr->name, BAD_CAST "abstract")) { in xmlSchemaParseComplexType()
12240 type->flags |= XML_SCHEMAS_TYPE_ABSTRACT; in xmlSchemaParseComplexType()
12241 } else if (xmlStrEqual(attr->name, BAD_CAST "final")) { in xmlSchemaParseComplexType()
12248 &(type->flags), in xmlSchemaParseComplexType()
12249 -1, in xmlSchemaParseComplexType()
12252 -1, -1, -1) != 0) in xmlSchemaParseComplexType()
12261 } else if (xmlStrEqual(attr->name, BAD_CAST "block")) { in xmlSchemaParseComplexType()
12267 if (xmlSchemaPValAttrBlockFinal(attrValue, &(type->flags), in xmlSchemaParseComplexType()
12268 -1, in xmlSchemaParseComplexType()
12271 -1, -1, -1) != 0) { in xmlSchemaParseComplexType()
12287 } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { in xmlSchemaParseComplexType()
12291 attr = attr->next; in xmlSchemaParseComplexType()
12297 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION) in xmlSchemaParseComplexType()
12298 type->flags |= XML_SCHEMAS_TYPE_BLOCK_RESTRICTION; in xmlSchemaParseComplexType()
12299 if (schema->flags & XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION) in xmlSchemaParseComplexType()
12300 type->flags |= XML_SCHEMAS_TYPE_BLOCK_EXTENSION; in xmlSchemaParseComplexType()
12306 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION) in xmlSchemaParseComplexType()
12307 type->flags |= XML_SCHEMAS_TYPE_FINAL_RESTRICTION; in xmlSchemaParseComplexType()
12308 if (schema->flags & XML_SCHEMAS_FINAL_DEFAULT_EXTENSION) in xmlSchemaParseComplexType()
12309 type->flags |= XML_SCHEMAS_TYPE_FINAL_EXTENSION; in xmlSchemaParseComplexType()
12314 child = node->children; in xmlSchemaParseComplexType()
12316 type->annot = xmlSchemaParseAnnotation(ctxt, child, 1); in xmlSchemaParseComplexType()
12317 child = child->next; in xmlSchemaParseComplexType()
12319 ctxt->ctxtType = type; in xmlSchemaParseComplexType()
12327 if (type->flags & XML_SCHEMAS_TYPE_MIXED) in xmlSchemaParseComplexType()
12328 type->flags ^= XML_SCHEMAS_TYPE_MIXED; in xmlSchemaParseComplexType()
12331 child = child->next; in xmlSchemaParseComplexType()
12336 type->contentType = XML_SCHEMA_CONTENT_EMPTY; in xmlSchemaParseComplexType()
12339 child = child->next; in xmlSchemaParseComplexType()
12347 * for complex content restricting the `ur-type definition`, and the in xmlSchemaParseComplexType()
12350 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); in xmlSchemaParseComplexType()
12351 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION; in xmlSchemaParseComplexType()
12356 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseComplexType()
12359 child = child->next; in xmlSchemaParseComplexType()
12361 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseComplexType()
12364 child = child->next; in xmlSchemaParseComplexType()
12366 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseComplexType()
12369 child = child->next; in xmlSchemaParseComplexType()
12371 type->subtypes = (xmlSchemaTypePtr) in xmlSchemaParseComplexType()
12377 child = child->next; in xmlSchemaParseComplexType()
12383 (xmlSchemaItemListPtr *) &(type->attrUses), in xmlSchemaParseComplexType()
12384 XML_SCHEMA_TYPE_RESTRICTION, NULL) == -1) in xmlSchemaParseComplexType()
12390 type->attributeWildcard = xmlSchemaParseAnyAttribute(ctxt, schema, child); in xmlSchemaParseComplexType()
12391 child = child->next; in xmlSchemaParseComplexType()
12403 * REDEFINE: SPEC src-redefine (5) in xmlSchemaParseComplexType()
12405 if (topLevel && ctxt->isRedefine && (! hasRestrictionOrExtension)) { in xmlSchemaParseComplexType()
12409 "grand-child", NULL); in xmlSchemaParseComplexType()
12411 ctxt->ctxtType = ctxtType; in xmlSchemaParseComplexType()
12435 * Returns 0 in case of success, -1 in case of an
12446 return (-1);
12453 return (-1);
12456 ctxt->options = options;
12471 return (-1);
12473 return (ctxt->options);
12497 ret->dict = xmlDictCreate(); in xmlSchemaNewParserCtxt()
12498 ret->URL = xmlDictLookup(ret->dict, (const xmlChar *) URL, -1); in xmlSchemaNewParserCtxt()
12522 ret->buffer = buffer; in xmlSchemaNewMemParserCtxt()
12523 ret->size = size; in xmlSchemaNewMemParserCtxt()
12524 ret->dict = xmlDictCreate(); in xmlSchemaNewMemParserCtxt()
12547 ret->doc = doc; in xmlSchemaNewDocParserCtxt()
12548 ret->dict = xmlDictCreate(); in xmlSchemaNewDocParserCtxt()
12550 ret->preserve = 1; in xmlSchemaNewDocParserCtxt()
12566 if (ctxt->doc != NULL && !ctxt->preserve) in xmlSchemaFreeParserCtxt()
12567 xmlFreeDoc(ctxt->doc); in xmlSchemaFreeParserCtxt()
12568 if (ctxt->vctxt != NULL) { in xmlSchemaFreeParserCtxt()
12569 xmlSchemaFreeValidCtxt(ctxt->vctxt); in xmlSchemaFreeParserCtxt()
12571 if (ctxt->ownsConstructor && (ctxt->constructor != NULL)) { in xmlSchemaFreeParserCtxt()
12572 xmlSchemaConstructionCtxtFree(ctxt->constructor); in xmlSchemaFreeParserCtxt()
12573 ctxt->constructor = NULL; in xmlSchemaFreeParserCtxt()
12574 ctxt->ownsConstructor = 0; in xmlSchemaFreeParserCtxt()
12576 if (ctxt->attrProhibs != NULL) in xmlSchemaFreeParserCtxt()
12577 xmlSchemaItemListFree(ctxt->attrProhibs); in xmlSchemaFreeParserCtxt()
12578 xmlDictFree(ctxt->dict); in xmlSchemaFreeParserCtxt()
12603 elemDecl = (xmlSchemaElementPtr) particle->children; in xmlSchemaBuildContentModelForSubstGroup()
12607 start = pctxt->state; in xmlSchemaBuildContentModelForSubstGroup()
12609 end = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildContentModelForSubstGroup()
12616 "available.\n", elemDecl->name, NULL); in xmlSchemaBuildContentModelForSubstGroup()
12622 * However, an error will be raised during *validation* if an element in xmlSchemaBuildContentModelForSubstGroup()
12626 tmp = xmlAutomataNewCountedTrans(pctxt->am, start, NULL, counter); in xmlSchemaBuildContentModelForSubstGroup()
12627 xmlAutomataNewTransition2(pctxt->am, tmp, end, in xmlSchemaBuildContentModelForSubstGroup()
12628 elemDecl->name, elemDecl->targetNamespace, elemDecl); in xmlSchemaBuildContentModelForSubstGroup()
12632 for (i = 0; i < substGroup->members->nbItems; i++) { in xmlSchemaBuildContentModelForSubstGroup()
12633 member = (xmlSchemaElementPtr) substGroup->members->items[i]; in xmlSchemaBuildContentModelForSubstGroup()
12634 xmlAutomataNewTransition2(pctxt->am, tmp, end, in xmlSchemaBuildContentModelForSubstGroup()
12635 member->name, member->targetNamespace, member); in xmlSchemaBuildContentModelForSubstGroup()
12637 } else if (particle->maxOccurs == 1) { in xmlSchemaBuildContentModelForSubstGroup()
12641 xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildContentModelForSubstGroup()
12642 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildContentModelForSubstGroup()
12644 elemDecl->name, elemDecl->targetNamespace, elemDecl), end); in xmlSchemaBuildContentModelForSubstGroup()
12648 for (i = 0; i < substGroup->members->nbItems; i++) { in xmlSchemaBuildContentModelForSubstGroup()
12649 member = (xmlSchemaElementPtr) substGroup->members->items[i]; in xmlSchemaBuildContentModelForSubstGroup()
12657 * check xs:all with subst-groups. in xmlSchemaBuildContentModelForSubstGroup()
12659 * tmp = xmlAutomataNewOnceTrans2(pctxt->am, start, NULL, in xmlSchemaBuildContentModelForSubstGroup()
12660 * member->name, member->targetNamespace, in xmlSchemaBuildContentModelForSubstGroup()
12663 tmp = xmlAutomataNewTransition2(pctxt->am, start, NULL, in xmlSchemaBuildContentModelForSubstGroup()
12664 member->name, member->targetNamespace, member); in xmlSchemaBuildContentModelForSubstGroup()
12665 xmlAutomataNewEpsilon(pctxt->am, tmp, end); in xmlSchemaBuildContentModelForSubstGroup()
12669 int maxOccurs = particle->maxOccurs == UNBOUNDED ? in xmlSchemaBuildContentModelForSubstGroup()
12670 UNBOUNDED : particle->maxOccurs - 1; in xmlSchemaBuildContentModelForSubstGroup()
12671 int minOccurs = particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; in xmlSchemaBuildContentModelForSubstGroup()
12674 xmlAutomataNewCounter(pctxt->am, minOccurs, in xmlSchemaBuildContentModelForSubstGroup()
12676 hop = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildContentModelForSubstGroup()
12678 xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildContentModelForSubstGroup()
12679 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildContentModelForSubstGroup()
12681 elemDecl->name, elemDecl->targetNamespace, elemDecl), in xmlSchemaBuildContentModelForSubstGroup()
12686 for (i = 0; i < substGroup->members->nbItems; i++) { in xmlSchemaBuildContentModelForSubstGroup()
12687 member = (xmlSchemaElementPtr) substGroup->members->items[i]; in xmlSchemaBuildContentModelForSubstGroup()
12688 xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildContentModelForSubstGroup()
12689 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildContentModelForSubstGroup()
12691 member->name, member->targetNamespace, member), in xmlSchemaBuildContentModelForSubstGroup()
12694 xmlAutomataNewCountedTrans(pctxt->am, hop, start, counter); in xmlSchemaBuildContentModelForSubstGroup()
12695 xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter); in xmlSchemaBuildContentModelForSubstGroup()
12697 if (particle->minOccurs == 0) { in xmlSchemaBuildContentModelForSubstGroup()
12698 xmlAutomataNewEpsilon(pctxt->am, start, end); in xmlSchemaBuildContentModelForSubstGroup()
12701 pctxt->state = end; in xmlSchemaBuildContentModelForSubstGroup()
12716 if (((xmlSchemaElementPtr) particle->children)->flags & in xmlSchemaBuildContentModelForElement()
12721 ret = xmlSchemaBuildContentModelForSubstGroup(ctxt, particle, -1, NULL); in xmlSchemaBuildContentModelForElement()
12726 elemDecl = (xmlSchemaElementPtr) particle->children; in xmlSchemaBuildContentModelForElement()
12728 if (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT) in xmlSchemaBuildContentModelForElement()
12730 if (particle->maxOccurs == 1) { in xmlSchemaBuildContentModelForElement()
12731 start = ctxt->state; in xmlSchemaBuildContentModelForElement()
12732 ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL, in xmlSchemaBuildContentModelForElement()
12733 elemDecl->name, elemDecl->targetNamespace, elemDecl); in xmlSchemaBuildContentModelForElement()
12734 } else if ((particle->maxOccurs >= UNBOUNDED) && in xmlSchemaBuildContentModelForElement()
12735 (particle->minOccurs < 2)) { in xmlSchemaBuildContentModelForElement()
12737 start = ctxt->state; in xmlSchemaBuildContentModelForElement()
12738 ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL, in xmlSchemaBuildContentModelForElement()
12739 elemDecl->name, elemDecl->targetNamespace, elemDecl); in xmlSchemaBuildContentModelForElement()
12740 ctxt->state = xmlAutomataNewTransition2(ctxt->am, ctxt->state, ctxt->state, in xmlSchemaBuildContentModelForElement()
12741 elemDecl->name, elemDecl->targetNamespace, elemDecl); in xmlSchemaBuildContentModelForElement()
12744 int maxOccurs = particle->maxOccurs == UNBOUNDED ? in xmlSchemaBuildContentModelForElement()
12745 UNBOUNDED : particle->maxOccurs - 1; in xmlSchemaBuildContentModelForElement()
12746 int minOccurs = particle->minOccurs < 1 ? in xmlSchemaBuildContentModelForElement()
12747 0 : particle->minOccurs - 1; in xmlSchemaBuildContentModelForElement()
12749 start = xmlAutomataNewEpsilon(ctxt->am, ctxt->state, NULL); in xmlSchemaBuildContentModelForElement()
12750 counter = xmlAutomataNewCounter(ctxt->am, minOccurs, maxOccurs); in xmlSchemaBuildContentModelForElement()
12751 ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL, in xmlSchemaBuildContentModelForElement()
12752 elemDecl->name, elemDecl->targetNamespace, elemDecl); in xmlSchemaBuildContentModelForElement()
12753 xmlAutomataNewCountedTrans(ctxt->am, ctxt->state, start, counter); in xmlSchemaBuildContentModelForElement()
12754 ctxt->state = xmlAutomataNewCounterTrans(ctxt->am, ctxt->state, in xmlSchemaBuildContentModelForElement()
12757 if (particle->minOccurs == 0) { in xmlSchemaBuildContentModelForElement()
12758 xmlAutomataNewEpsilon(ctxt->am, start, ctxt->state); in xmlSchemaBuildContentModelForElement()
12785 if (particle->children == NULL) { in xmlSchemaBuildAContentModel()
12793 switch (particle->children->type) { in xmlSchemaBuildAContentModel()
12799 wild = (xmlSchemaWildcardPtr) particle->children; in xmlSchemaBuildAContentModel()
12801 start = pctxt->state; in xmlSchemaBuildAContentModel()
12802 end = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildAContentModel()
12804 if (particle->maxOccurs == 1) { in xmlSchemaBuildAContentModel()
12805 if (wild->any == 1) { in xmlSchemaBuildAContentModel()
12811 pctxt->state = in xmlSchemaBuildAContentModel()
12812 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildAContentModel()
12814 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end); in xmlSchemaBuildAContentModel()
12818 pctxt->state = in xmlSchemaBuildAContentModel()
12819 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildAContentModel()
12821 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end); in xmlSchemaBuildAContentModel()
12823 } else if (wild->nsSet != NULL) { in xmlSchemaBuildAContentModel()
12824 ns = wild->nsSet; in xmlSchemaBuildAContentModel()
12826 pctxt->state = start; in xmlSchemaBuildAContentModel()
12827 pctxt->state = xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildAContentModel()
12828 pctxt->state, NULL, BAD_CAST "*", ns->value, wild); in xmlSchemaBuildAContentModel()
12829 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end); in xmlSchemaBuildAContentModel()
12830 ns = ns->next; in xmlSchemaBuildAContentModel()
12833 } else if (wild->negNsSet != NULL) { in xmlSchemaBuildAContentModel()
12834 pctxt->state = xmlAutomataNewNegTrans(pctxt->am, in xmlSchemaBuildAContentModel()
12835 start, end, BAD_CAST "*", wild->negNsSet->value, in xmlSchemaBuildAContentModel()
12842 particle->maxOccurs == UNBOUNDED ? UNBOUNDED : in xmlSchemaBuildAContentModel()
12843 particle->maxOccurs - 1; in xmlSchemaBuildAContentModel()
12845 particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; in xmlSchemaBuildAContentModel()
12847 counter = xmlAutomataNewCounter(pctxt->am, minOccurs, maxOccurs); in xmlSchemaBuildAContentModel()
12848 hop = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildAContentModel()
12849 if (wild->any == 1) { in xmlSchemaBuildAContentModel()
12850 pctxt->state = in xmlSchemaBuildAContentModel()
12851 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildAContentModel()
12853 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop); in xmlSchemaBuildAContentModel()
12854 pctxt->state = in xmlSchemaBuildAContentModel()
12855 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildAContentModel()
12857 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop); in xmlSchemaBuildAContentModel()
12858 } else if (wild->nsSet != NULL) { in xmlSchemaBuildAContentModel()
12859 ns = wild->nsSet; in xmlSchemaBuildAContentModel()
12861 pctxt->state = in xmlSchemaBuildAContentModel()
12862 xmlAutomataNewTransition2(pctxt->am, in xmlSchemaBuildAContentModel()
12863 start, NULL, BAD_CAST "*", ns->value, wild); in xmlSchemaBuildAContentModel()
12864 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop); in xmlSchemaBuildAContentModel()
12865 ns = ns->next; in xmlSchemaBuildAContentModel()
12868 } else if (wild->negNsSet != NULL) { in xmlSchemaBuildAContentModel()
12869 pctxt->state = xmlAutomataNewNegTrans(pctxt->am, in xmlSchemaBuildAContentModel()
12870 start, hop, BAD_CAST "*", wild->negNsSet->value, in xmlSchemaBuildAContentModel()
12873 xmlAutomataNewCountedTrans(pctxt->am, hop, start, counter); in xmlSchemaBuildAContentModel()
12874 xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter); in xmlSchemaBuildAContentModel()
12876 if (particle->minOccurs == 0) { in xmlSchemaBuildAContentModel()
12877 xmlAutomataNewEpsilon(pctxt->am, start, end); in xmlSchemaBuildAContentModel()
12880 pctxt->state = end; in xmlSchemaBuildAContentModel()
12894 if ((particle->minOccurs == 1) && (particle->maxOccurs == 1)) { in xmlSchemaBuildAContentModel()
12895 sub = particle->children->children; in xmlSchemaBuildAContentModel()
12901 sub = sub->next; in xmlSchemaBuildAContentModel()
12904 xmlAutomataStatePtr oldstate = pctxt->state; in xmlSchemaBuildAContentModel()
12906 if (particle->maxOccurs >= UNBOUNDED) { in xmlSchemaBuildAContentModel()
12907 if (particle->minOccurs > 1) { in xmlSchemaBuildAContentModel()
12911 pctxt->state = xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
12913 oldstate = pctxt->state; in xmlSchemaBuildAContentModel()
12915 counter = xmlAutomataNewCounter(pctxt->am, in xmlSchemaBuildAContentModel()
12916 particle->minOccurs - 1, UNBOUNDED); in xmlSchemaBuildAContentModel()
12918 sub = particle->children->children; in xmlSchemaBuildAContentModel()
12923 sub = sub->next; in xmlSchemaBuildAContentModel()
12925 tmp = pctxt->state; in xmlSchemaBuildAContentModel()
12926 xmlAutomataNewCountedTrans(pctxt->am, tmp, in xmlSchemaBuildAContentModel()
12928 pctxt->state = in xmlSchemaBuildAContentModel()
12929 xmlAutomataNewCounterTrans(pctxt->am, tmp, in xmlSchemaBuildAContentModel()
12932 xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
12933 oldstate, pctxt->state); in xmlSchemaBuildAContentModel()
12936 pctxt->state = xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
12938 oldstate = pctxt->state; in xmlSchemaBuildAContentModel()
12940 sub = particle->children->children; in xmlSchemaBuildAContentModel()
12945 sub = sub->next; in xmlSchemaBuildAContentModel()
12947 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, in xmlSchemaBuildAContentModel()
12954 pctxt->state = xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
12955 pctxt->state, NULL); in xmlSchemaBuildAContentModel()
12956 if (particle->minOccurs == 0) { in xmlSchemaBuildAContentModel()
12957 xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
12958 oldstate, pctxt->state); in xmlSchemaBuildAContentModel()
12962 } else if ((particle->maxOccurs > 1) in xmlSchemaBuildAContentModel()
12963 || (particle->minOccurs > 1)) { in xmlSchemaBuildAContentModel()
12967 pctxt->state = xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
12969 oldstate = pctxt->state; in xmlSchemaBuildAContentModel()
12971 counter = xmlAutomataNewCounter(pctxt->am, in xmlSchemaBuildAContentModel()
12972 particle->minOccurs - 1, in xmlSchemaBuildAContentModel()
12973 particle->maxOccurs - 1); in xmlSchemaBuildAContentModel()
12975 sub = particle->children->children; in xmlSchemaBuildAContentModel()
12980 sub = sub->next; in xmlSchemaBuildAContentModel()
12982 tmp = pctxt->state; in xmlSchemaBuildAContentModel()
12983 xmlAutomataNewCountedTrans(pctxt->am, in xmlSchemaBuildAContentModel()
12985 pctxt->state = in xmlSchemaBuildAContentModel()
12986 xmlAutomataNewCounterTrans(pctxt->am, tmp, NULL, in xmlSchemaBuildAContentModel()
12988 if ((particle->minOccurs == 0) || (ret == 1)) { in xmlSchemaBuildAContentModel()
12989 xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
12990 oldstate, pctxt->state); in xmlSchemaBuildAContentModel()
12994 sub = particle->children->children; in xmlSchemaBuildAContentModel()
12999 sub = sub->next; in xmlSchemaBuildAContentModel()
13007 pctxt->state = xmlAutomataNewEpsilon(pctxt->am, in xmlSchemaBuildAContentModel()
13008 pctxt->state, NULL); in xmlSchemaBuildAContentModel()
13010 if (particle->minOccurs == 0) { in xmlSchemaBuildAContentModel()
13011 xmlAutomataNewEpsilon(pctxt->am, oldstate, in xmlSchemaBuildAContentModel()
13012 pctxt->state); in xmlSchemaBuildAContentModel()
13024 start = pctxt->state; in xmlSchemaBuildAContentModel()
13025 end = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildAContentModel()
13031 if (particle->maxOccurs == 1) { in xmlSchemaBuildAContentModel()
13032 sub = particle->children->children; in xmlSchemaBuildAContentModel()
13034 pctxt->state = start; in xmlSchemaBuildAContentModel()
13038 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end); in xmlSchemaBuildAContentModel()
13039 sub = sub->next; in xmlSchemaBuildAContentModel()
13044 int maxOccurs = particle->maxOccurs == UNBOUNDED ? in xmlSchemaBuildAContentModel()
13045 UNBOUNDED : particle->maxOccurs - 1; in xmlSchemaBuildAContentModel()
13047 particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; in xmlSchemaBuildAContentModel()
13054 xmlAutomataNewCounter(pctxt->am, minOccurs, maxOccurs); in xmlSchemaBuildAContentModel()
13055 hop = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildAContentModel()
13056 base = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildAContentModel()
13058 sub = particle->children->children; in xmlSchemaBuildAContentModel()
13060 pctxt->state = base; in xmlSchemaBuildAContentModel()
13064 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop); in xmlSchemaBuildAContentModel()
13065 sub = sub->next; in xmlSchemaBuildAContentModel()
13067 xmlAutomataNewEpsilon(pctxt->am, start, base); in xmlSchemaBuildAContentModel()
13068 xmlAutomataNewCountedTrans(pctxt->am, hop, base, counter); in xmlSchemaBuildAContentModel()
13069 xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter); in xmlSchemaBuildAContentModel()
13071 xmlAutomataNewEpsilon(pctxt->am, base, end); in xmlSchemaBuildAContentModel()
13073 if (particle->minOccurs == 0) { in xmlSchemaBuildAContentModel()
13074 xmlAutomataNewEpsilon(pctxt->am, start, end); in xmlSchemaBuildAContentModel()
13077 pctxt->state = end; in xmlSchemaBuildAContentModel()
13087 sub = (xmlSchemaParticlePtr) particle->children->children; in xmlSchemaBuildAContentModel()
13093 start = pctxt->state; in xmlSchemaBuildAContentModel()
13094 tmp = xmlAutomataNewState(pctxt->am); in xmlSchemaBuildAContentModel()
13095 xmlAutomataNewEpsilon(pctxt->am, pctxt->state, tmp); in xmlSchemaBuildAContentModel()
13096 pctxt->state = tmp; in xmlSchemaBuildAContentModel()
13098 pctxt->state = tmp; in xmlSchemaBuildAContentModel()
13100 elemDecl = (xmlSchemaElementPtr) sub->children; in xmlSchemaBuildAContentModel()
13112 if (elemDecl->flags & XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD) { in xmlSchemaBuildAContentModel()
13120 counter = xmlAutomataNewCounter(pctxt->am, in xmlSchemaBuildAContentModel()
13121 sub->minOccurs, sub->maxOccurs); in xmlSchemaBuildAContentModel()
13123 sub, counter, pctxt->state); in xmlSchemaBuildAContentModel()
13125 if ((sub->minOccurs == 1) && in xmlSchemaBuildAContentModel()
13126 (sub->maxOccurs == 1)) { in xmlSchemaBuildAContentModel()
13127 xmlAutomataNewOnceTrans2(pctxt->am, pctxt->state, in xmlSchemaBuildAContentModel()
13128 pctxt->state, in xmlSchemaBuildAContentModel()
13129 elemDecl->name, in xmlSchemaBuildAContentModel()
13130 elemDecl->targetNamespace, in xmlSchemaBuildAContentModel()
13132 } else if ((sub->minOccurs == 0) && in xmlSchemaBuildAContentModel()
13133 (sub->maxOccurs == 1)) { in xmlSchemaBuildAContentModel()
13135 xmlAutomataNewCountTrans2(pctxt->am, pctxt->state, in xmlSchemaBuildAContentModel()
13136 pctxt->state, in xmlSchemaBuildAContentModel()
13137 elemDecl->name, in xmlSchemaBuildAContentModel()
13138 elemDecl->targetNamespace, in xmlSchemaBuildAContentModel()
13144 sub = (xmlSchemaParticlePtr) sub->next; in xmlSchemaBuildAContentModel()
13146 pctxt->state = in xmlSchemaBuildAContentModel()
13147 xmlAutomataNewAllTrans(pctxt->am, pctxt->state, NULL, 0); in xmlSchemaBuildAContentModel()
13148 if (particle->minOccurs == 0) { in xmlSchemaBuildAContentModel()
13149 xmlAutomataNewEpsilon(pctxt->am, start, pctxt->state); in xmlSchemaBuildAContentModel()
13168 WXS_ITEM_TYPE_NAME(particle->children), NULL); in xmlSchemaBuildAContentModel()
13186 if ((type->type != XML_SCHEMA_TYPE_COMPLEX) || in xmlSchemaBuildContentModel()
13187 (type->contModel != NULL) || in xmlSchemaBuildContentModel()
13188 ((type->contentType != XML_SCHEMA_CONTENT_ELEMENTS) && in xmlSchemaBuildContentModel()
13189 (type->contentType != XML_SCHEMA_CONTENT_MIXED))) in xmlSchemaBuildContentModel()
13196 ctxt->am = NULL; in xmlSchemaBuildContentModel()
13197 ctxt->am = xmlNewAutomata(); in xmlSchemaBuildContentModel()
13198 if (ctxt->am == NULL) { in xmlSchemaBuildContentModel()
13200 "Cannot create automata for complex type %s\n", type->name); in xmlSchemaBuildContentModel()
13203 ctxt->state = xmlAutomataGetInitState(ctxt->am); in xmlSchemaBuildContentModel()
13208 xmlAutomataSetFinalState(ctxt->am, ctxt->state); in xmlSchemaBuildContentModel()
13209 type->contModel = xmlAutomataCompile(ctxt->am); in xmlSchemaBuildContentModel()
13210 if (type->contModel == NULL) { in xmlSchemaBuildContentModel()
13213 WXS_BASIC_CAST type, type->node, in xmlSchemaBuildContentModel()
13215 } else if (xmlRegexpIsDeterminist(type->contModel) != 1) { in xmlSchemaBuildContentModel()
13219 WXS_BASIC_CAST type, type->node, in xmlSchemaBuildContentModel()
13224 "Content model of %s:\n", type->name); in xmlSchemaBuildContentModel()
13225 xmlRegexpPrint(stderr, type->contModel); in xmlSchemaBuildContentModel()
13228 ctxt->state = NULL; in xmlSchemaBuildContentModel()
13229 xmlFreeAutomata(ctxt->am); in xmlSchemaBuildContentModel()
13230 ctxt->am = NULL; in xmlSchemaBuildContentModel()
13248 (elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_RESOLVED))) in xmlSchemaResolveElementReferences()
13250 elemDecl->flags |= XML_SCHEMAS_ELEM_INTERNAL_RESOLVED; in xmlSchemaResolveElementReferences()
13252 if ((elemDecl->subtypes == NULL) && (elemDecl->namedType != NULL)) { in xmlSchemaResolveElementReferences()
13258 type = xmlSchemaGetType(ctxt->schema, elemDecl->namedType, in xmlSchemaResolveElementReferences()
13259 elemDecl->namedTypeNs); in xmlSchemaResolveElementReferences()
13263 WXS_BASIC_CAST elemDecl, elemDecl->node, in xmlSchemaResolveElementReferences()
13264 "type", elemDecl->namedType, elemDecl->namedTypeNs, in xmlSchemaResolveElementReferences()
13267 elemDecl->subtypes = type; in xmlSchemaResolveElementReferences()
13269 if (elemDecl->substGroup != NULL) { in xmlSchemaResolveElementReferences()
13276 substHead = xmlSchemaGetElem(ctxt->schema, elemDecl->substGroup, in xmlSchemaResolveElementReferences()
13277 elemDecl->substGroupNs); in xmlSchemaResolveElementReferences()
13282 "substitutionGroup", elemDecl->substGroup, in xmlSchemaResolveElementReferences()
13283 elemDecl->substGroupNs, XML_SCHEMA_TYPE_ELEMENT, NULL); in xmlSchemaResolveElementReferences()
13297 if (elemDecl->subtypes == NULL) in xmlSchemaResolveElementReferences()
13298 elemDecl->subtypes = substHead->subtypes; in xmlSchemaResolveElementReferences()
13305 if ((elemDecl->subtypes == NULL) && in xmlSchemaResolveElementReferences()
13306 (elemDecl->namedType == NULL) && in xmlSchemaResolveElementReferences()
13307 (elemDecl->substGroup == NULL)) in xmlSchemaResolveElementReferences()
13308 elemDecl->subtypes = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); in xmlSchemaResolveElementReferences()
13320 * Returns -1 in case of an internal error, 0 otherwise.
13340 link = type->memberTypes; in xmlSchemaResolveUnionMemberTypes()
13345 name = ((xmlSchemaQNameRefPtr) link->type)->name; in xmlSchemaResolveUnionMemberTypes()
13346 nsName = ((xmlSchemaQNameRefPtr) link->type)->targetNamespace; in xmlSchemaResolveUnionMemberTypes()
13348 memberType = xmlSchemaGetType(ctxt->schema, name, nsName); in xmlSchemaResolveUnionMemberTypes()
13351 WXS_BASIC_CAST type, type->node, "memberTypes", in xmlSchemaResolveUnionMemberTypes()
13357 type->memberTypes = link->next; in xmlSchemaResolveUnionMemberTypes()
13359 lastLink->next = link->next; in xmlSchemaResolveUnionMemberTypes()
13361 link = link->next; in xmlSchemaResolveUnionMemberTypes()
13364 link->type = memberType; in xmlSchemaResolveUnionMemberTypes()
13366 link = link->next; in xmlSchemaResolveUnionMemberTypes()
13372 memberType = type->subtypes; in xmlSchemaResolveUnionMemberTypes()
13377 return (-1); in xmlSchemaResolveUnionMemberTypes()
13379 link->type = memberType; in xmlSchemaResolveUnionMemberTypes()
13380 link->next = NULL; in xmlSchemaResolveUnionMemberTypes()
13382 type->memberTypes = link; in xmlSchemaResolveUnionMemberTypes()
13384 lastLink->next = link; in xmlSchemaResolveUnionMemberTypes()
13386 memberType = memberType->next; in xmlSchemaResolveUnionMemberTypes()
13408 if (type->type == XML_SCHEMA_TYPE_BASIC) { in xmlSchemaIsDerivedFromBuiltInType()
13409 if (type->builtInType == valType) in xmlSchemaIsDerivedFromBuiltInType()
13411 if ((type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) || in xmlSchemaIsDerivedFromBuiltInType()
13412 (type->builtInType == XML_SCHEMAS_ANYTYPE)) in xmlSchemaIsDerivedFromBuiltInType()
13414 return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType)); in xmlSchemaIsDerivedFromBuiltInType()
13416 return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType)); in xmlSchemaIsDerivedFromBuiltInType()
13437 if (type->type == XML_SCHEMA_TYPE_BASIC) {
13438 if (type->builtInType == valType)
13442 return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType));
13454 if (type->type == XML_SCHEMA_TYPE_BASIC)
13456 return(xmlSchemaQueryBuiltInType(type->subtypes));
13476 if ((type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) || in xmlSchemaGetPrimitiveType()
13477 (type->flags & XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE)) in xmlSchemaGetPrimitiveType()
13479 type = type->baseType; in xmlSchemaGetPrimitiveType()
13499 if (type->type == XML_SCHEMA_TYPE_BASIC)
13501 type = type->baseType;
13516 * Returns -1 on internal error, 0 otherwise.
13526 return(-1); in xmlSchemaCloneWildcardNsConstraints()
13527 dest->any = source->any; in xmlSchemaCloneWildcardNsConstraints()
13528 cur = source->nsSet; in xmlSchemaCloneWildcardNsConstraints()
13533 return(-1); in xmlSchemaCloneWildcardNsConstraints()
13534 tmp->value = cur->value; in xmlSchemaCloneWildcardNsConstraints()
13536 dest->nsSet = tmp; in xmlSchemaCloneWildcardNsConstraints()
13538 last->next = tmp; in xmlSchemaCloneWildcardNsConstraints()
13540 cur = cur->next; in xmlSchemaCloneWildcardNsConstraints()
13542 if (dest->negNsSet != NULL) in xmlSchemaCloneWildcardNsConstraints()
13543 xmlSchemaFreeWildcardNsSet(dest->negNsSet); in xmlSchemaCloneWildcardNsConstraints()
13544 if (source->negNsSet != NULL) { in xmlSchemaCloneWildcardNsConstraints()
13545 dest->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); in xmlSchemaCloneWildcardNsConstraints()
13546 if (dest->negNsSet == NULL) in xmlSchemaCloneWildcardNsConstraints()
13547 return(-1); in xmlSchemaCloneWildcardNsConstraints()
13548 dest->negNsSet->value = source->negNsSet->value; in xmlSchemaCloneWildcardNsConstraints()
13550 dest->negNsSet = NULL; in xmlSchemaCloneWildcardNsConstraints()
13562 * Returns a positive error code on failure, -1 in case of an
13576 if ((completeWild->any == curWild->any) && in xmlSchemaUnionWildcards()
13577 ((completeWild->nsSet == NULL) == (curWild->nsSet == NULL)) && in xmlSchemaUnionWildcards()
13578 ((completeWild->negNsSet == NULL) == (curWild->negNsSet == NULL))) { in xmlSchemaUnionWildcards()
13580 if ((completeWild->negNsSet == NULL) || in xmlSchemaUnionWildcards()
13581 (completeWild->negNsSet->value == curWild->negNsSet->value)) { in xmlSchemaUnionWildcards()
13583 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13589 cur = completeWild->nsSet; in xmlSchemaUnionWildcards()
13592 curB = curWild->nsSet; in xmlSchemaUnionWildcards()
13594 if (cur->value == curB->value) { in xmlSchemaUnionWildcards()
13598 curB = curB->next; in xmlSchemaUnionWildcards()
13602 cur = cur->next; in xmlSchemaUnionWildcards()
13613 if (completeWild->any != curWild->any) { in xmlSchemaUnionWildcards()
13614 if (completeWild->any == 0) { in xmlSchemaUnionWildcards()
13615 completeWild->any = 1; in xmlSchemaUnionWildcards()
13616 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13617 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); in xmlSchemaUnionWildcards()
13618 completeWild->nsSet = NULL; in xmlSchemaUnionWildcards()
13620 if (completeWild->negNsSet != NULL) { in xmlSchemaUnionWildcards()
13621 xmlFree(completeWild->negNsSet); in xmlSchemaUnionWildcards()
13622 completeWild->negNsSet = NULL; in xmlSchemaUnionWildcards()
13631 if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { in xmlSchemaUnionWildcards()
13635 cur = curWild->nsSet; in xmlSchemaUnionWildcards()
13636 start = completeWild->nsSet; in xmlSchemaUnionWildcards()
13641 if (cur->value == curB->value) { in xmlSchemaUnionWildcards()
13645 curB = curB->next; in xmlSchemaUnionWildcards()
13650 return (-1); in xmlSchemaUnionWildcards()
13651 tmp->value = cur->value; in xmlSchemaUnionWildcards()
13652 tmp->next = completeWild->nsSet; in xmlSchemaUnionWildcards()
13653 completeWild->nsSet = tmp; in xmlSchemaUnionWildcards()
13655 cur = cur->next; in xmlSchemaUnionWildcards()
13664 if ((completeWild->negNsSet != NULL) && in xmlSchemaUnionWildcards()
13665 (curWild->negNsSet != NULL) && in xmlSchemaUnionWildcards()
13666 (completeWild->negNsSet->value != curWild->negNsSet->value)) { in xmlSchemaUnionWildcards()
13667 completeWild->negNsSet->value = NULL; in xmlSchemaUnionWildcards()
13674 if (((completeWild->negNsSet != NULL) && in xmlSchemaUnionWildcards()
13675 (completeWild->negNsSet->value != NULL) && in xmlSchemaUnionWildcards()
13676 (curWild->nsSet != NULL)) || in xmlSchemaUnionWildcards()
13677 ((curWild->negNsSet != NULL) && in xmlSchemaUnionWildcards()
13678 (curWild->negNsSet->value != NULL) && in xmlSchemaUnionWildcards()
13679 (completeWild->nsSet != NULL))) { in xmlSchemaUnionWildcards()
13683 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13684 cur = completeWild->nsSet; in xmlSchemaUnionWildcards()
13685 curB = curWild->negNsSet; in xmlSchemaUnionWildcards()
13687 cur = curWild->nsSet; in xmlSchemaUnionWildcards()
13688 curB = completeWild->negNsSet; in xmlSchemaUnionWildcards()
13692 if (cur->value == NULL) in xmlSchemaUnionWildcards()
13694 else if (cur->value == curB->value) in xmlSchemaUnionWildcards()
13698 cur = cur->next; in xmlSchemaUnionWildcards()
13706 completeWild->any = 1; in xmlSchemaUnionWildcards()
13707 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13708 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); in xmlSchemaUnionWildcards()
13709 completeWild->nsSet = NULL; in xmlSchemaUnionWildcards()
13711 if (completeWild->negNsSet != NULL) { in xmlSchemaUnionWildcards()
13712 xmlFree(completeWild->negNsSet); in xmlSchemaUnionWildcards()
13713 completeWild->negNsSet = NULL; in xmlSchemaUnionWildcards()
13721 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13722 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); in xmlSchemaUnionWildcards()
13723 completeWild->nsSet = NULL; in xmlSchemaUnionWildcards()
13725 if (completeWild->negNsSet == NULL) { in xmlSchemaUnionWildcards()
13726 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); in xmlSchemaUnionWildcards()
13727 if (completeWild->negNsSet == NULL) in xmlSchemaUnionWildcards()
13728 return (-1); in xmlSchemaUnionWildcards()
13730 completeWild->negNsSet->value = NULL; in xmlSchemaUnionWildcards()
13736 xmlSchemaPErr(ctxt, completeWild->node, in xmlSchemaUnionWildcards()
13747 if (completeWild->negNsSet == NULL) { in xmlSchemaUnionWildcards()
13748 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13749 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); in xmlSchemaUnionWildcards()
13750 completeWild->nsSet = NULL; in xmlSchemaUnionWildcards()
13752 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); in xmlSchemaUnionWildcards()
13753 if (completeWild->negNsSet == NULL) in xmlSchemaUnionWildcards()
13754 return (-1); in xmlSchemaUnionWildcards()
13755 completeWild->negNsSet->value = curWild->negNsSet->value; in xmlSchemaUnionWildcards()
13763 if (((completeWild->negNsSet != NULL) && in xmlSchemaUnionWildcards()
13764 (completeWild->negNsSet->value == NULL) && in xmlSchemaUnionWildcards()
13765 (curWild->nsSet != NULL)) || in xmlSchemaUnionWildcards()
13766 ((curWild->negNsSet != NULL) && in xmlSchemaUnionWildcards()
13767 (curWild->negNsSet->value == NULL) && in xmlSchemaUnionWildcards()
13768 (completeWild->nsSet != NULL))) { in xmlSchemaUnionWildcards()
13770 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13771 cur = completeWild->nsSet; in xmlSchemaUnionWildcards()
13773 cur = curWild->nsSet; in xmlSchemaUnionWildcards()
13776 if (cur->value == NULL) { in xmlSchemaUnionWildcards()
13781 completeWild->any = 1; in xmlSchemaUnionWildcards()
13782 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13783 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); in xmlSchemaUnionWildcards()
13784 completeWild->nsSet = NULL; in xmlSchemaUnionWildcards()
13786 if (completeWild->negNsSet != NULL) { in xmlSchemaUnionWildcards()
13787 xmlFree(completeWild->negNsSet); in xmlSchemaUnionWildcards()
13788 completeWild->negNsSet = NULL; in xmlSchemaUnionWildcards()
13792 cur = cur->next; in xmlSchemaUnionWildcards()
13794 if (completeWild->negNsSet == NULL) { in xmlSchemaUnionWildcards()
13799 if (completeWild->nsSet != NULL) { in xmlSchemaUnionWildcards()
13800 xmlSchemaFreeWildcardNsSet(completeWild->nsSet); in xmlSchemaUnionWildcards()
13801 completeWild->nsSet = NULL; in xmlSchemaUnionWildcards()
13803 completeWild->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); in xmlSchemaUnionWildcards()
13804 if (completeWild->negNsSet == NULL) in xmlSchemaUnionWildcards()
13805 return (-1); in xmlSchemaUnionWildcards()
13806 completeWild->negNsSet->value = NULL; in xmlSchemaUnionWildcards()
13822 * Returns a positive error code on failure, -1 in case of an
13836 if ((completeWild->any == curWild->any) && in xmlSchemaIntersectWildcards()
13837 ((completeWild->nsSet == NULL) == (curWild->nsSet == NULL)) && in xmlSchemaIntersectWildcards()
13838 ((completeWild->negNsSet == NULL) == (curWild->negNsSet == NULL))) { in xmlSchemaIntersectWildcards()
13840 if ((completeWild->negNsSet == NULL) || in xmlSchemaIntersectWildcards()
13841 (completeWild->negNsSet->value == curWild->negNsSet->value)) { in xmlSchemaIntersectWildcards()
13843 if (completeWild->nsSet != NULL) { in xmlSchemaIntersectWildcards()
13849 cur = completeWild->nsSet; in xmlSchemaIntersectWildcards()
13852 curB = curWild->nsSet; in xmlSchemaIntersectWildcards()
13854 if (cur->value == curB->value) { in xmlSchemaIntersectWildcards()
13858 curB = curB->next; in xmlSchemaIntersectWildcards()
13862 cur = cur->next; in xmlSchemaIntersectWildcards()
13873 if ((completeWild->any != curWild->any) && (completeWild->any)) { in xmlSchemaIntersectWildcards()
13874 if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1) in xmlSchemaIntersectWildcards()
13875 return(-1); in xmlSchemaIntersectWildcards()
13884 if (((completeWild->negNsSet != NULL) && (curWild->nsSet != NULL)) || in xmlSchemaIntersectWildcards()
13885 ((curWild->negNsSet != NULL) && (completeWild->nsSet != NULL))) { in xmlSchemaIntersectWildcards()
13888 if (completeWild->nsSet == NULL) { in xmlSchemaIntersectWildcards()
13889 neg = completeWild->negNsSet->value; in xmlSchemaIntersectWildcards()
13890 if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1) in xmlSchemaIntersectWildcards()
13891 return(-1); in xmlSchemaIntersectWildcards()
13893 neg = curWild->negNsSet->value; in xmlSchemaIntersectWildcards()
13898 cur = completeWild->nsSet; in xmlSchemaIntersectWildcards()
13900 if (cur->value == NULL) { in xmlSchemaIntersectWildcards()
13902 completeWild->nsSet = cur->next; in xmlSchemaIntersectWildcards()
13904 prev->next = cur->next; in xmlSchemaIntersectWildcards()
13909 cur = cur->next; in xmlSchemaIntersectWildcards()
13913 cur = completeWild->nsSet; in xmlSchemaIntersectWildcards()
13915 if (cur->value == neg) { in xmlSchemaIntersectWildcards()
13917 completeWild->nsSet = cur->next; in xmlSchemaIntersectWildcards()
13919 prev->next = cur->next; in xmlSchemaIntersectWildcards()
13924 cur = cur->next; in xmlSchemaIntersectWildcards()
13934 if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { in xmlSchemaIntersectWildcards()
13937 cur = completeWild->nsSet; in xmlSchemaIntersectWildcards()
13941 curB = curWild->nsSet; in xmlSchemaIntersectWildcards()
13943 if (cur->value == curB->value) { in xmlSchemaIntersectWildcards()
13947 curB = curB->next; in xmlSchemaIntersectWildcards()
13951 completeWild->nsSet = cur->next; in xmlSchemaIntersectWildcards()
13953 prev->next = cur->next; in xmlSchemaIntersectWildcards()
13954 tmp = cur->next; in xmlSchemaIntersectWildcards()
13960 cur = cur->next; in xmlSchemaIntersectWildcards()
13968 if ((completeWild->negNsSet != NULL) && in xmlSchemaIntersectWildcards()
13969 (curWild->negNsSet != NULL) && in xmlSchemaIntersectWildcards()
13970 (completeWild->negNsSet->value != curWild->negNsSet->value) && in xmlSchemaIntersectWildcards()
13971 (completeWild->negNsSet->value != NULL) && in xmlSchemaIntersectWildcards()
13972 (curWild->negNsSet->value != NULL)) { in xmlSchemaIntersectWildcards()
13974 xmlSchemaPErr(ctxt, completeWild->node, XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, in xmlSchemaIntersectWildcards()
13984 if ((completeWild->negNsSet != NULL) && (curWild->negNsSet != NULL) && in xmlSchemaIntersectWildcards()
13985 (completeWild->negNsSet->value != curWild->negNsSet->value) && in xmlSchemaIntersectWildcards()
13986 (completeWild->negNsSet->value == NULL)) { in xmlSchemaIntersectWildcards()
13987 completeWild->negNsSet->value = curWild->negNsSet->value; in xmlSchemaIntersectWildcards()
13998 * Schema Component Constraint: Wildcard Subset (cos-ns-subset)
14010 if (super->any) in xmlSchemaCheckCOSNSSubset()
14016 if ((sub->negNsSet != NULL) && in xmlSchemaCheckCOSNSSubset()
14017 (super->negNsSet != NULL) && in xmlSchemaCheckCOSNSSubset()
14018 (sub->negNsSet->value == super->negNsSet->value)) in xmlSchemaCheckCOSNSSubset()
14023 if (sub->nsSet != NULL) { in xmlSchemaCheckCOSNSSubset()
14027 if (super->nsSet != NULL) { in xmlSchemaCheckCOSNSSubset()
14031 cur = sub->nsSet; in xmlSchemaCheckCOSNSSubset()
14034 curB = super->nsSet; in xmlSchemaCheckCOSNSSubset()
14036 if (cur->value == curB->value) { in xmlSchemaCheckCOSNSSubset()
14040 curB = curB->next; in xmlSchemaCheckCOSNSSubset()
14044 cur = cur->next; in xmlSchemaCheckCOSNSSubset()
14048 } else if (super->negNsSet != NULL) { in xmlSchemaCheckCOSNSSubset()
14054 cur = sub->nsSet; in xmlSchemaCheckCOSNSSubset()
14056 if (cur->value == super->negNsSet->value) in xmlSchemaCheckCOSNSSubset()
14058 cur = cur->next; in xmlSchemaCheckCOSNSSubset()
14077 if (attruse->defValue != NULL) { in xmlSchemaGetEffectiveValueConstraint()
14078 *value = attruse->defValue; in xmlSchemaGetEffectiveValueConstraint()
14080 *val = attruse->defVal; in xmlSchemaGetEffectiveValueConstraint()
14081 if (attruse->flags & XML_SCHEMA_ATTR_USE_FIXED) in xmlSchemaGetEffectiveValueConstraint()
14084 } else if ((attruse->attrDecl != NULL) && in xmlSchemaGetEffectiveValueConstraint()
14085 (attruse->attrDecl->defValue != NULL)) { in xmlSchemaGetEffectiveValueConstraint()
14086 *value = attruse->attrDecl->defValue; in xmlSchemaGetEffectiveValueConstraint()
14088 *val = attruse->attrDecl->defVal; in xmlSchemaGetEffectiveValueConstraint()
14089 if (attruse->attrDecl->flags & XML_SCHEMAS_ATTR_FIXED) in xmlSchemaGetEffectiveValueConstraint()
14100 * Validation Rule: Wildcard allows Namespace Name
14101 * (cvc-wildcard-namespace)
14104 * 1 otherwise and -1 on API errors.
14111 return(-1); in xmlSchemaCheckCVCWildcardNamespace()
14113 if (wild->any) in xmlSchemaCheckCVCWildcardNamespace()
14115 else if (wild->nsSet != NULL) { in xmlSchemaCheckCVCWildcardNamespace()
14118 cur = wild->nsSet; in xmlSchemaCheckCVCWildcardNamespace()
14120 if (xmlStrEqual(cur->value, ns)) in xmlSchemaCheckCVCWildcardNamespace()
14122 cur = cur->next; in xmlSchemaCheckCVCWildcardNamespace()
14124 } else if ((wild->negNsSet != NULL) && (ns != NULL) && in xmlSchemaCheckCVCWildcardNamespace()
14125 (!xmlStrEqual(wild->negNsSet->value, ns))) in xmlSchemaCheckCVCWildcardNamespace()
14140 * derivation-ok-restriction (2) - (4)
14144 * Validation Rule:
14164 for (i = 0; i < uses->nbItems; i++) { in xmlSchemaCheckDerivationOKRestriction2to4()
14165 cur = uses->items[i]; in xmlSchemaCheckDerivationOKRestriction2to4()
14169 for (j = 0; j < baseUses->nbItems; j++) { in xmlSchemaCheckDerivationOKRestriction2to4()
14170 bcur = baseUses->items[j]; in xmlSchemaCheckDerivationOKRestriction2to4()
14184 if ((cur->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && in xmlSchemaCheckDerivationOKRestriction2to4()
14185 (bcur->occurs == XML_SCHEMAS_ATTR_USE_REQUIRED)) in xmlSchemaCheckDerivationOKRestriction2to4()
14203 /* err = pctxt->err; */ in xmlSchemaCheckDerivationOKRestriction2to4()
14233 /* err = pctxt->err; */ in xmlSchemaCheckDerivationOKRestriction2to4()
14260 * string-equality might really be sufficient. in xmlSchemaCheckDerivationOKRestriction2to4()
14278 /* err = pctxt->err; */ in xmlSchemaCheckDerivationOKRestriction2to4()
14296 (WXS_ATTRUSE_DECL(cur))->targetNamespace) != 0)) in xmlSchemaCheckDerivationOKRestriction2to4()
14309 /* err = pctxt->err; */ in xmlSchemaCheckDerivationOKRestriction2to4()
14315 * SPEC derivation-ok-restriction (3): in xmlSchemaCheckDerivationOKRestriction2to4()
14323 for (j = 0; j < baseUses->nbItems; j++) { in xmlSchemaCheckDerivationOKRestriction2to4()
14324 bcur = baseUses->items[j]; in xmlSchemaCheckDerivationOKRestriction2to4()
14325 if (bcur->occurs != XML_SCHEMAS_ATTR_USE_REQUIRED) in xmlSchemaCheckDerivationOKRestriction2to4()
14329 for (i = 0; i < uses->nbItems; i++) { in xmlSchemaCheckDerivationOKRestriction2to4()
14330 cur = uses->items[i]; in xmlSchemaCheckDerivationOKRestriction2to4()
14358 * derivation-ok-restriction (4) in xmlSchemaCheckDerivationOKRestriction2to4()
14381 return(pctxt->err); in xmlSchemaCheckDerivationOKRestriction2to4()
14382 } else if ((baseWild->any == 0) && in xmlSchemaCheckDerivationOKRestriction2to4()
14402 return(pctxt->err); in xmlSchemaCheckDerivationOKRestriction2to4()
14404 /* 4.3 Unless the {base type definition} is the `ur-type in xmlSchemaCheckDerivationOKRestriction2to4()
14412 (wild->processContents < baseWild->processContents)) { in xmlSchemaCheckDerivationOKRestriction2to4()
14424 return(pctxt->err); in xmlSchemaCheckDerivationOKRestriction2to4()
14444 * Returns -1 if an internal error occurs, 0 otherwise.
14459 if (type->baseType == NULL) { in xmlSchemaFixupTypeAttributeUses()
14462 return (-1); in xmlSchemaFixupTypeAttributeUses()
14464 baseType = type->baseType; in xmlSchemaFixupTypeAttributeUses()
14466 if (xmlSchemaTypeFixup(baseType, ACTXT_CAST pctxt) == -1) in xmlSchemaFixupTypeAttributeUses()
14467 return(-1); in xmlSchemaFixupTypeAttributeUses()
14469 uses = type->attrUses; in xmlSchemaFixupTypeAttributeUses()
14470 baseUses = baseType->attrUses; in xmlSchemaFixupTypeAttributeUses()
14480 * into pctxt->attrProhibs. in xmlSchemaFixupTypeAttributeUses()
14483 WXS_BASIC_CAST type, &(type->attributeWildcard), uses, in xmlSchemaFixupTypeAttributeUses()
14484 pctxt->attrProhibs) == -1) in xmlSchemaFixupTypeAttributeUses()
14489 if (pctxt->attrProhibs->nbItems != 0) in xmlSchemaFixupTypeAttributeUses()
14490 prohibs = pctxt->attrProhibs; in xmlSchemaFixupTypeAttributeUses()
14493 WXS_BASIC_CAST type, &(type->attributeWildcard), uses, in xmlSchemaFixupTypeAttributeUses()
14494 NULL) == -1) in xmlSchemaFixupTypeAttributeUses()
14513 usesCount = uses->nbItems; in xmlSchemaFixupTypeAttributeUses()
14518 for (i = 0; i < baseUses->nbItems; i++) { in xmlSchemaFixupTypeAttributeUses()
14519 use = baseUses->items[i]; in xmlSchemaFixupTypeAttributeUses()
14524 for (j = 0; j < prohibs->nbItems; j++) { in xmlSchemaFixupTypeAttributeUses()
14525 pro = prohibs->items[j]; in xmlSchemaFixupTypeAttributeUses()
14526 if ((WXS_ATTRUSE_DECL_NAME(use) == pro->name) && in xmlSchemaFixupTypeAttributeUses()
14528 pro->targetNamespace)) in xmlSchemaFixupTypeAttributeUses()
14539 tmp = uses->items[j]; in xmlSchemaFixupTypeAttributeUses()
14550 type->attrUses = xmlSchemaItemListCreate(); in xmlSchemaFixupTypeAttributeUses()
14551 if (type->attrUses == NULL) in xmlSchemaFixupTypeAttributeUses()
14553 uses = type->attrUses; in xmlSchemaFixupTypeAttributeUses()
14560 for (i = 0; i < baseUses->nbItems; i++) { in xmlSchemaFixupTypeAttributeUses()
14561 use = baseUses->items[i]; in xmlSchemaFixupTypeAttributeUses()
14563 type->attrUses = xmlSchemaItemListCreate(); in xmlSchemaFixupTypeAttributeUses()
14564 if (type->attrUses == NULL) in xmlSchemaFixupTypeAttributeUses()
14566 uses = type->attrUses; in xmlSchemaFixupTypeAttributeUses()
14568 xmlSchemaItemListAddSize(uses, baseUses->nbItems, use); in xmlSchemaFixupTypeAttributeUses()
14576 if (uses->nbItems == 0) { in xmlSchemaFixupTypeAttributeUses()
14578 type->attrUses = NULL; in xmlSchemaFixupTypeAttributeUses()
14589 if (baseType->attributeWildcard != NULL) { in xmlSchemaFixupTypeAttributeUses()
14591 * (3.2.2.1) "If the `base wildcard` is non-`absent`, then in xmlSchemaFixupTypeAttributeUses()
14594 if (type->attributeWildcard != NULL) { in xmlSchemaFixupTypeAttributeUses()
14605 if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard, in xmlSchemaFixupTypeAttributeUses()
14606 baseType->attributeWildcard) == -1) in xmlSchemaFixupTypeAttributeUses()
14613 type->attributeWildcard = baseType->attributeWildcard; in xmlSchemaFixupTypeAttributeUses()
14634 return(-1); in xmlSchemaFixupTypeAttributeUses()
14654 if (type->flags & final) in xmlSchemaTypeFinalContains()
14670 while ((type != NULL) && (type->type == XML_SCHEMA_TYPE_SIMPLE)) { in xmlSchemaGetUnionSimpleTypeMemberTypes()
14671 if (type->memberTypes != NULL) in xmlSchemaGetUnionSimpleTypeMemberTypes()
14672 return (type->memberTypes); in xmlSchemaGetUnionSimpleTypeMemberTypes()
14674 type = type->baseType; in xmlSchemaGetUnionSimpleTypeMemberTypes()
14691 if ((particle->children == NULL) || in xmlSchemaGetParticleTotalRangeMin()
14692 (particle->minOccurs == 0)) in xmlSchemaGetParticleTotalRangeMin()
14694 if (particle->children->type == XML_SCHEMA_TYPE_CHOICE) { in xmlSchemaGetParticleTotalRangeMin()
14695 int min = -1, cur; in xmlSchemaGetParticleTotalRangeMin()
14697 (xmlSchemaParticlePtr) particle->children->children; in xmlSchemaGetParticleTotalRangeMin()
14702 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) || in xmlSchemaGetParticleTotalRangeMin()
14703 (part->children->type == XML_SCHEMA_TYPE_ANY)) in xmlSchemaGetParticleTotalRangeMin()
14704 cur = part->minOccurs; in xmlSchemaGetParticleTotalRangeMin()
14709 if ((min > cur) || (min == -1)) in xmlSchemaGetParticleTotalRangeMin()
14711 part = (xmlSchemaParticlePtr) part->next; in xmlSchemaGetParticleTotalRangeMin()
14713 return (particle->minOccurs * min); in xmlSchemaGetParticleTotalRangeMin()
14718 (xmlSchemaParticlePtr) particle->children->children; in xmlSchemaGetParticleTotalRangeMin()
14723 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) || in xmlSchemaGetParticleTotalRangeMin()
14724 (part->children->type == XML_SCHEMA_TYPE_ANY)) in xmlSchemaGetParticleTotalRangeMin()
14725 sum += part->minOccurs; in xmlSchemaGetParticleTotalRangeMin()
14728 part = (xmlSchemaParticlePtr) part->next; in xmlSchemaGetParticleTotalRangeMin()
14730 return (particle->minOccurs * sum); in xmlSchemaGetParticleTotalRangeMin()
14747 if ((particle->children == NULL) ||
14748 (particle->children->children == NULL))
14750 if (particle->children->type == XML_SCHEMA_TYPE_CHOICE) {
14751 int max = -1, cur;
14753 (xmlSchemaParticlePtr) particle->children->children;
14755 for (; part != NULL; part = (xmlSchemaParticlePtr) part->next) {
14756 if (part->children == NULL)
14758 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) ||
14759 (part->children->type == XML_SCHEMA_TYPE_ANY))
14760 cur = part->maxOccurs;
14765 if ((max < cur) || (max == -1))
14769 return (particle->maxOccurs * max);
14774 (xmlSchemaParticlePtr) particle->children->children;
14776 for (; part != NULL; part = (xmlSchemaParticlePtr) part->next) {
14777 if (part->children == NULL)
14779 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) ||
14780 (part->children->type == XML_SCHEMA_TYPE_ANY))
14781 cur = part->maxOccurs;
14786 if ((cur > 0) && (particle->maxOccurs == UNBOUNDED))
14791 return (particle->maxOccurs * sum);
14811 if ((particle == NULL) || (particle->minOccurs == 0) || in xmlSchemaIsParticleEmptiable()
14812 (particle->children == NULL)) in xmlSchemaIsParticleEmptiable()
14818 if (WXS_IS_MODEL_GROUP(particle->children)) { in xmlSchemaIsParticleEmptiable()
14833 * Type Derivation OK (Simple) (cos-st-derived-OK)
14862 if (xmlSchemaTypeFixup(type, actxt) == -1) in xmlSchemaCheckCOSSTDerivedOK()
14863 return(-1); in xmlSchemaCheckCOSSTDerivedOK()
14865 if (xmlSchemaTypeFixup(baseType, actxt) == -1) in xmlSchemaCheckCOSSTDerivedOK()
14866 return(-1); in xmlSchemaCheckCOSSTDerivedOK()
14868 (xmlSchemaTypeFinalContains(type->baseType, in xmlSchemaCheckCOSSTDerivedOK()
14873 if (type->baseType == baseType) { in xmlSchemaCheckCOSSTDerivedOK()
14880 * 2.2.2 D's `base type definition` is not the `ur-type definition` in xmlSchemaCheckCOSSTDerivedOK()
14884 if ((! WXS_IS_ANYTYPE(type->baseType)) && in xmlSchemaCheckCOSSTDerivedOK()
14885 (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, in xmlSchemaCheckCOSSTDerivedOK()
14890 * 2.2.3 D's {variety} is list or union and B is the `simple ur-type in xmlSchemaCheckCOSSTDerivedOK()
14902 * NOTE: This seems not to involve built-in types, since there is no in xmlSchemaCheckCOSSTDerivedOK()
14903 * built-in Union Simple Type. in xmlSchemaCheckCOSSTDerivedOK()
14908 cur = baseType->memberTypes; in xmlSchemaCheckCOSSTDerivedOK()
14910 if (WXS_IS_TYPE_NOT_FIXED(cur->type)) in xmlSchemaCheckCOSSTDerivedOK()
14911 if (xmlSchemaTypeFixup(cur->type, actxt) == -1) in xmlSchemaCheckCOSSTDerivedOK()
14912 return(-1); in xmlSchemaCheckCOSSTDerivedOK()
14914 type, cur->type, subset) == 0) in xmlSchemaCheckCOSSTDerivedOK()
14918 * member-type. in xmlSchemaCheckCOSSTDerivedOK()
14922 cur = cur->next; in xmlSchemaCheckCOSSTDerivedOK()
14934 * Checks st-props-correct (2) + ct-props-correct (3).
14947 if ((ancestor == NULL) || (ancestor->type == XML_SCHEMA_TYPE_BASIC)) in xmlSchemaCheckTypeDefCircularInternal()
14957 if (ancestor->flags & XML_SCHEMAS_TYPE_MARKED) { in xmlSchemaCheckTypeDefCircularInternal()
14963 ancestor->flags |= XML_SCHEMAS_TYPE_MARKED; in xmlSchemaCheckTypeDefCircularInternal()
14965 ancestor->baseType); in xmlSchemaCheckTypeDefCircularInternal()
14966 ancestor->flags ^= XML_SCHEMAS_TYPE_MARKED; in xmlSchemaCheckTypeDefCircularInternal()
14983 (item->type == XML_SCHEMA_TYPE_BASIC) || in xmlSchemaCheckTypeDefCircular()
14984 (item->baseType == NULL)) in xmlSchemaCheckTypeDefCircular()
14987 item->baseType); in xmlSchemaCheckTypeDefCircular()
14991 * Simple Type Definition Representation OK (src-simple-type) 4
15013 memberType = member->type; in xmlSchemaCheckUnionTypeDefCircularRecur()
15015 (memberType->type != XML_SCHEMA_TYPE_BASIC)) { in xmlSchemaCheckUnionTypeDefCircularRecur()
15024 ((memberType->flags & XML_SCHEMAS_TYPE_MARKED) == 0)) in xmlSchemaCheckUnionTypeDefCircularRecur()
15027 memberType->flags |= XML_SCHEMAS_TYPE_MARKED; in xmlSchemaCheckUnionTypeDefCircularRecur()
15031 memberType->flags ^= XML_SCHEMAS_TYPE_MARKED; in xmlSchemaCheckUnionTypeDefCircularRecur()
15035 memberType = memberType->baseType; in xmlSchemaCheckUnionTypeDefCircularRecur()
15037 member = member->next; in xmlSchemaCheckUnionTypeDefCircularRecur()
15049 type->memberTypes)); in xmlSchemaCheckUnionTypeDefCircular()
15070 if (typeDef->baseType == NULL) { in xmlSchemaResolveTypeReferences()
15071 typeDef->baseType = xmlSchemaGetType(ctxt->schema, in xmlSchemaResolveTypeReferences()
15072 typeDef->base, typeDef->baseNs); in xmlSchemaResolveTypeReferences()
15073 if (typeDef->baseType == NULL) { in xmlSchemaResolveTypeReferences()
15076 WXS_BASIC_CAST typeDef, typeDef->node, in xmlSchemaResolveTypeReferences()
15077 "base", typeDef->base, typeDef->baseNs, in xmlSchemaResolveTypeReferences()
15093 if ((typeDef->subtypes == NULL) && (typeDef->base != NULL)) { in xmlSchemaResolveTypeReferences()
15095 typeDef->subtypes = xmlSchemaGetType(ctxt->schema, in xmlSchemaResolveTypeReferences()
15096 typeDef->base, typeDef->baseNs); in xmlSchemaResolveTypeReferences()
15098 if ((typeDef->subtypes == NULL) || in xmlSchemaResolveTypeReferences()
15099 (! WXS_IS_SIMPLE(typeDef->subtypes))) in xmlSchemaResolveTypeReferences()
15101 typeDef->subtypes = NULL; in xmlSchemaResolveTypeReferences()
15104 WXS_BASIC_CAST typeDef, typeDef->node, in xmlSchemaResolveTypeReferences()
15105 "itemType", typeDef->base, typeDef->baseNs, in xmlSchemaResolveTypeReferences()
15114 * which has a QName-helper component as its {term}, we want in xmlSchemaResolveTypeReferences()
15118 ((WXS_TYPE_CONTENTTYPE(typeDef))->type == in xmlSchemaResolveTypeReferences()
15121 ((WXS_TYPE_PARTICLE_TERM(typeDef))->type == in xmlSchemaResolveTypeReferences()
15136 WXS_MODEL_GROUPDEF_CAST xmlSchemaGetNamedComponent(ctxt->schema, in xmlSchemaResolveTypeReferences()
15137 ref->itemType, ref->name, ref->targetNamespace); in xmlSchemaResolveTypeReferences()
15141 "ref", ref->name, ref->targetNamespace, ref->itemType, in xmlSchemaResolveTypeReferences()
15155 if (WXS_MODELGROUPDEF_MODEL(groupDef)->type == XML_SCHEMA_TYPE_ALL) { in xmlSchemaResolveTypeReferences()
15157 * SPEC cos-all-limited (1.2) in xmlSchemaResolveTypeReferences()
15162 if ((WXS_TYPE_PARTICLE(typeDef))->maxOccurs != 1) { in xmlSchemaResolveTypeReferences()
15183 * Checks st-props-correct.
15186 * if not, a positive error code and -1 on internal
15193 xmlSchemaTypePtr baseType = type->baseType; in xmlSchemaCheckSTPropsCorrect()
15210 * Sub-components ($5.3)." in xmlSchemaCheckSTPropsCorrect()
15231 (baseType->type != XML_SCHEMA_TYPE_SIMPLE))) { in xmlSchemaCheckSTPropsCorrect()
15236 "the simple ur-type definition as base type, not '%s'", in xmlSchemaCheckSTPropsCorrect()
15271 * ur-type definition` (so circular definitions are disallowed). That is, it in xmlSchemaCheckSTPropsCorrect()
15272 * must be possible to reach a built-in primitive datatype or the `simple in xmlSchemaCheckSTPropsCorrect()
15273 * ur-type definition` by repeatedly following the {base type definition}. in xmlSchemaCheckSTPropsCorrect()
15286 * Derivation Valid (Restriction, Simple) (cos-st-restricts)
15291 * Returns -1 on internal errors, 0 if the type is validly derived,
15300 if (type->type != XML_SCHEMA_TYPE_SIMPLE) { in xmlSchemaCheckCOSSTRestricts()
15302 "given type is not a user-derived simpleType"); in xmlSchemaCheckCOSSTRestricts()
15303 return (-1); in xmlSchemaCheckCOSSTRestricts()
15310 * type definition or a built-in primitive datatype. in xmlSchemaCheckCOSSTRestricts()
15312 if (! WXS_IS_ATOMIC(type->baseType)) { in xmlSchemaCheckCOSSTRestricts()
15317 xmlSchemaGetComponentQName(&str, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15325 if (xmlSchemaTypeFinalContains(type->baseType, in xmlSchemaCheckCOSSTRestricts()
15331 xmlSchemaGetComponentQName(&str, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15341 if (type->facets != NULL) { in xmlSchemaCheckCOSSTRestricts()
15349 return (-1); in xmlSchemaCheckCOSSTRestricts()
15351 facet = type->facets; in xmlSchemaCheckCOSSTRestricts()
15353 if (xmlSchemaIsBuiltInTypeFacet(primitive, facet->type) == 0) { in xmlSchemaCheckCOSSTRestricts()
15359 facet = facet->next; in xmlSchemaCheckCOSSTRestricts()
15376 itemType = type->subtypes; in xmlSchemaCheckCOSSTRestricts()
15380 return (-1); in xmlSchemaCheckCOSSTRestricts()
15401 member = itemType->memberTypes; in xmlSchemaCheckCOSSTRestricts()
15403 if (! WXS_IS_ATOMIC(member->type)) { in xmlSchemaCheckCOSSTRestricts()
15409 xmlSchemaGetComponentQName(&str, member->type)); in xmlSchemaCheckCOSSTRestricts()
15413 member = member->next; in xmlSchemaCheckCOSSTRestricts()
15417 if (WXS_IS_ANY_SIMPLE_TYPE(type->baseType)) { in xmlSchemaCheckCOSSTRestricts()
15443 if (type->facets != NULL) { in xmlSchemaCheckCOSSTRestricts()
15444 facet = type->facets; in xmlSchemaCheckCOSSTRestricts()
15446 if (facet->type != XML_SCHEMA_FACET_WHITESPACE) { in xmlSchemaCheckCOSSTRestricts()
15452 facet = facet->next; in xmlSchemaCheckCOSSTRestricts()
15471 if (! WXS_IS_LIST(type->baseType)) { in xmlSchemaCheckCOSSTRestricts()
15476 xmlSchemaGetComponentQName(&str, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15484 if (xmlSchemaTypeFinalContains(type->baseType, in xmlSchemaCheckCOSSTRestricts()
15490 xmlSchemaGetComponentQName(&str, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15502 baseItemType = type->baseType->subtypes; in xmlSchemaCheckCOSSTRestricts()
15506 return (-1); in xmlSchemaCheckCOSSTRestricts()
15519 xmlSchemaGetComponentQName(&strBT, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15528 if (type->facets != NULL) { in xmlSchemaCheckCOSSTRestricts()
15535 facet = type->facets; in xmlSchemaCheckCOSSTRestricts()
15537 switch (facet->type) { in xmlSchemaCheckCOSSTRestricts()
15560 facet = facet->next; in xmlSchemaCheckCOSSTRestricts()
15579 member = type->memberTypes; in xmlSchemaCheckCOSSTRestricts()
15581 if (WXS_IS_TYPE_NOT_FIXED(member->type)) in xmlSchemaCheckCOSSTRestricts()
15582 xmlSchemaTypeFixup(member->type, ACTXT_CAST pctxt); in xmlSchemaCheckCOSSTRestricts()
15584 if ((! WXS_IS_ATOMIC(member->type)) && in xmlSchemaCheckCOSSTRestricts()
15585 (! WXS_IS_LIST(member->type))) { in xmlSchemaCheckCOSSTRestricts()
15590 xmlSchemaGetComponentQName(&str, member->type)); in xmlSchemaCheckCOSSTRestricts()
15594 member = member->next; in xmlSchemaCheckCOSSTRestricts()
15597 * 3.3.1 If the {base type definition} is the `simple ur-type in xmlSchemaCheckCOSSTRestricts()
15600 if (type->baseType->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) { in xmlSchemaCheckCOSSTRestricts()
15605 member = type->memberTypes; in xmlSchemaCheckCOSSTRestricts()
15607 if (xmlSchemaTypeFinalContains(member->type, in xmlSchemaCheckCOSSTRestricts()
15613 xmlSchemaGetComponentQName(&str, member->type)); in xmlSchemaCheckCOSSTRestricts()
15617 member = member->next; in xmlSchemaCheckCOSSTRestricts()
15622 if (type->facetSet != NULL) { in xmlSchemaCheckCOSSTRestricts()
15634 if (! WXS_IS_UNION(type->baseType)) { in xmlSchemaCheckCOSSTRestricts()
15639 xmlSchemaGetComponentQName(&str, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15646 if (xmlSchemaTypeFinalContains(type->baseType, in xmlSchemaCheckCOSSTRestricts()
15652 xmlSchemaGetComponentQName(&str, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15677 if (type->memberTypes != NULL) { in xmlSchemaCheckCOSSTRestricts()
15678 member = type->memberTypes; in xmlSchemaCheckCOSSTRestricts()
15679 baseMember = xmlSchemaGetUnionSimpleTypeMemberTypes(type->baseType); in xmlSchemaCheckCOSSTRestricts()
15688 } else if ((member->type != baseMember->type) && in xmlSchemaCheckCOSSTRestricts()
15690 member->type, baseMember->type, 0) != 0)) { in xmlSchemaCheckCOSSTRestricts()
15699 xmlSchemaGetComponentQName(&str, member->type), in xmlSchemaCheckCOSSTRestricts()
15700 xmlSchemaGetComponentQName(&strBMT, baseMember->type), in xmlSchemaCheckCOSSTRestricts()
15701 xmlSchemaGetComponentQName(&strBT, type->baseType)); in xmlSchemaCheckCOSSTRestricts()
15707 member = member->next; in xmlSchemaCheckCOSSTRestricts()
15709 baseMember = baseMember->next; in xmlSchemaCheckCOSSTRestricts()
15717 if (type->facets != NULL) { in xmlSchemaCheckCOSSTRestricts()
15721 facet = type->facets; in xmlSchemaCheckCOSSTRestricts()
15723 if ((facet->type != XML_SCHEMA_FACET_PATTERN) && in xmlSchemaCheckCOSSTRestricts()
15724 (facet->type != XML_SCHEMA_FACET_ENUMERATION)) { in xmlSchemaCheckCOSSTRestricts()
15730 facet = facet->next; in xmlSchemaCheckCOSSTRestricts()
15753 * Checks crc-simple-type constraints.
15756 * if not a positive error code and -1 on internal
15765 * src-simple-type.1 The corresponding simple type definition, if any,
15771 * src-simple-type.2 "If the <restriction> alternative is chosen,
15780 /* src-simple-type.3 "If the <list> alternative is chosen, either it must have
15788 * src-simple-type.4 is checked in xmlSchemaCheckUnionTypeDefCircular().
15798 if (ctxt->vctxt == NULL) { in xmlSchemaCreateVCtxtOnPCtxt()
15799 ctxt->vctxt = xmlSchemaNewValidCtxt(NULL); in xmlSchemaCreateVCtxtOnPCtxt()
15800 if (ctxt->vctxt == NULL) { in xmlSchemaCreateVCtxtOnPCtxt()
15804 "failed to create a temp. validation context.\n", in xmlSchemaCreateVCtxtOnPCtxt()
15806 return (-1); in xmlSchemaCreateVCtxtOnPCtxt()
15809 xmlSchemaSetValidErrors(ctxt->vctxt, in xmlSchemaCreateVCtxtOnPCtxt()
15810 ctxt->error, ctxt->warning, ctxt->errCtxt); in xmlSchemaCreateVCtxtOnPCtxt()
15811 xmlSchemaSetValidStructuredErrors(ctxt->vctxt, in xmlSchemaCreateVCtxtOnPCtxt()
15812 ctxt->serror, ctxt->errCtxt); in xmlSchemaCreateVCtxtOnPCtxt()
15835 * (cos-valid-default)
15840 * if not, a positive error code and -1 on internal
15853 * cos-valid-default: in xmlSchemaParseCheckCOSValidDefault()
15873 WXS_BASIC_CAST type, type->node, in xmlSchemaParseCheckCOSValidDefault()
15896 type->contentTypeDef, value, val, 1, 1, 0); in xmlSchemaParseCheckCOSValidDefault()
15915 * Complex Type Definition Properties Correct (ct-props-correct)
15919 * error code if not and -1 if an internal error occurred.
15931 * Sub-components ($5.3)." in xmlSchemaCheckCTPropsCorrect()
15933 if ((type->baseType != NULL) && in xmlSchemaCheckCTPropsCorrect()
15934 (WXS_IS_SIMPLE(type->baseType)) && in xmlSchemaCheckCTPropsCorrect()
15948 * SPEC (3) "Circular definitions are disallowed, except for the `ur-type in xmlSchemaCheckCTPropsCorrect()
15949 * definition`. That is, it must be possible to reach the `ur-type in xmlSchemaCheckCTPropsCorrect()
15956 * - attribute uses need to be already inherited (apply attr. prohibitions) in xmlSchemaCheckCTPropsCorrect()
15957 * - attribute group references need to be expanded already in xmlSchemaCheckCTPropsCorrect()
15958 * - simple types need to be typefixed already in xmlSchemaCheckCTPropsCorrect()
15960 if (type->attrUses && in xmlSchemaCheckCTPropsCorrect()
15961 (((xmlSchemaItemListPtr) type->attrUses)->nbItems > 1)) in xmlSchemaCheckCTPropsCorrect()
15963 xmlSchemaItemListPtr uses = (xmlSchemaItemListPtr) type->attrUses; in xmlSchemaCheckCTPropsCorrect()
15967 for (i = uses->nbItems -1; i >= 0; i--) { in xmlSchemaCheckCTPropsCorrect()
15968 use = uses->items[i]; in xmlSchemaCheckCTPropsCorrect()
15971 * SPEC ct-props-correct in xmlSchemaCheckCTPropsCorrect()
15977 for (j = i -1; j >= 0; j--) { in xmlSchemaCheckCTPropsCorrect()
15978 tmp = uses->items[j]; in xmlSchemaCheckCTPropsCorrect()
15996 if (xmlSchemaItemListRemove(uses, i) == -1) in xmlSchemaCheckCTPropsCorrect()
16003 * SPEC ct-props-correct in xmlSchemaCheckCTPropsCorrect()
16025 if (xmlSchemaItemListRemove(uses, i) == -1) in xmlSchemaCheckCTPropsCorrect()
16037 return(-1); in xmlSchemaCheckCTPropsCorrect()
16045 * TODO: This should implement component-identity in xmlSchemaAreEqualTypes()
16056 * @type: the to-be derived complex type definition
16061 * Type Derivation OK (Complex) (cos-ct-derived-ok)
16099 if (type->baseType == baseType) in xmlSchemaCheckCOSCTDerivedOK()
16102 * SPEC (2.3.1) "D's {base type definition} must not be the `ur-type in xmlSchemaCheckCOSCTDerivedOK()
16105 if (WXS_IS_ANYTYPE(type->baseType)) in xmlSchemaCheckCOSCTDerivedOK()
16108 if (WXS_IS_COMPLEX(type->baseType)) { in xmlSchemaCheckCOSCTDerivedOK()
16114 return (xmlSchemaCheckCOSCTDerivedOK(actxt, type->baseType, in xmlSchemaCheckCOSCTDerivedOK()
16122 return (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, in xmlSchemaCheckCOSCTDerivedOK()
16158 * Derivation Valid (Extension) (cos-ct-extends)
16166 * error code if not and -1 if an internal error occurred.
16172 xmlSchemaTypePtr base = type->baseType; in xmlSchemaCheckCOSCTExtends()
16186 if (base->flags & XML_SCHEMAS_TYPE_FINAL_EXTENSION) { in xmlSchemaCheckCOSCTExtends()
16213 if (base->attrUses != NULL) { in xmlSchemaCheckCOSCTExtends()
16217 for (i = 0; i < (WXS_LIST_CAST base->attrUses)->nbItems; i ++) { in xmlSchemaCheckCOSCTExtends()
16218 buse = (WXS_LIST_CAST base->attrUses)->items[i]; in xmlSchemaCheckCOSCTExtends()
16220 if (type->attrUses != NULL) { in xmlSchemaCheckCOSCTExtends()
16221 use = (WXS_LIST_CAST type->attrUses)->items[j]; in xmlSchemaCheckCOSCTExtends()
16222 for (j = 0; j < (WXS_LIST_CAST type->attrUses)->nbItems; j ++) in xmlSchemaCheckCOSCTExtends()
16249 buse->children), in xmlSchemaCheckCOSCTExtends()
16267 if (base->attributeWildcard != NULL) { in xmlSchemaCheckCOSCTExtends()
16268 if (type->attributeWilcard == NULL) { in xmlSchemaCheckCOSCTExtends()
16280 base->attributeWildcard, type->attributeWildcard)) in xmlSchemaCheckCOSCTExtends()
16297 if ((type->contentTypeDef != NULL) && in xmlSchemaCheckCOSCTExtends()
16298 (type->contentTypeDef == base->contentTypeDef)) { in xmlSchemaCheckCOSCTExtends()
16305 } else if ((type->contentType == XML_SCHEMA_CONTENT_EMPTY) && in xmlSchemaCheckCOSCTExtends()
16306 (base->contentType == XML_SCHEMA_CONTENT_EMPTY) ) { in xmlSchemaCheckCOSCTExtends()
16317 if (type->subtypes == NULL) { in xmlSchemaCheckCOSCTExtends()
16331 if (base->contentType == XML_SCHEMA_CONTENT_EMPTY) { in xmlSchemaCheckCOSCTExtends()
16341 if ((type->contentType != base->contentType) || in xmlSchemaCheckCOSCTExtends()
16342 ((type->contentType != XML_SCHEMA_CONTENT_MIXED) && in xmlSchemaCheckCOSCTExtends()
16343 (type->contentType != XML_SCHEMA_CONTENT_ELEMENTS))) { in xmlSchemaCheckCOSCTExtends()
16346 * or both must be element-only." in xmlSchemaCheckCOSCTExtends()
16352 "type, must either 'mixed' or 'element-only'", NULL); in xmlSchemaCheckCOSCTExtends()
16377 if (type->contentTypeDef != base) { in xmlSchemaCheckCOSCTExtends()
16388 if (base->flags & XML_SCHEMAS_TYPE_FINAL_EXTENSION) { in xmlSchemaCheckCOSCTExtends()
16412 * Derivation Valid (Restriction, Complex) (derivation-ok-restriction)
16420 * Validation Rule: Checking complex type subsumption
16423 * error code if not and -1 if an internal error occurred.
16435 base = type->baseType; in xmlSchemaCheckDerivationOKRestriction()
16439 type->node, WXS_BASIC_CAST type, in xmlSchemaCheckDerivationOKRestriction()
16441 return(ctxt->err); in xmlSchemaCheckDerivationOKRestriction()
16443 if (base->flags & XML_SCHEMAS_TYPE_FINAL_RESTRICTION) { in xmlSchemaCheckDerivationOKRestriction()
16450 type->node, WXS_BASIC_CAST type, in xmlSchemaCheckDerivationOKRestriction()
16453 return (ctxt->err); in xmlSchemaCheckDerivationOKRestriction()
16464 type->attrUses, base->attrUses, in xmlSchemaCheckDerivationOKRestriction()
16465 type->attributeWildcard, in xmlSchemaCheckDerivationOKRestriction()
16466 base->attributeWildcard) == -1) in xmlSchemaCheckDerivationOKRestriction()
16468 return(-1); in xmlSchemaCheckDerivationOKRestriction()
16473 if (base->builtInType == XML_SCHEMAS_ANYTYPE) { in xmlSchemaCheckDerivationOKRestriction()
16476 * `ur-type definition`." in xmlSchemaCheckDerivationOKRestriction()
16479 } else if ((type->contentType == XML_SCHEMA_CONTENT_SIMPLE) || in xmlSchemaCheckDerivationOKRestriction()
16480 (type->contentType == XML_SCHEMA_CONTENT_BASIC)) { in xmlSchemaCheckDerivationOKRestriction()
16487 if ((base->contentType == XML_SCHEMA_CONTENT_SIMPLE) || in xmlSchemaCheckDerivationOKRestriction()
16488 (base->contentType == XML_SCHEMA_CONTENT_BASIC)) in xmlSchemaCheckDerivationOKRestriction()
16502 type->contentTypeDef, base->contentTypeDef, 0); in xmlSchemaCheckDerivationOKRestriction()
16506 if (err == -1) in xmlSchemaCheckDerivationOKRestriction()
16507 return(-1); in xmlSchemaCheckDerivationOKRestriction()
16514 type->contentTypeDef), in xmlSchemaCheckDerivationOKRestriction()
16516 base->contentTypeDef)); in xmlSchemaCheckDerivationOKRestriction()
16519 return(ctxt->err); in xmlSchemaCheckDerivationOKRestriction()
16521 } else if ((base->contentType == XML_SCHEMA_CONTENT_MIXED) && in xmlSchemaCheckDerivationOKRestriction()
16523 (xmlSchemaParticlePtr) base->subtypes))) { in xmlSchemaCheckDerivationOKRestriction()
16536 return (ctxt->err); in xmlSchemaCheckDerivationOKRestriction()
16538 } else if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { in xmlSchemaCheckDerivationOKRestriction()
16543 if (base->contentType == XML_SCHEMA_CONTENT_EMPTY) { in xmlSchemaCheckDerivationOKRestriction()
16549 } else if (((base->contentType == XML_SCHEMA_CONTENT_ELEMENTS) || in xmlSchemaCheckDerivationOKRestriction()
16550 (base->contentType == XML_SCHEMA_CONTENT_MIXED)) && in xmlSchemaCheckDerivationOKRestriction()
16552 (xmlSchemaParticlePtr) base->subtypes)) { in xmlSchemaCheckDerivationOKRestriction()
16564 "empty or 'mixed' (or 'elements-only') and an emptiable " in xmlSchemaCheckDerivationOKRestriction()
16566 return (ctxt->err); in xmlSchemaCheckDerivationOKRestriction()
16568 } else if ((type->contentType == XML_SCHEMA_CONTENT_ELEMENTS) || in xmlSchemaCheckDerivationOKRestriction()
16572 * itself must be element-only" in xmlSchemaCheckDerivationOKRestriction()
16585 return (ctxt->err); in xmlSchemaCheckDerivationOKRestriction()
16600 return (ctxt->err); in xmlSchemaCheckDerivationOKRestriction()
16613 * error code if not and -1 if an internal error occurred.
16640 * Complex Type Definition Representation OK (src-ct)
16643 * error code if not and -1 if an internal error occurred.
16656 base = type->baseType; in xmlSchemaCheckSRCCT()
16667 WXS_BASIC_CAST type, type->node, in xmlSchemaCheckSRCCT()
16670 xmlSchemaFormatQName(&str, base->targetNamespace, in xmlSchemaCheckSRCCT()
16671 base->name)); in xmlSchemaCheckSRCCT()
16697 xmlSchemaFormatQName(&str, base->targetNamespace, in xmlSchemaCheckSRCCT()
16698 base->name)); in xmlSchemaCheckSRCCT()
16704 if ((base->contentType == XML_SCHEMA_CONTENT_SIMPLE) || in xmlSchemaCheckSRCCT()
16705 (base->contentType == XML_SCHEMA_CONTENT_BASIC)) { in xmlSchemaCheckSRCCT()
16711 if (base->contentTypeDef == NULL) { in xmlSchemaCheckSRCCT()
16716 type->name); in xmlSchemaCheckSRCCT()
16717 return (-1); in xmlSchemaCheckSRCCT()
16719 } else if ((base->contentType == XML_SCHEMA_CONTENT_MIXED) && in xmlSchemaCheckSRCCT()
16728 (xmlSchemaParticlePtr) base->subtypes)) { in xmlSchemaCheckSRCCT()
16733 * ->contentTypeDef (put there during parsing). in xmlSchemaCheckSRCCT()
16735 if (type->contentTypeDef == NULL) { in xmlSchemaCheckSRCCT()
16749 xmlSchemaFormatQName(&str, base->targetNamespace, in xmlSchemaCheckSRCCT()
16750 base->name)); in xmlSchemaCheckSRCCT()
16768 xmlSchemaFormatQName(&str, base->targetNamespace, in xmlSchemaCheckSRCCT()
16769 base->name)); in xmlSchemaCheckSRCCT()
16777 xmlSchemaFormatQName(&str, base->targetNamespace, in xmlSchemaCheckSRCCT()
16778 base->name)); in xmlSchemaCheckSRCCT()
16807 * Occurrence Range OK (range-ok)
16812 * error code if not and -1 if an internal error occurred.
16834 * Particle Restriction OK (Elt:Elt -- NameAndTypeOK)
16835 * (rcase-NameAndTypeOK)
16842 * error code if not and -1 if an internal error occurred.
16851 /* TODO: Error codes (rcase-NameAndTypeOK). */ in xmlSchemaCheckRCaseNameAndTypeOK()
16852 elemR = (xmlSchemaElementPtr) r->children; in xmlSchemaCheckRCaseNameAndTypeOK()
16853 elemB = (xmlSchemaElementPtr) b->children; in xmlSchemaCheckRCaseNameAndTypeOK()
16859 ((! xmlStrEqual(elemR->name, elemB->name)) || in xmlSchemaCheckRCaseNameAndTypeOK()
16860 (! xmlStrEqual(elemR->targetNamespace, elemB->targetNamespace)))) in xmlSchemaCheckRCaseNameAndTypeOK()
16866 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, in xmlSchemaCheckRCaseNameAndTypeOK()
16867 b->minOccurs, b->maxOccurs) != 0) in xmlSchemaCheckRCaseNameAndTypeOK()
16878 if (((elemB->flags & XML_SCHEMAS_ELEM_NILLABLE) == 0) && in xmlSchemaCheckRCaseNameAndTypeOK()
16879 (elemR->flags & XML_SCHEMAS_ELEM_NILLABLE)) in xmlSchemaCheckRCaseNameAndTypeOK()
16886 if ((elemB->value != NULL) && (elemB->flags & XML_SCHEMAS_ELEM_FIXED) && in xmlSchemaCheckRCaseNameAndTypeOK()
16887 ((elemR->value == NULL) || in xmlSchemaCheckRCaseNameAndTypeOK()
16888 ((elemR->flags & XML_SCHEMAS_ELEM_FIXED) == 0) || in xmlSchemaCheckRCaseNameAndTypeOK()
16890 (! xmlStrEqual(elemR->value, elemB->value)))) in xmlSchemaCheckRCaseNameAndTypeOK()
16893 * TODO: SPEC (3.2.3) "R's declaration's {identity-constraint in xmlSchemaCheckRCaseNameAndTypeOK()
16894 * definitions} is a subset of B's declaration's {identity-constraint in xmlSchemaCheckRCaseNameAndTypeOK()
16897 if (elemB->idcs != NULL) { in xmlSchemaCheckRCaseNameAndTypeOK()
16904 if (((elemB->flags & XML_SCHEMAS_ELEM_BLOCK_EXTENSION) && in xmlSchemaCheckRCaseNameAndTypeOK()
16905 ((elemR->flags & XML_SCHEMAS_ELEM_BLOCK_EXTENSION) == 0)) || in xmlSchemaCheckRCaseNameAndTypeOK()
16906 ((elemB->flags & XML_SCHEMAS_ELEM_BLOCK_RESTRICTION) && in xmlSchemaCheckRCaseNameAndTypeOK()
16907 ((elemR->flags & XML_SCHEMAS_ELEM_BLOCK_RESTRICTION) == 0)) || in xmlSchemaCheckRCaseNameAndTypeOK()
16908 ((elemB->flags & XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION) && in xmlSchemaCheckRCaseNameAndTypeOK()
16909 ((elemR->flags & XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION) == 0))) in xmlSchemaCheckRCaseNameAndTypeOK()
16926 if (xmlSchemaCheckCOSDerivedOK(ACTXT_CAST ctxt, elemR->subtypes, in xmlSchemaCheckRCaseNameAndTypeOK()
16927 elemB->subtypes, set) != 0) in xmlSchemaCheckRCaseNameAndTypeOK()
16941 * Particle Derivation OK (Elt:Any -- NSCompat)
16942 * (rcase-NSCompat)
16947 * error code if not and -1 if an internal error occurred.
16954 /* TODO:Error codes (rcase-NSCompat). */ in xmlSchemaCheckRCaseNSCompat()
16963 if (xmlSchemaCheckCVCWildcardNamespace((xmlSchemaWildcardPtr) b->children, in xmlSchemaCheckRCaseNSCompat()
16964 ((xmlSchemaElementPtr) r->children)->targetNamespace) != 0) in xmlSchemaCheckRCaseNSCompat()
16970 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, in xmlSchemaCheckRCaseNSCompat()
16971 b->minOccurs, b->maxOccurs) != 0) in xmlSchemaCheckRCaseNSCompat()
16985 * Particle Derivation OK (Elt:All/Choice/Sequence -- RecurseAsIfGroup)
16986 * (rcase-RecurseAsIfGroup)
16991 * error code if not and -1 if an internal error occurred.
16998 /* TODO: Error codes (rcase-RecurseAsIfGroup). */ in xmlSchemaCheckRCaseRecurseAsIfGroup()
17011 * Particle Derivation OK (Any:Any -- NSSubset)
17012 * (rcase-NSSubset)
17017 * error code if not and -1 if an internal error occurred.
17025 /* TODO: Error codes (rcase-NSSubset). */ in xmlSchemaCheckRCaseNSSubset()
17030 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, in xmlSchemaCheckRCaseNSSubset()
17031 b->minOccurs, b->maxOccurs)) in xmlSchemaCheckRCaseNSSubset()
17037 if (xmlSchemaCheckCOSNSSubset((xmlSchemaWildcardPtr) r->children, in xmlSchemaCheckRCaseNSSubset()
17038 (xmlSchemaWildcardPtr) b->children)) in xmlSchemaCheckRCaseNSSubset()
17041 * SPEC (3) "Unless B is the content model wildcard of the `ur-type in xmlSchemaCheckRCaseNSSubset()
17047 if ( ((xmlSchemaWildcardPtr) r->children)->processContents < in xmlSchemaCheckRCaseNSSubset()
17048 ((xmlSchemaWildcardPtr) b->children)->processContents) in xmlSchemaCheckRCaseNSSubset()
17062 * Particle Valid (Restriction) (cos-particle-restrict)
17067 * error code if not and -1 if an internal error occurred.
17101 * Particle Derivation OK (All/Choice/Sequence:Any --
17103 * (rcase-NSRecurseCheckCardinality)
17105 * STATUS: TODO: subst-groups
17108 * error code if not and -1 if an internal error occurred.
17116 /* TODO: Error codes (rcase-NSRecurseCheckCardinality). */
17117 if ((r->children == NULL) || (r->children->children == NULL))
17118 return (-1);
17127 part = (xmlSchemaParticlePtr) r->children->children;
17131 part = (xmlSchemaParticlePtr) part->next;
17141 b->minOccurs, b->maxOccurs) != 0)
17155 * Particle Derivation OK (All:All,Sequence:Sequence --
17157 * (rcase-Recurse)
17160 * TODO: subst-groups
17163 * error code if not and -1 if an internal error occurred.
17171 /* TODO: Error codes (rcase-Recurse). */ in xmlSchemaCheckRCaseRecurse()
17172 if ((r->children == NULL) || (b->children == NULL) || in xmlSchemaCheckRCaseRecurse()
17173 (r->children->type != b->children->type)) in xmlSchemaCheckRCaseRecurse()
17174 return (-1); in xmlSchemaCheckRCaseRecurse()
17182 if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, in xmlSchemaCheckRCaseRecurse()
17183 b->minOccurs, b->maxOccurs)) in xmlSchemaCheckRCaseRecurse()
17195 WXS_BASIC_CAST fac1, fac1->node, \
17198 BAD_CAST xmlSchemaFacetTypeToString(fac1->type), \
17199 BAD_CAST xmlSchemaFacetTypeToString(fac2->type), NULL);
17204 WXS_BASIC_CAST fac1, fac1->node, \
17210 WXS_BASIC_CAST fac, fac->node, \
17225 msg = xmlStrcat(msg, xmlSchemaFacetTypeToString(facet1->type)); in xmlSchemaDeriveFacetErr()
17237 msg = xmlStrcat(msg, xmlSchemaFacetTypeToString(facet2->type)); in xmlSchemaDeriveFacetErr()
17256 * (st-restrict-facets)
17262 xmlSchemaTypePtr base = type->baseType; in xmlSchemaDeriveAndValidateFacets()
17276 * SPEC st-restrict-facets 1: in xmlSchemaDeriveAndValidateFacets()
17280 * SPEC st-restrict-facets 2: in xmlSchemaDeriveAndValidateFacets()
17289 * SPEC st-restrict-facets 3: in xmlSchemaDeriveAndValidateFacets()
17299 if ((type->facetSet == NULL) && (base->facetSet == NULL)) in xmlSchemaDeriveAndValidateFacets()
17302 last = type->facetSet; in xmlSchemaDeriveAndValidateFacets()
17304 while (last->next != NULL) in xmlSchemaDeriveAndValidateFacets()
17305 last = last->next; in xmlSchemaDeriveAndValidateFacets()
17307 for (cur = type->facetSet; cur != NULL; cur = cur->next) { in xmlSchemaDeriveAndValidateFacets()
17308 facet = cur->facet; in xmlSchemaDeriveAndValidateFacets()
17309 switch (facet->type) { in xmlSchemaDeriveAndValidateFacets()
17332 for (cur = base->facetSet; cur != NULL; cur = cur->next) { in xmlSchemaDeriveAndValidateFacets()
17333 facet = cur->facet; in xmlSchemaDeriveAndValidateFacets()
17334 switch (facet->type) { in xmlSchemaDeriveAndValidateFacets()
17386 res = xmlSchemaCompareValues(flength->val, bflength->val); in xmlSchemaDeriveAndValidateFacets()
17387 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17391 if ((res != 0) && (bflength->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17401 res = xmlSchemaCompareValues(fminlen->val, bfminlen->val); in xmlSchemaDeriveAndValidateFacets()
17402 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17404 if (res == -1) in xmlSchemaDeriveAndValidateFacets()
17406 if ((res != 0) && (bfminlen->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17415 res = xmlSchemaCompareValues(fmaxlen->val, bfmaxlen->val); in xmlSchemaDeriveAndValidateFacets()
17416 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17419 xmlSchemaDeriveFacetErr(pctxt, fmaxlen, bfmaxlen, -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17420 if ((res != 0) && (bfmaxlen->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17434 res = xmlSchemaCompareValues(flength->val, fminlen->val); in xmlSchemaDeriveAndValidateFacets()
17435 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17437 if (res == -1) in xmlSchemaDeriveAndValidateFacets()
17444 res = xmlSchemaCompareValues(flength->val, fmaxlen->val); in xmlSchemaDeriveAndValidateFacets()
17445 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17448 xmlSchemaDeriveFacetErr(pctxt, flength, fmaxlen, -1, 1, 0); in xmlSchemaDeriveAndValidateFacets()
17457 res = xmlSchemaCompareValues(fmaxinc->val, fmininc->val); in xmlSchemaDeriveAndValidateFacets()
17458 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17460 if (res == -1) { in xmlSchemaDeriveAndValidateFacets()
17469 res = xmlSchemaCompareValues(fmaxinc->val, bfmaxinc->val); in xmlSchemaDeriveAndValidateFacets()
17470 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17473 xmlSchemaDeriveFacetErr(pctxt, fmaxinc, bfmaxinc, -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17474 if ((res != 0) && (bfmaxinc->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17480 res = xmlSchemaCompareValues(fmaxinc->val, bfmaxexc->val); in xmlSchemaDeriveAndValidateFacets()
17481 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17483 if (res != -1) { in xmlSchemaDeriveAndValidateFacets()
17484 xmlSchemaDeriveFacetErr(pctxt, fmaxinc, bfmaxexc, -1, 0, 1); in xmlSchemaDeriveAndValidateFacets()
17489 res = xmlSchemaCompareValues(fmaxinc->val, bfmininc->val); in xmlSchemaDeriveAndValidateFacets()
17490 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17492 if (res == -1) { in xmlSchemaDeriveAndValidateFacets()
17498 res = xmlSchemaCompareValues(fmaxinc->val, bfminexc->val); in xmlSchemaDeriveAndValidateFacets()
17499 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17511 res = xmlSchemaCompareValues(fmaxexc->val, fminexc->val); in xmlSchemaDeriveAndValidateFacets()
17512 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17514 if (res == -1) { in xmlSchemaDeriveAndValidateFacets()
17523 res = xmlSchemaCompareValues(fmaxexc->val, bfmaxexc->val); in xmlSchemaDeriveAndValidateFacets()
17524 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17527 xmlSchemaDeriveFacetErr(pctxt, fmaxexc, bfmaxexc, -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17529 if ((res != 0) && (bfmaxexc->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17535 res = xmlSchemaCompareValues(fmaxexc->val, bfmaxinc->val); in xmlSchemaDeriveAndValidateFacets()
17536 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17539 xmlSchemaDeriveFacetErr(pctxt, fmaxexc, bfmaxinc, -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17544 res = xmlSchemaCompareValues(fmaxexc->val, bfmininc->val); in xmlSchemaDeriveAndValidateFacets()
17545 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17553 res = xmlSchemaCompareValues(fmaxexc->val, bfminexc->val); in xmlSchemaDeriveAndValidateFacets()
17554 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17566 res = xmlSchemaCompareValues(fminexc->val, fmaxinc->val); in xmlSchemaDeriveAndValidateFacets()
17567 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17569 if (res != -1) { in xmlSchemaDeriveAndValidateFacets()
17570 xmlSchemaDeriveFacetErr(pctxt, fminexc, fmaxinc, -1, 0, 0); in xmlSchemaDeriveAndValidateFacets()
17578 res = xmlSchemaCompareValues(fminexc->val, bfminexc->val); in xmlSchemaDeriveAndValidateFacets()
17579 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17581 if (res == -1) { in xmlSchemaDeriveAndValidateFacets()
17584 if ((res != 0) && (bfminexc->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17590 res = xmlSchemaCompareValues(fminexc->val, bfmaxinc->val); in xmlSchemaDeriveAndValidateFacets()
17591 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17594 xmlSchemaDeriveFacetErr(pctxt, fminexc, bfmaxinc, -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17599 res = xmlSchemaCompareValues(fminexc->val, bfmininc->val); in xmlSchemaDeriveAndValidateFacets()
17600 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17602 if (res == -1) { in xmlSchemaDeriveAndValidateFacets()
17608 res = xmlSchemaCompareValues(fminexc->val, bfmaxexc->val); in xmlSchemaDeriveAndValidateFacets()
17609 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17611 if (res != -1) { in xmlSchemaDeriveAndValidateFacets()
17612 xmlSchemaDeriveFacetErr(pctxt, fminexc, bfmaxexc, -1, 0, 1); in xmlSchemaDeriveAndValidateFacets()
17621 res = xmlSchemaCompareValues(fmininc->val, fmaxexc->val); in xmlSchemaDeriveAndValidateFacets()
17622 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17624 if (res != -1) { in xmlSchemaDeriveAndValidateFacets()
17625 xmlSchemaDeriveFacetErr(pctxt, fmininc, fmaxexc, -1, 0, 0); in xmlSchemaDeriveAndValidateFacets()
17633 res = xmlSchemaCompareValues(fmininc->val, bfmininc->val); in xmlSchemaDeriveAndValidateFacets()
17634 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17636 if (res == -1) { in xmlSchemaDeriveAndValidateFacets()
17639 if ((res != 0) && (bfmininc->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17645 res = xmlSchemaCompareValues(fmininc->val, bfmaxinc->val); in xmlSchemaDeriveAndValidateFacets()
17646 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17649 xmlSchemaDeriveFacetErr(pctxt, fmininc, bfmaxinc, -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17654 res = xmlSchemaCompareValues(fmininc->val, bfminexc->val); in xmlSchemaDeriveAndValidateFacets()
17655 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17662 res = xmlSchemaCompareValues(fmininc->val, bfmaxexc->val); in xmlSchemaDeriveAndValidateFacets()
17663 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17665 if (res != -1) in xmlSchemaDeriveAndValidateFacets()
17666 xmlSchemaDeriveFacetErr(pctxt, fmininc, bfmaxexc, -1, 0, 1); in xmlSchemaDeriveAndValidateFacets()
17674 res = xmlSchemaCompareValues(ftotdig->val, bftotdig->val); in xmlSchemaDeriveAndValidateFacets()
17675 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17679 -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17680 if ((res != 0) && (bftotdig->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17689 res = xmlSchemaCompareValues(ffracdig->val, bffracdig->val); in xmlSchemaDeriveAndValidateFacets()
17690 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17694 -1, 1, 1); in xmlSchemaDeriveAndValidateFacets()
17695 if ((res != 0) && (bffracdig->fixed)) { in xmlSchemaDeriveAndValidateFacets()
17707 res = xmlSchemaCompareValues(ffracdig->val, ftotdig->val); in xmlSchemaDeriveAndValidateFacets()
17708 if (res == -2) in xmlSchemaDeriveAndValidateFacets()
17712 -1, 1, 0); in xmlSchemaDeriveAndValidateFacets()
17716 * of enumerations in the ancestor-or-self axis is used in xmlSchemaDeriveAndValidateFacets()
17717 * for validation, plus we need to use the base type of those in xmlSchemaDeriveAndValidateFacets()
17722 * happed during validation by walking the base axis in xmlSchemaDeriveAndValidateFacets()
17725 for (cur = base->facetSet; cur != NULL; cur = cur->next) { in xmlSchemaDeriveAndValidateFacets()
17726 bfacet = cur->facet; in xmlSchemaDeriveAndValidateFacets()
17731 if ((bfacet->type == XML_SCHEMA_FACET_PATTERN) || in xmlSchemaDeriveAndValidateFacets()
17732 (bfacet->type == XML_SCHEMA_FACET_ENUMERATION)) in xmlSchemaDeriveAndValidateFacets()
17737 link = type->facetSet; in xmlSchemaDeriveAndValidateFacets()
17741 facet = link->facet; in xmlSchemaDeriveAndValidateFacets()
17742 if (facet->type == bfacet->type) { in xmlSchemaDeriveAndValidateFacets()
17743 switch (facet->type) { in xmlSchemaDeriveAndValidateFacets()
17748 if (facet->whitespace < bfacet->whitespace) { in xmlSchemaDeriveAndValidateFacets()
17754 if ((bfacet->fixed) && in xmlSchemaDeriveAndValidateFacets()
17755 (facet->whitespace != bfacet->whitespace)) { in xmlSchemaDeriveAndValidateFacets()
17765 link = link->next; in xmlSchemaDeriveAndValidateFacets()
17777 return (-1); in xmlSchemaDeriveAndValidateFacets()
17779 link->facet = cur->facet; in xmlSchemaDeriveAndValidateFacets()
17780 link->next = NULL; in xmlSchemaDeriveAndValidateFacets()
17782 type->facetSet = link; in xmlSchemaDeriveAndValidateFacets()
17784 last->next = link; in xmlSchemaDeriveAndValidateFacets()
17794 return (-1); in xmlSchemaDeriveAndValidateFacets()
17808 * "http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/0287.html" in xmlSchemaFinishMemberTypeDefinitionsProperty()
17811 link = type->memberTypes; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17814 if (WXS_IS_TYPE_NOT_FIXED(link->type)) in xmlSchemaFinishMemberTypeDefinitionsProperty()
17815 xmlSchemaTypeFixup(link->type, ACTXT_CAST pctxt); in xmlSchemaFinishMemberTypeDefinitionsProperty()
17817 if (WXS_IS_UNION(link->type)) { in xmlSchemaFinishMemberTypeDefinitionsProperty()
17818 subLink = xmlSchemaGetUnionSimpleTypeMemberTypes(link->type); in xmlSchemaFinishMemberTypeDefinitionsProperty()
17820 link->type = subLink->type; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17821 if (subLink->next != NULL) { in xmlSchemaFinishMemberTypeDefinitionsProperty()
17822 lastLink = link->next; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17823 subLink = subLink->next; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17831 return (-1); in xmlSchemaFinishMemberTypeDefinitionsProperty()
17833 newLink->type = subLink->type; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17834 prevLink->next = newLink; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17836 newLink->next = lastLink; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17838 subLink = subLink->next; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17843 link = link->next; in xmlSchemaFinishMemberTypeDefinitionsProperty()
17853 has = (type->baseType->flags & XML_SCHEMAS_TYPE_HAS_FACETS) ? 1 : 0; in xmlSchemaTypeFixupOptimFacets()
17855 needVal = (type->baseType->flags & in xmlSchemaTypeFixupOptimFacets()
17857 normVal = (type->baseType->flags & in xmlSchemaTypeFixupOptimFacets()
17860 if (type->facets != NULL) { in xmlSchemaTypeFixupOptimFacets()
17863 for (fac = type->facets; fac != NULL; fac = fac->next) { in xmlSchemaTypeFixupOptimFacets()
17864 switch (fac->type) { in xmlSchemaTypeFixupOptimFacets()
17883 type->flags |= XML_SCHEMAS_TYPE_NORMVALUENEEDED; in xmlSchemaTypeFixupOptimFacets()
17885 type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE; in xmlSchemaTypeFixupOptimFacets()
17887 type->flags |= XML_SCHEMAS_TYPE_HAS_FACETS; in xmlSchemaTypeFixupOptimFacets()
17894 if ((prim->builtInType != XML_SCHEMAS_ANYSIMPLETYPE) && in xmlSchemaTypeFixupOptimFacets()
17895 (prim->builtInType != XML_SCHEMAS_STRING)) { in xmlSchemaTypeFixupOptimFacets()
17896 type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE; in xmlSchemaTypeFixupOptimFacets()
17907 * Evaluate the whitespace-facet value. in xmlSchemaTypeFixupWhitespace()
17910 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; in xmlSchemaTypeFixupWhitespace()
17915 if (type->facetSet != NULL) { in xmlSchemaTypeFixupWhitespace()
17918 for (lin = type->facetSet; lin != NULL; lin = lin->next) { in xmlSchemaTypeFixupWhitespace()
17919 if (lin->facet->type == XML_SCHEMA_FACET_WHITESPACE) { in xmlSchemaTypeFixupWhitespace()
17920 switch (lin->facet->whitespace) { in xmlSchemaTypeFixupWhitespace()
17922 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE; in xmlSchemaTypeFixupWhitespace()
17925 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_REPLACE; in xmlSchemaTypeFixupWhitespace()
17928 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; in xmlSchemaTypeFixupWhitespace()
17931 return (-1); in xmlSchemaTypeFixupWhitespace()
17945 for (anc = type->baseType; anc != NULL && in xmlSchemaTypeFixupWhitespace()
17946 anc->builtInType != XML_SCHEMAS_ANYTYPE; in xmlSchemaTypeFixupWhitespace()
17947 anc = anc->baseType) { in xmlSchemaTypeFixupWhitespace()
17949 if (anc->type == XML_SCHEMA_TYPE_BASIC) { in xmlSchemaTypeFixupWhitespace()
17950 if (anc->builtInType == XML_SCHEMAS_NORMSTRING) { in xmlSchemaTypeFixupWhitespace()
17951 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_REPLACE; in xmlSchemaTypeFixupWhitespace()
17953 } else if ((anc->builtInType == XML_SCHEMAS_STRING) || in xmlSchemaTypeFixupWhitespace()
17954 (anc->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) { in xmlSchemaTypeFixupWhitespace()
17955 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE; in xmlSchemaTypeFixupWhitespace()
17958 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; in xmlSchemaTypeFixupWhitespace()
17970 if (type->type != XML_SCHEMA_TYPE_SIMPLE) in xmlSchemaFixupSimpleTypeStageOne()
17974 type->flags |= XML_SCHEMAS_TYPE_FIXUP_1; in xmlSchemaFixupSimpleTypeStageOne()
17980 if (type->subtypes == NULL) { in xmlSchemaFixupSimpleTypeStageOne()
17985 "list type has no item-type assigned"); in xmlSchemaFixupSimpleTypeStageOne()
17986 return(-1); in xmlSchemaFixupSimpleTypeStageOne()
17992 if (type->memberTypes == NULL) { in xmlSchemaFixupSimpleTypeStageOne()
17997 "union type has no member-types assigned"); in xmlSchemaFixupSimpleTypeStageOne()
17998 return(-1); in xmlSchemaFixupSimpleTypeStageOne()
18004 if (type->baseType == NULL) { in xmlSchemaFixupSimpleTypeStageOne()
18006 "type has no base-type assigned"); in xmlSchemaFixupSimpleTypeStageOne()
18007 return(-1); in xmlSchemaFixupSimpleTypeStageOne()
18009 if (WXS_IS_TYPE_NOT_FIXED_1(type->baseType)) in xmlSchemaFixupSimpleTypeStageOne()
18010 if (xmlSchemaFixupSimpleTypeStageOne(pctxt, type->baseType) == -1) in xmlSchemaFixupSimpleTypeStageOne()
18011 return(-1); in xmlSchemaFixupSimpleTypeStageOne()
18017 if (WXS_IS_ATOMIC(type->baseType)) in xmlSchemaFixupSimpleTypeStageOne()
18018 type->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC; in xmlSchemaFixupSimpleTypeStageOne()
18019 else if (WXS_IS_LIST(type->baseType)) { in xmlSchemaFixupSimpleTypeStageOne()
18020 type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST; in xmlSchemaFixupSimpleTypeStageOne()
18024 type->subtypes = type->baseType->subtypes; in xmlSchemaFixupSimpleTypeStageOne()
18025 } else if (WXS_IS_UNION(type->baseType)) { in xmlSchemaFixupSimpleTypeStageOne()
18026 type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION; in xmlSchemaFixupSimpleTypeStageOne()
18042 if (type->node != NULL) { in xmlSchemaDebugFixedType()
18045 type->node->doc->URL, in xmlSchemaDebugFixedType()
18046 xmlGetLineNo(type->node)); in xmlSchemaDebugFixedType()
18051 switch (type->contentType) { in xmlSchemaDebugFixedType()
18066 type->subtypes)) in xmlSchemaDebugFixedType()
18097 int res, olderrs = pctxt->nberrors; in xmlSchemaFixupSimpleTypeStageTwo()
18099 if (type->type != XML_SCHEMA_TYPE_SIMPLE) in xmlSchemaFixupSimpleTypeStageTwo()
18100 return(-1); in xmlSchemaFixupSimpleTypeStageTwo()
18105 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED; in xmlSchemaFixupSimpleTypeStageTwo()
18106 type->contentType = XML_SCHEMA_CONTENT_SIMPLE; in xmlSchemaFixupSimpleTypeStageTwo()
18108 if (type->baseType == NULL) { in xmlSchemaFixupSimpleTypeStageTwo()
18113 if (WXS_IS_TYPE_NOT_FIXED(type->baseType)) in xmlSchemaFixupSimpleTypeStageTwo()
18114 xmlSchemaTypeFixup(type->baseType, ACTXT_CAST pctxt); in xmlSchemaFixupSimpleTypeStageTwo()
18121 if ((type->memberTypes != NULL) && in xmlSchemaFixupSimpleTypeStageTwo()
18122 (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1)) in xmlSchemaFixupSimpleTypeStageTwo()
18123 return(-1); in xmlSchemaFixupSimpleTypeStageTwo()
18125 * SPEC src-simple-type 1 in xmlSchemaFixupSimpleTypeStageTwo()
18132 * (st-props-correct) in xmlSchemaFixupSimpleTypeStageTwo()
18138 * (cos-st-restricts) in xmlSchemaFixupSimpleTypeStageTwo()
18147 * xmlSchemaPErr(ctxt, type->node, in xmlSchemaFixupSimpleTypeStageTwo()
18151 * type->name, NULL); in xmlSchemaFixupSimpleTypeStageTwo()
18155 * (st-restrict-facets) in xmlSchemaFixupSimpleTypeStageTwo()
18159 if ((type->facetSet != NULL) || in xmlSchemaFixupSimpleTypeStageTwo()
18160 (type->baseType->facetSet != NULL)) { in xmlSchemaFixupSimpleTypeStageTwo()
18175 if (olderrs != pctxt->nberrors) in xmlSchemaFixupSimpleTypeStageTwo()
18176 return(pctxt->err); in xmlSchemaFixupSimpleTypeStageTwo()
18183 return(-1); in xmlSchemaFixupSimpleTypeStageTwo()
18190 int res = 0, olderrs = pctxt->nberrors; in xmlSchemaFixupComplexType()
18191 xmlSchemaTypePtr baseType = type->baseType; in xmlSchemaFixupComplexType()
18195 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED; in xmlSchemaFixupComplexType()
18206 if (baseType->flags & XML_SCHEMAS_TYPE_INTERNAL_INVALID) { in xmlSchemaFixupComplexType()
18221 if (type->contentType == XML_SCHEMA_CONTENT_SIMPLE) { in xmlSchemaFixupComplexType()
18226 (baseType->contentTypeDef != NULL) && in xmlSchemaFixupComplexType()
18237 if (type->contentTypeDef != NULL) { in xmlSchemaFixupComplexType()
18243 * into ->contentTypeDef during parsing. in xmlSchemaFixupComplexType()
18245 contentBase = type->contentTypeDef; in xmlSchemaFixupComplexType()
18246 type->contentTypeDef = NULL; in xmlSchemaFixupComplexType()
18253 contentBase = baseType->contentTypeDef; in xmlSchemaFixupComplexType()
18265 snprintf(buf, 29, "#scST%d", ++(pctxt->counter)); in xmlSchemaFixupComplexType()
18266 tmpname = xmlDictLookup(pctxt->dict, BAD_CAST buf, -1); in xmlSchemaFixupComplexType()
18267 content = xmlSchemaAddType(pctxt, pctxt->schema, in xmlSchemaFixupComplexType()
18268 XML_SCHEMA_TYPE_SIMPLE, tmpname, type->targetNamespace, in xmlSchemaFixupComplexType()
18269 type->node, 0); in xmlSchemaFixupComplexType()
18271 content = xmlSchemaAddType(pctxt, pctxt->schema, in xmlSchemaFixupComplexType()
18272 XML_SCHEMA_TYPE_SIMPLE, NULL, type->targetNamespace, in xmlSchemaFixupComplexType()
18273 type->node, 0); in xmlSchemaFixupComplexType()
18281 content->type = XML_SCHEMA_TYPE_SIMPLE; in xmlSchemaFixupComplexType()
18282 content->baseType = contentBase; in xmlSchemaFixupComplexType()
18287 content->facets = type->facets; in xmlSchemaFixupComplexType()
18288 type->facets = NULL; in xmlSchemaFixupComplexType()
18289 content->facetSet = type->facetSet; in xmlSchemaFixupComplexType()
18290 type->facetSet = NULL; in xmlSchemaFixupComplexType()
18292 type->contentTypeDef = content; in xmlSchemaFixupComplexType()
18305 (baseType->contentType == XML_SCHEMA_CONTENT_MIXED) && in xmlSchemaFixupComplexType()
18312 if ((type->contentTypeDef == NULL) || in xmlSchemaFixupComplexType()
18313 (type->contentTypeDef->baseType == NULL)) { in xmlSchemaFixupComplexType()
18323 "by xmlSchemaCheckSRCCT()", type->name); in xmlSchemaFixupComplexType()
18332 if (baseType->contentTypeDef == NULL) { in xmlSchemaFixupComplexType()
18343 type->name); in xmlSchemaFixupComplexType()
18346 type->contentTypeDef = baseType->contentTypeDef; in xmlSchemaFixupComplexType()
18352 type->contentTypeDef = baseType; in xmlSchemaFixupComplexType()
18362 "derivation case", type->name); in xmlSchemaFixupComplexType()
18368 (xmlSchemaParticlePtr) type->subtypes; in xmlSchemaFixupComplexType()
18380 ((particle->type == XML_SCHEMA_TYPE_PARTICLE) && in xmlSchemaFixupComplexType()
18381 ((particle->children->type == XML_SCHEMA_TYPE_ALL) || in xmlSchemaFixupComplexType()
18382 (particle->children->type == XML_SCHEMA_TYPE_SEQUENCE) || in xmlSchemaFixupComplexType()
18383 ((particle->children->type == XML_SCHEMA_TYPE_CHOICE) && in xmlSchemaFixupComplexType()
18384 (particle->minOccurs == 0))) && in xmlSchemaFixupComplexType()
18385 ( ((xmlSchemaTreeItemPtr) particle->children)->children == NULL))) { in xmlSchemaFixupComplexType()
18386 if (type->flags & XML_SCHEMAS_TYPE_MIXED) { in xmlSchemaFixupComplexType()
18397 (particle->children->type != XML_SCHEMA_TYPE_SEQUENCE)) { in xmlSchemaFixupComplexType()
18402 type->node, 1, 1); in xmlSchemaFixupComplexType()
18408 particle->children = (xmlSchemaTreeItemPtr) in xmlSchemaFixupComplexType()
18409 xmlSchemaAddModelGroup(pctxt, pctxt->schema, in xmlSchemaFixupComplexType()
18410 XML_SCHEMA_TYPE_SEQUENCE, type->node); in xmlSchemaFixupComplexType()
18411 if (particle->children == NULL) in xmlSchemaFixupComplexType()
18414 type->subtypes = (xmlSchemaTypePtr) particle; in xmlSchemaFixupComplexType()
18417 type->contentType = XML_SCHEMA_CONTENT_ELEMENTS; in xmlSchemaFixupComplexType()
18422 type->contentType = XML_SCHEMA_CONTENT_EMPTY; in xmlSchemaFixupComplexType()
18430 type->contentType = XML_SCHEMA_CONTENT_ELEMENTS; in xmlSchemaFixupComplexType()
18439 if (type->contentType != XML_SCHEMA_CONTENT_EMPTY) { in xmlSchemaFixupComplexType()
18440 if (type->flags & XML_SCHEMAS_TYPE_MIXED) in xmlSchemaFixupComplexType()
18441 type->contentType = XML_SCHEMA_CONTENT_MIXED; in xmlSchemaFixupComplexType()
18447 if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { in xmlSchemaFixupComplexType()
18453 type->contentType = baseType->contentType; in xmlSchemaFixupComplexType()
18454 type->subtypes = baseType->subtypes; in xmlSchemaFixupComplexType()
18460 type->contentTypeDef = baseType->contentTypeDef; in xmlSchemaFixupComplexType()
18464 } else if (baseType->contentType == XML_SCHEMA_CONTENT_EMPTY) { in xmlSchemaFixupComplexType()
18468 if (type->flags & XML_SCHEMAS_TYPE_MIXED) in xmlSchemaFixupComplexType()
18469 type->contentType = XML_SCHEMA_CONTENT_MIXED; in xmlSchemaFixupComplexType()
18474 if (type->flags & XML_SCHEMAS_TYPE_MIXED) in xmlSchemaFixupComplexType()
18475 type->contentType = XML_SCHEMA_CONTENT_MIXED; in xmlSchemaFixupComplexType()
18482 ((WXS_TYPE_PARTICLE_TERM(type))->type == in xmlSchemaFixupComplexType()
18486 * SPEC cos-all-limited (1) in xmlSchemaFixupComplexType()
18494 "a non-empty type, since this would produce a " in xmlSchemaFixupComplexType()
18502 ((WXS_TYPE_PARTICLE_TERM(baseType))->type == in xmlSchemaFixupComplexType()
18506 * SPEC cos-all-limited (1) in xmlSchemaFixupComplexType()
18522 (xmlSchemaTreeItemPtr) type->subtypes; in xmlSchemaFixupComplexType()
18527 type->node, 1, 1); in xmlSchemaFixupComplexType()
18533 particle->children = (xmlSchemaTreeItemPtr) in xmlSchemaFixupComplexType()
18534 xmlSchemaAddModelGroup(pctxt, pctxt->schema, in xmlSchemaFixupComplexType()
18535 XML_SCHEMA_TYPE_SEQUENCE, type->node); in xmlSchemaFixupComplexType()
18536 if (particle->children == NULL) in xmlSchemaFixupComplexType()
18545 particle->children->children = in xmlSchemaFixupComplexType()
18547 type->node, in xmlSchemaFixupComplexType()
18548 ((xmlSchemaParticlePtr) baseType->subtypes)->minOccurs, in xmlSchemaFixupComplexType()
18549 ((xmlSchemaParticlePtr) baseType->subtypes)->maxOccurs); in xmlSchemaFixupComplexType()
18550 if (particle->children->children == NULL) in xmlSchemaFixupComplexType()
18553 particle->children->children; in xmlSchemaFixupComplexType()
18554 particle->children = in xmlSchemaFixupComplexType()
18555 ((xmlSchemaParticlePtr) baseType->subtypes)->children; in xmlSchemaFixupComplexType()
18559 particle->next = effectiveContent; in xmlSchemaFixupComplexType()
18562 * new-particle in xmlSchemaFixupComplexType()
18563 * --> new-sequence( in xmlSchemaFixupComplexType()
18564 * new-particle in xmlSchemaFixupComplexType()
18565 * --> base-model, in xmlSchemaFixupComplexType()
18566 * this-particle in xmlSchemaFixupComplexType()
18567 * --> this-model in xmlSchemaFixupComplexType()
18580 particle->children->children = in xmlSchemaFixupComplexType()
18581 (xmlSchemaTreeItemPtr) baseType->subtypes; in xmlSchemaFixupComplexType()
18588 * - expand attr. group references in xmlSchemaFixupComplexType()
18589 * - intersect attribute wildcards in xmlSchemaFixupComplexType()
18590 * - inherit attribute uses of the base type in xmlSchemaFixupComplexType()
18591 * - inherit or union attr. wildcards if extending in xmlSchemaFixupComplexType()
18592 * - apply attr. use prohibitions if restricting in xmlSchemaFixupComplexType()
18607 if (olderrs != pctxt->nberrors) in xmlSchemaFixupComplexType()
18608 return(pctxt->err); in xmlSchemaFixupComplexType()
18613 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_INVALID; in xmlSchemaFixupComplexType()
18617 return(pctxt->err); in xmlSchemaFixupComplexType()
18620 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_INVALID; in xmlSchemaFixupComplexType()
18624 return(-1); in xmlSchemaFixupComplexType()
18642 if (actxt->type != XML_SCHEMA_CTXT_PARSER) { in xmlSchemaTypeFixup()
18645 return(-1); in xmlSchemaTypeFixup()
18649 if (type->type == XML_SCHEMA_TYPE_COMPLEX) in xmlSchemaTypeFixup()
18651 else if (type->type == XML_SCHEMA_TYPE_SIMPLE) in xmlSchemaTypeFixup()
18666 * -1 in case of an internal or API error.
18677 return(-1); in xmlSchemaCheckFacet()
18687 switch (facet->type) { in xmlSchemaCheckFacet()
18711 * type holding a facet, won't be a built-in type. in xmlSchemaCheckFacet()
18713 * calls (relaxng) do work, if the given type is a built-in in xmlSchemaCheckFacet()
18714 * type, we will assume that the given built-in type *is in xmlSchemaCheckFacet()
18717 if (typeDecl->type != XML_SCHEMA_TYPE_BASIC) { in xmlSchemaCheckFacet()
18718 base = typeDecl->baseType; in xmlSchemaCheckFacet()
18722 return (-1); in xmlSchemaCheckFacet()
18733 return (-1); in xmlSchemaCheckFacet()
18738 * facet->node is just the node holding the facet in xmlSchemaCheckFacet()
18743 ACTXT_CAST pctxt, facet->node, base, in xmlSchemaCheckFacet()
18744 facet->value, &(facet->val), 1, 1, 0); in xmlSchemaCheckFacet()
18750 XML_SCHEMAP_INTERNAL, facet->node, NULL, in xmlSchemaCheckFacet()
18754 facet->value, xmlSchemaFacetTypeToString(facet->type)); in xmlSchemaCheckFacet()
18764 ret, facet->node, WXS_BASIC_CAST facet, in xmlSchemaCheckFacet()
18767 facet->value, in xmlSchemaCheckFacet()
18769 base->targetNamespace, base->name)); in xmlSchemaCheckFacet()
18773 } else if (facet->val == NULL) { in xmlSchemaCheckFacet()
18783 facet->regexp = xmlRegexpCompile(facet->value); in xmlSchemaCheckFacet()
18784 if (facet->regexp == NULL) { in xmlSchemaCheckFacet()
18789 ret, facet->node, WXS_BASIC_CAST typeDecl, in xmlSchemaCheckFacet()
18792 facet->value, NULL); in xmlSchemaCheckFacet()
18802 if (facet->type == XML_SCHEMA_FACET_TOTALDIGITS) { in xmlSchemaCheckFacet()
18805 facet->value, &(facet->val)); in xmlSchemaCheckFacet()
18809 facet->value, &(facet->val)); in xmlSchemaCheckFacet()
18825 ret, facet->node, WXS_BASIC_CAST typeDecl, in xmlSchemaCheckFacet()
18827 facet->value, in xmlSchemaCheckFacet()
18828 xmlSchemaFacetTypeToString(facet->type), in xmlSchemaCheckFacet()
18829 (facet->type != XML_SCHEMA_FACET_TOTALDIGITS) ? in xmlSchemaCheckFacet()
18838 if (xmlStrEqual(facet->value, BAD_CAST "preserve")) { in xmlSchemaCheckFacet()
18839 facet->whitespace = XML_SCHEMAS_FACET_PRESERVE; in xmlSchemaCheckFacet()
18840 } else if (xmlStrEqual(facet->value, BAD_CAST "replace")) { in xmlSchemaCheckFacet()
18841 facet->whitespace = XML_SCHEMAS_FACET_REPLACE; in xmlSchemaCheckFacet()
18842 } else if (xmlStrEqual(facet->value, BAD_CAST "collapse")) { in xmlSchemaCheckFacet()
18843 facet->whitespace = XML_SCHEMAS_FACET_COLLAPSE; in xmlSchemaCheckFacet()
18850 ret, facet->node, WXS_BASIC_CAST typeDecl, in xmlSchemaCheckFacet()
18852 "valid", facet->value, NULL); in xmlSchemaCheckFacet()
18866 return (-1); in xmlSchemaCheckFacet()
18880 int res, olderrs = pctxt->nberrors; in xmlSchemaCheckFacetValues()
18881 const xmlChar *name = typeDecl->name; in xmlSchemaCheckFacetValues()
18886 if (typeDecl->facets != NULL) { in xmlSchemaCheckFacetValues()
18887 xmlSchemaFacetPtr facet = typeDecl->facets; in xmlSchemaCheckFacetValues()
18890 * Temporarily assign the "schema" to the validation context in xmlSchemaCheckFacetValues()
18891 * of the parser context. This is needed for NOTATION validation. in xmlSchemaCheckFacetValues()
18893 if (pctxt->vctxt == NULL) { in xmlSchemaCheckFacetValues()
18894 if (xmlSchemaCreateVCtxtOnPCtxt(pctxt) == -1) in xmlSchemaCheckFacetValues()
18895 return(-1); in xmlSchemaCheckFacetValues()
18897 pctxt->vctxt->schema = pctxt->schema; in xmlSchemaCheckFacetValues()
18901 facet = facet->next; in xmlSchemaCheckFacetValues()
18903 pctxt->vctxt->schema = NULL; in xmlSchemaCheckFacetValues()
18905 if (olderrs != pctxt->nberrors) in xmlSchemaCheckFacetValues()
18906 return(pctxt->err); in xmlSchemaCheckFacetValues()
18909 return(-1); in xmlSchemaCheckFacetValues()
18932 for (; particle != NULL; particle = particle->next) { in xmlSchemaGetCircModelGrDefRef()
18933 term = particle->children; in xmlSchemaGetCircModelGrDefRef()
18936 switch (term->type) { in xmlSchemaGetCircModelGrDefRef()
18945 if (gdef->flags & XML_SCHEMA_MODEL_GROUP_DEF_MARKED) in xmlSchemaGetCircModelGrDefRef()
18947 if (gdef->children != NULL) { in xmlSchemaGetCircModelGrDefRef()
18948 gdef->flags |= XML_SCHEMA_MODEL_GROUP_DEF_MARKED; in xmlSchemaGetCircModelGrDefRef()
18950 gdef->children->children); in xmlSchemaGetCircModelGrDefRef()
18951 gdef->flags ^= XML_SCHEMA_MODEL_GROUP_DEF_MARKED; in xmlSchemaGetCircModelGrDefRef()
18959 circ = xmlSchemaGetCircModelGrDefRef(groupDef, term->children); in xmlSchemaGetCircModelGrDefRef()
18989 (item->type != XML_SCHEMA_TYPE_GROUP) || in xmlSchemaCheckGroupDefCircular()
18990 (item->children == NULL)) in xmlSchemaCheckGroupDefCircular()
18995 circ = xmlSchemaGetCircModelGrDefRef(item, item->children->children); in xmlSchemaCheckGroupDefCircular()
19010 item->targetNamespace, item->name)); in xmlSchemaCheckGroupDefCircular()
19016 circ->children = NULL; in xmlSchemaCheckGroupDefCircular()
19033 * All Group Limited (cos-all-limited) (1.2)
19044 ((WXS_PARTICLE_TERM(particle))->type != in xmlSchemaModelGroupToModelGroupDefFixup()
19047 particle = WXS_PTC_CAST particle->next; in xmlSchemaModelGroupToModelGroupDefFixup()
19055 particle = WXS_PTC_CAST particle->next; in xmlSchemaModelGroupToModelGroupDefFixup()
19064 particle = WXS_PTC_CAST particle->next; in xmlSchemaModelGroupToModelGroupDefFixup()
19089 for (i = 0; i < list->nbItems; i++) { in xmlSchemaCheckAttrGroupCircularRecur()
19090 ref = list->items[i]; in xmlSchemaCheckAttrGroupCircularRecur()
19091 if ((ref->type == XML_SCHEMA_EXTRA_QNAMEREF) && in xmlSchemaCheckAttrGroupCircularRecur()
19092 (ref->itemType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) && in xmlSchemaCheckAttrGroupCircularRecur()
19093 (ref->item != NULL)) in xmlSchemaCheckAttrGroupCircularRecur()
19095 gr = WXS_ATTR_GROUP_CAST ref->item; in xmlSchemaCheckAttrGroupCircularRecur()
19098 if (gr->flags & XML_SCHEMAS_ATTRGROUP_MARKED) in xmlSchemaCheckAttrGroupCircularRecur()
19104 if ((gr->attrUses) && in xmlSchemaCheckAttrGroupCircularRecur()
19105 (gr->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS)) in xmlSchemaCheckAttrGroupCircularRecur()
19107 gr->flags |= XML_SCHEMAS_ATTRGROUP_MARKED; in xmlSchemaCheckAttrGroupCircularRecur()
19109 (xmlSchemaItemListPtr) gr->attrUses); in xmlSchemaCheckAttrGroupCircularRecur()
19110 gr->flags ^= XML_SCHEMAS_ATTRGROUP_MARKED; in xmlSchemaCheckAttrGroupCircularRecur()
19146 if (attrGr->attrUses == NULL) in xmlSchemaCheckAttrGroupCircular()
19148 else if ((attrGr->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS) == 0) in xmlSchemaCheckAttrGroupCircular()
19154 (xmlSchemaItemListPtr) attrGr->attrUses); in xmlSchemaCheckAttrGroupCircular()
19171 circ->item = NULL; in xmlSchemaCheckAttrGroupCircular()
19172 return(ctxt->err); in xmlSchemaCheckAttrGroupCircular()
19210 prohibs->nbItems = 0; in xmlSchemaExpandAttributeGroupRefs()
19212 for (i = 0; i < list->nbItems; i++) { in xmlSchemaExpandAttributeGroupRefs()
19213 use = list->items[i]; in xmlSchemaExpandAttributeGroupRefs()
19215 if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { in xmlSchemaExpandAttributeGroupRefs()
19219 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19224 if (xmlSchemaItemListRemove(list, i) == -1) in xmlSchemaExpandAttributeGroupRefs()
19225 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19226 i--; in xmlSchemaExpandAttributeGroupRefs()
19237 if ((use->type == XML_SCHEMA_EXTRA_QNAMEREF) && in xmlSchemaExpandAttributeGroupRefs()
19238 ((WXS_QNAME_CAST use)->itemType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP)) in xmlSchemaExpandAttributeGroupRefs()
19240 if ((WXS_QNAME_CAST use)->item == NULL) in xmlSchemaExpandAttributeGroupRefs()
19241 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19242 gr = WXS_ATTR_GROUP_CAST (WXS_QNAME_CAST use)->item; in xmlSchemaExpandAttributeGroupRefs()
19248 if ((gr->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED) == 0) { in xmlSchemaExpandAttributeGroupRefs()
19249 if (xmlSchemaAttributeGroupExpandRefs(pctxt, gr) == -1) in xmlSchemaExpandAttributeGroupRefs()
19250 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19256 if (gr->attributeWildcard != NULL) { in xmlSchemaExpandAttributeGroupRefs()
19258 *completeWild = gr->attributeWildcard; in xmlSchemaExpandAttributeGroupRefs()
19271 tmpWild = xmlSchemaAddWildcard(pctxt, pctxt->schema, in xmlSchemaExpandAttributeGroupRefs()
19275 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19277 tmpWild, *completeWild) == -1) in xmlSchemaExpandAttributeGroupRefs()
19278 return (-1); in xmlSchemaExpandAttributeGroupRefs()
19279 tmpWild->processContents = (*completeWild)->processContents; in xmlSchemaExpandAttributeGroupRefs()
19285 gr->attributeWildcard) == -1) in xmlSchemaExpandAttributeGroupRefs()
19286 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19293 sublist = ((xmlSchemaItemListPtr) gr->attrUses); in xmlSchemaExpandAttributeGroupRefs()
19294 if ((sublist == NULL) || sublist->nbItems == 0) { in xmlSchemaExpandAttributeGroupRefs()
19295 if (xmlSchemaItemListRemove(list, i) == -1) in xmlSchemaExpandAttributeGroupRefs()
19296 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19297 i--; in xmlSchemaExpandAttributeGroupRefs()
19303 list->items[i] = sublist->items[0]; in xmlSchemaExpandAttributeGroupRefs()
19304 if (sublist->nbItems != 1) { in xmlSchemaExpandAttributeGroupRefs()
19305 for (j = 1; j < sublist->nbItems; j++) { in xmlSchemaExpandAttributeGroupRefs()
19308 sublist->items[j], i) == -1) in xmlSchemaExpandAttributeGroupRefs()
19309 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19318 if (prohibs && (prohibs->nbItems != 0) && (list->nbItems != 0)) { in xmlSchemaExpandAttributeGroupRefs()
19321 for (i = prohibs->nbItems -1; i >= 0; i--) { in xmlSchemaExpandAttributeGroupRefs()
19322 prohib = prohibs->items[i]; in xmlSchemaExpandAttributeGroupRefs()
19323 for (j = 0; j < list->nbItems; j++) { in xmlSchemaExpandAttributeGroupRefs()
19324 use = list->items[j]; in xmlSchemaExpandAttributeGroupRefs()
19326 if ((prohib->name == WXS_ATTRUSE_DECL_NAME(use)) && in xmlSchemaExpandAttributeGroupRefs()
19327 (prohib->targetNamespace == WXS_ATTRUSE_DECL_TNS(use))) in xmlSchemaExpandAttributeGroupRefs()
19333 prohib->node, NULL, in xmlSchemaExpandAttributeGroupRefs()
19338 prohib->targetNamespace, prohib->name), in xmlSchemaExpandAttributeGroupRefs()
19344 if (xmlSchemaItemListRemove(prohibs, i) == -1) in xmlSchemaExpandAttributeGroupRefs()
19345 return(-1); in xmlSchemaExpandAttributeGroupRefs()
19370 if ((attrGr->attrUses == NULL) || in xmlSchemaAttributeGroupExpandRefs()
19371 (attrGr->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED)) in xmlSchemaAttributeGroupExpandRefs()
19374 attrGr->flags |= XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED; in xmlSchemaAttributeGroupExpandRefs()
19376 &(attrGr->attributeWildcard), attrGr->attrUses, NULL) == -1) in xmlSchemaAttributeGroupExpandRefs()
19377 return(-1); in xmlSchemaAttributeGroupExpandRefs()
19390 * Attribute Group Definition Properties Correct (ag-props-correct)
19397 * SPEC ag-props-correct in xmlSchemaCheckAGPropsCorrect()
19401 * Missing Sub-components ($5.3);" in xmlSchemaCheckAGPropsCorrect()
19404 if ((attrGr->attrUses != NULL) && in xmlSchemaCheckAGPropsCorrect()
19405 (WXS_LIST_CAST attrGr->attrUses)->nbItems > 1) in xmlSchemaCheckAGPropsCorrect()
19407 xmlSchemaItemListPtr uses = WXS_LIST_CAST attrGr->attrUses; in xmlSchemaCheckAGPropsCorrect()
19411 for (i = uses->nbItems -1; i >= 0; i--) { in xmlSchemaCheckAGPropsCorrect()
19412 use = uses->items[i]; in xmlSchemaCheckAGPropsCorrect()
19414 * SPEC ag-props-correct in xmlSchemaCheckAGPropsCorrect()
19420 for (j = i -1; j >= 0; j--) { in xmlSchemaCheckAGPropsCorrect()
19421 tmp = uses->items[j]; in xmlSchemaCheckAGPropsCorrect()
19431 attrGr->node, WXS_BASIC_CAST attrGr, in xmlSchemaCheckAGPropsCorrect()
19439 if (xmlSchemaItemListRemove(uses, i) == -1) in xmlSchemaCheckAGPropsCorrect()
19440 return(-1); in xmlSchemaCheckAGPropsCorrect()
19446 * SPEC ag-props-correct in xmlSchemaCheckAGPropsCorrect()
19450 * TODO: Does 'derived' include member-types of unions? in xmlSchemaCheckAGPropsCorrect()
19461 attrGr->node, WXS_BASIC_CAST attrGr, in xmlSchemaCheckAGPropsCorrect()
19469 if (xmlSchemaItemListRemove(uses, i) == -1) in xmlSchemaCheckAGPropsCorrect()
19470 return(-1); in xmlSchemaCheckAGPropsCorrect()
19495 if (ref->item != NULL) in xmlSchemaResolveAttrGroupReferences()
19497 group = xmlSchemaGetAttributeGroup(ctxt->schema, in xmlSchemaResolveAttrGroupReferences()
19498 ref->name, in xmlSchemaResolveAttrGroupReferences()
19499 ref->targetNamespace); in xmlSchemaResolveAttrGroupReferences()
19503 NULL, ref->node, in xmlSchemaResolveAttrGroupReferences()
19504 "ref", ref->name, ref->targetNamespace, in xmlSchemaResolveAttrGroupReferences()
19505 ref->itemType, NULL); in xmlSchemaResolveAttrGroupReferences()
19506 return(ctxt->err); in xmlSchemaResolveAttrGroupReferences()
19508 ref->item = WXS_BASIC_CAST group; in xmlSchemaResolveAttrGroupReferences()
19520 * Attribute Declaration Properties Correct (a-props-correct)
19532 * SPEC a-props-correct (1) in xmlSchemaCheckAttrPropsCorrect()
19536 * Missing Sub-components ($5.3)." in xmlSchemaCheckAttrPropsCorrect()
19542 if (attr->defValue != NULL) { in xmlSchemaCheckAttrPropsCorrect()
19546 * SPEC a-props-correct (3) in xmlSchemaCheckAttrPropsCorrect()
19559 return(pctxt->err); in xmlSchemaCheckAttrPropsCorrect()
19562 * SPEC a-props-correct (2) in xmlSchemaCheckAttrPropsCorrect()
19570 attr->node, WXS_ATTR_TYPEDEF(attr), in xmlSchemaCheckAttrPropsCorrect()
19571 attr->defValue, &(attr->defVal), in xmlSchemaCheckAttrPropsCorrect()
19577 return(-1); in xmlSchemaCheckAttrPropsCorrect()
19584 return(pctxt->err); in xmlSchemaCheckAttrPropsCorrect()
19602 if (WXS_SUBST_HEAD(ancestor)->flags & XML_SCHEMAS_ELEM_CIRCULAR) in xmlSchemaCheckSubstGroupCircular()
19604 WXS_SUBST_HEAD(ancestor)->flags |= XML_SCHEMAS_ELEM_CIRCULAR; in xmlSchemaCheckSubstGroupCircular()
19607 WXS_SUBST_HEAD(ancestor)->flags ^= XML_SCHEMAS_ELEM_CIRCULAR; in xmlSchemaCheckSubstGroupCircular()
19619 * Element Declaration Properties Correct (e-props-correct)
19634 * Sub-components ($5.3)." in xmlSchemaCheckElemPropsCorrect()
19641 * SPEC (3) "If there is a non-`absent` {substitution group in xmlSchemaCheckElemPropsCorrect()
19644 if ((elemDecl->flags & XML_SCHEMAS_ELEM_GLOBAL) == 0) { in xmlSchemaCheckElemPropsCorrect()
19697 if (head->flags & XML_SCHEMAS_ELEM_FINAL_EXTENSION) in xmlSchemaCheckElemPropsCorrect()
19699 if (head->flags & XML_SCHEMAS_ELEM_FINAL_RESTRICTION) in xmlSchemaCheckElemPropsCorrect()
19730 if ((elemDecl->value != NULL) && in xmlSchemaCheckElemPropsCorrect()
19735 xmlSchemaIsDerivedFromBuiltInType(typeDef->contentTypeDef, in xmlSchemaCheckElemPropsCorrect()
19745 } else if (elemDecl->value != NULL) { in xmlSchemaCheckElemPropsCorrect()
19756 xmlSchemaPErr(pctxt, elemDecl->node, in xmlSchemaCheckElemPropsCorrect()
19759 "type is missing... skipping validation of " in xmlSchemaCheckElemPropsCorrect()
19761 return (-1); in xmlSchemaCheckElemPropsCorrect()
19763 if (elemDecl->node != NULL) { in xmlSchemaCheckElemPropsCorrect()
19764 if (elemDecl->flags & XML_SCHEMAS_ELEM_FIXED) in xmlSchemaCheckElemPropsCorrect()
19765 node = (xmlNodePtr) xmlHasProp(elemDecl->node, in xmlSchemaCheckElemPropsCorrect()
19768 node = (xmlNodePtr) xmlHasProp(elemDecl->node, in xmlSchemaCheckElemPropsCorrect()
19772 typeDef, elemDecl->value, &(elemDecl->defVal)); in xmlSchemaCheckElemPropsCorrect()
19778 return (-1); in xmlSchemaCheckElemPropsCorrect()
19794 * Substitution Group (cos-equiv-class)
19812 (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT)) in xmlSchemaCheckElemSubstGroup()
19830 if (head->flags & XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION) in xmlSchemaCheckElemSubstGroup()
19832 headType = head->subtypes; in xmlSchemaCheckElemSubstGroup()
19833 type = elemDecl->subtypes; in xmlSchemaCheckElemSubstGroup()
19836 if (head->flags & XML_SCHEMAS_ELEM_BLOCK_RESTRICTION) in xmlSchemaCheckElemSubstGroup()
19838 if (head->flags & XML_SCHEMAS_ELEM_BLOCK_EXTENSION) in xmlSchemaCheckElemSubstGroup()
19867 type = type->baseType; in xmlSchemaCheckElemSubstGroup()
19873 type = elemDecl->subtypes->baseType; in xmlSchemaCheckElemSubstGroup()
19876 if ((type->flags & in xmlSchemaCheckElemSubstGroup()
19880 if ((type->flags & in xmlSchemaCheckElemSubstGroup()
19888 type = type->baseType; in xmlSchemaCheckElemSubstGroup()
19899 if ((head->flags & XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD) == 0) in xmlSchemaCheckElemSubstGroup()
19900 head->flags |= XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD; in xmlSchemaCheckElemSubstGroup()
19938 switch (WXS_PARTICLE_TERM(cur)->type) { in xmlSchemaCheckElementDeclConsistent()
19958 * top-level definition [...]" in xmlSchemaCheckElementDeclConsistent()
19960 if (xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->name, in xmlSchemaCheckElementDeclConsistent()
19961 WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->name) && in xmlSchemaCheckElementDeclConsistent()
19962 xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->targetNamespace, in xmlSchemaCheckElementDeclConsistent()
19963 WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->targetNamespace)) in xmlSchemaCheckElementDeclConsistent()
19977 WXS_PARTICLE_TERM_AS_ELEM(cur)->targetNamespace, in xmlSchemaCheckElementDeclConsistent()
19978 WXS_PARTICLE_TERM_AS_ELEM(cur)->name)); in xmlSchemaCheckElementDeclConsistent()
19992 sub = WXS_PARTICLE_TERM(particle)->children; (xmlSchemaParticlePtr) in xmlSchemaCheckElementDeclConsistent()
19998 sub = sub->next; in xmlSchemaCheckElementDeclConsistent()
20012 return(-1); in xmlSchemaCheckElementDeclConsistent()
20014 cur = (xmlSchemaParticlePtr) cur->next; in xmlSchemaCheckElementDeclConsistent()
20037 if (elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_CHECKED) in xmlSchemaCheckElementDeclComponent()
20039 elemDecl->flags |= XML_SCHEMAS_ELEM_INTERNAL_CHECKED; in xmlSchemaCheckElementDeclComponent()
20070 ((WXS_PARTICLE_TERM(particle))->type != in xmlSchemaResolveModelGroupParticleReferences()
20080 particle->children = NULL; in xmlSchemaResolveModelGroupParticleReferences()
20082 refItem = xmlSchemaGetNamedComponent(ctxt->schema, in xmlSchemaResolveModelGroupParticleReferences()
20083 ref->itemType, ref->name, ref->targetNamespace); in xmlSchemaResolveModelGroupParticleReferences()
20086 NULL, WXS_ITEM_NODE(particle), "ref", ref->name, in xmlSchemaResolveModelGroupParticleReferences()
20087 ref->targetNamespace, ref->itemType, NULL); in xmlSchemaResolveModelGroupParticleReferences()
20091 if (refItem->type == XML_SCHEMA_TYPE_GROUP) { in xmlSchemaResolveModelGroupParticleReferences()
20102 if ((WXS_MODELGROUPDEF_MODEL(refItem))->type == in xmlSchemaResolveModelGroupParticleReferences()
20105 * SPEC cos-all-limited (1) in xmlSchemaResolveModelGroupParticleReferences()
20106 * SPEC cos-all-limited (1.2) in xmlSchemaResolveModelGroupParticleReferences()
20125 particle->children = (xmlSchemaTreeItemPtr) refItem; in xmlSchemaResolveModelGroupParticleReferences()
20131 particle->children = (xmlSchemaTreeItemPtr) refItem; in xmlSchemaResolveModelGroupParticleReferences()
20134 particle = WXS_PTC_CAST particle->next; in xmlSchemaResolveModelGroupParticleReferences()
20166 if ((ptx->builtInType == XML_SCHEMAS_STRING) || in xmlSchemaAreValuesEqual()
20176 if (ret == -2) in xmlSchemaAreValuesEqual()
20177 return(-1); in xmlSchemaAreValuesEqual()
20209 return(-1); in xmlSchemaResolveAttrUseReferences()
20210 if ((ause->attrDecl == NULL) || in xmlSchemaResolveAttrUseReferences()
20211 (ause->attrDecl->type != XML_SCHEMA_EXTRA_QNAMEREF)) in xmlSchemaResolveAttrUseReferences()
20215 xmlSchemaQNameRefPtr ref = WXS_QNAME_CAST ause->attrDecl; in xmlSchemaResolveAttrUseReferences()
20221 ause->attrDecl = xmlSchemaGetAttributeDecl(ctxt->schema, in xmlSchemaResolveAttrUseReferences()
20222 ref->name, ref->targetNamespace); in xmlSchemaResolveAttrUseReferences()
20223 if (ause->attrDecl == NULL) { in xmlSchemaResolveAttrUseReferences()
20226 WXS_BASIC_CAST ause, ause->node, in xmlSchemaResolveAttrUseReferences()
20227 "ref", ref->name, ref->targetNamespace, in xmlSchemaResolveAttrUseReferences()
20229 return(ctxt->err);; in xmlSchemaResolveAttrUseReferences()
20241 * Attribute Use Correct (au-props-correct)
20249 return(-1); in xmlSchemaCheckAttrUsePropsCorrect()
20250 if ((use->defValue == NULL) || (WXS_ATTRUSE_DECL(use) == NULL) || in xmlSchemaCheckAttrUsePropsCorrect()
20251 ((WXS_ATTRUSE_DECL(use))->type != XML_SCHEMA_TYPE_ATTRIBUTE)) in xmlSchemaCheckAttrUsePropsCorrect()
20255 * SPEC au-props-correct (1) in xmlSchemaCheckAttrUsePropsCorrect()
20259 * Sub-components ($5.3)." in xmlSchemaCheckAttrUsePropsCorrect()
20262 if (((WXS_ATTRUSE_DECL(use))->defValue != NULL) && in xmlSchemaCheckAttrUsePropsCorrect()
20263 ((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMAS_ATTR_FIXED) && in xmlSchemaCheckAttrUsePropsCorrect()
20264 ((use->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0)) in xmlSchemaCheckAttrUsePropsCorrect()
20273 return(ctxt->err); in xmlSchemaCheckAttrUsePropsCorrect()
20278 if ((use->defVal != NULL) && (WXS_ATTRUSE_TYPEDEF(use) != NULL)) { in xmlSchemaCheckAttrUsePropsCorrect()
20285 * SPEC a-props-correct (3) in xmlSchemaCheckAttrUsePropsCorrect()
20296 return(ctxt->err); in xmlSchemaCheckAttrUsePropsCorrect()
20300 use->node, WXS_ATTRUSE_TYPEDEF(use), in xmlSchemaCheckAttrUsePropsCorrect()
20301 use->defValue, &(use->defVal), in xmlSchemaCheckAttrUsePropsCorrect()
20307 return(-1); in xmlSchemaCheckAttrUsePropsCorrect()
20314 return(ctxt->err); in xmlSchemaCheckAttrUsePropsCorrect()
20318 * SPEC au-props-correct (2) in xmlSchemaCheckAttrUsePropsCorrect()
20324 if (((WXS_ATTRUSE_DECL(use))->defVal != NULL) && in xmlSchemaCheckAttrUsePropsCorrect()
20325 (((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0)) in xmlSchemaCheckAttrUsePropsCorrect()
20327 if (! xmlSchemaAreValuesEqual(use->defVal, in xmlSchemaCheckAttrUsePropsCorrect()
20328 (WXS_ATTRUSE_DECL(use))->defVal)) in xmlSchemaCheckAttrUsePropsCorrect()
20336 (WXS_ATTRUSE_DECL(use))->defValue); in xmlSchemaCheckAttrUsePropsCorrect()
20338 return(ctxt->err); in xmlSchemaCheckAttrUsePropsCorrect()
20361 * [attribute], if present, otherwise the `simple ur-type definition`. in xmlSchemaResolveAttrTypeReferences()
20363 if (item->flags & XML_SCHEMAS_ATTR_INTERNAL_RESOLVED) in xmlSchemaResolveAttrTypeReferences()
20365 item->flags |= XML_SCHEMAS_ATTR_INTERNAL_RESOLVED; in xmlSchemaResolveAttrTypeReferences()
20366 if (item->subtypes != NULL) in xmlSchemaResolveAttrTypeReferences()
20368 if (item->typeName != NULL) { in xmlSchemaResolveAttrTypeReferences()
20371 type = xmlSchemaGetType(ctxt->schema, item->typeName, in xmlSchemaResolveAttrTypeReferences()
20372 item->typeNs); in xmlSchemaResolveAttrTypeReferences()
20376 WXS_BASIC_CAST item, item->node, in xmlSchemaResolveAttrTypeReferences()
20377 "type", item->typeName, item->typeNs, in xmlSchemaResolveAttrTypeReferences()
20379 return(ctxt->err); in xmlSchemaResolveAttrTypeReferences()
20381 item->subtypes = type; in xmlSchemaResolveAttrTypeReferences()
20387 item->subtypes = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); in xmlSchemaResolveAttrTypeReferences()
20394 * @idc: the identity-constraint definition
20400 * Identity-constraint Definition Properties Correct (c-props-correct)
20406 if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) in xmlSchemaResolveIDCKeyReferences()
20408 if (idc->ref->name != NULL) { in xmlSchemaResolveIDCKeyReferences()
20409 idc->ref->item = (xmlSchemaBasicItemPtr) in xmlSchemaResolveIDCKeyReferences()
20410 xmlSchemaGetIDC(pctxt->schema, idc->ref->name, in xmlSchemaResolveIDCKeyReferences()
20411 idc->ref->targetNamespace); in xmlSchemaResolveIDCKeyReferences()
20412 if (idc->ref->item == NULL) { in xmlSchemaResolveIDCKeyReferences()
20419 WXS_BASIC_CAST idc, idc->node, in xmlSchemaResolveIDCKeyReferences()
20420 "refer", idc->ref->name, in xmlSchemaResolveIDCKeyReferences()
20421 idc->ref->targetNamespace, in xmlSchemaResolveIDCKeyReferences()
20423 return(pctxt->err); in xmlSchemaResolveIDCKeyReferences()
20424 } else if (idc->ref->item->type == XML_SCHEMA_TYPE_IDC_KEYREF) { in xmlSchemaResolveIDCKeyReferences()
20426 * SPEC c-props-correct (1) in xmlSchemaResolveIDCKeyReferences()
20433 idc->ref->item = NULL; in xmlSchemaResolveIDCKeyReferences()
20434 return(pctxt->err); in xmlSchemaResolveIDCKeyReferences()
20436 if (idc->nbFields != in xmlSchemaResolveIDCKeyReferences()
20437 ((xmlSchemaIDCPtr) idc->ref->item)->nbFields) { in xmlSchemaResolveIDCKeyReferences()
20441 refer = (xmlSchemaIDCPtr) idc->ref->item; in xmlSchemaResolveIDCKeyReferences()
20443 * SPEC c-props-correct(2) in xmlSchemaResolveIDCKeyReferences()
20444 * "If the {identity-constraint category} is keyref, in xmlSchemaResolveIDCKeyReferences()
20453 xmlSchemaFormatQName(&str, refer->targetNamespace, in xmlSchemaResolveIDCKeyReferences()
20454 refer->name), in xmlSchemaResolveIDCKeyReferences()
20457 return(pctxt->err); in xmlSchemaResolveIDCKeyReferences()
20468 if (xmlSchemaGetAttributeDecl(pctxt->schema, prohib->name, in xmlSchemaResolveAttrUseProhibReferences()
20469 prohib->targetNamespace) == NULL) { in xmlSchemaResolveAttrUseProhibReferences()
20473 NULL, prohib->node, in xmlSchemaResolveAttrUseProhibReferences()
20474 "ref", prohib->name, prohib->targetNamespace, in xmlSchemaResolveAttrUseProhibReferences()
20482 (((xmlSchemaTypePtr) item)->flags & XML_SCHEMAS_TYPE_REDEFINED)
20485 (((xmlSchemaModelGroupDefPtr) item)->flags & XML_SCHEMA_MODEL_GROUP_DEF_REDEFINED)
20488 (((xmlSchemaAttributeGroupPtr) item)->flags & XML_SCHEMAS_ATTRGROUP_REDEFINED)
20494 xmlSchemaRedefPtr redef = WXS_CONSTRUCTOR(pctxt)->redefs; in xmlSchemaCheckSRCRedefineFirst()
20502 item = redef->item; in xmlSchemaCheckSRCRedefineFirst()
20507 * http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005OctDec/0019.html in xmlSchemaCheckSRCRedefineFirst()
20510 * would include all imported and included sub-schemas of the in xmlSchemaCheckSRCRedefineFirst()
20517 redef->targetBucket, item->type, in xmlSchemaCheckSRCRedefineFirst()
20518 redef->refName, redef->refTargetNs); in xmlSchemaCheckSRCRedefineFirst()
20524 * SPEC src-redefine: in xmlSchemaCheckSRCRedefineFirst()
20534 * to components, the spec assumes the src-resolve to be used; in xmlSchemaCheckSRCRedefineFirst()
20538 if (redef->reference) in xmlSchemaCheckSRCRedefineFirst()
20539 node = WXS_ITEM_NODE(redef->reference); in xmlSchemaCheckSRCRedefineFirst()
20552 xmlSchemaFormatQName(&str, redef->refTargetNs, in xmlSchemaCheckSRCRedefineFirst()
20553 redef->refName)); in xmlSchemaCheckSRCRedefineFirst()
20555 err = pctxt->err; in xmlSchemaCheckSRCRedefineFirst()
20556 redef = redef->next; in xmlSchemaCheckSRCRedefineFirst()
20564 switch (item->type) { in xmlSchemaCheckSRCRedefineFirst()
20567 if ((WXS_TYPE_CAST prev)->flags & in xmlSchemaCheckSRCRedefineFirst()
20574 (WXS_TYPE_CAST prev)->flags |= XML_SCHEMAS_TYPE_REDEFINED; in xmlSchemaCheckSRCRedefineFirst()
20580 ((xmlSchemaTypePtr) item)->baseType = in xmlSchemaCheckSRCRedefineFirst()
20584 if ((WXS_MODEL_GROUPDEF_CAST prev)->flags & in xmlSchemaCheckSRCRedefineFirst()
20591 (WXS_MODEL_GROUPDEF_CAST prev)->flags |= in xmlSchemaCheckSRCRedefineFirst()
20593 if (redef->reference != NULL) { in xmlSchemaCheckSRCRedefineFirst()
20595 * Overwrite the QName-reference with the in xmlSchemaCheckSRCRedefineFirst()
20598 (WXS_PTC_CAST redef->reference)->children = in xmlSchemaCheckSRCRedefineFirst()
20601 redef->target = prev; in xmlSchemaCheckSRCRedefineFirst()
20604 if ((WXS_ATTR_GROUP_CAST prev)->flags & in xmlSchemaCheckSRCRedefineFirst()
20610 (WXS_ATTR_GROUP_CAST prev)->flags |= in xmlSchemaCheckSRCRedefineFirst()
20612 if (redef->reference != NULL) { in xmlSchemaCheckSRCRedefineFirst()
20615 * QName-reference component. in xmlSchemaCheckSRCRedefineFirst()
20619 (WXS_QNAME_CAST redef->reference)->item = prev; in xmlSchemaCheckSRCRedefineFirst()
20620 redef->target = NULL; in xmlSchemaCheckSRCRedefineFirst()
20624 * to apply src-redefine (7.2.2) at a later in xmlSchemaCheckSRCRedefineFirst()
20629 redef->target = prev; in xmlSchemaCheckSRCRedefineFirst()
20635 return(-1); in xmlSchemaCheckSRCRedefineFirst()
20641 if (redef->reference) in xmlSchemaCheckSRCRedefineFirst()
20642 node = WXS_ITEM_NODE(redef->reference); in xmlSchemaCheckSRCRedefineFirst()
20644 node = WXS_ITEM_NODE(redef->item); in xmlSchemaCheckSRCRedefineFirst()
20655 err = pctxt->err; in xmlSchemaCheckSRCRedefineFirst()
20656 redef = redef->next; in xmlSchemaCheckSRCRedefineFirst()
20659 redef = redef->next; in xmlSchemaCheckSRCRedefineFirst()
20669 xmlSchemaRedefPtr redef = WXS_CONSTRUCTOR(pctxt)->redefs; in xmlSchemaCheckSRCRedefineSecond()
20676 if (redef->target == NULL) { in xmlSchemaCheckSRCRedefineSecond()
20677 redef = redef->next; in xmlSchemaCheckSRCRedefineSecond()
20680 item = redef->item; in xmlSchemaCheckSRCRedefineSecond()
20682 switch (item->type) { in xmlSchemaCheckSRCRedefineSecond()
20689 (WXS_TYPE_CAST redef->target)->name = NULL; in xmlSchemaCheckSRCRedefineSecond()
20699 * SPEC src-redefine: in xmlSchemaCheckSRCRedefineSecond()
20710 * SPEC src-redefine: in xmlSchemaCheckSRCRedefineSecond()
20724 item, redef->target, in xmlSchemaCheckSRCRedefineSecond()
20725 (WXS_ATTR_GROUP_CAST item)->attrUses, in xmlSchemaCheckSRCRedefineSecond()
20726 (WXS_ATTR_GROUP_CAST redef->target)->attrUses, in xmlSchemaCheckSRCRedefineSecond()
20727 (WXS_ATTR_GROUP_CAST item)->attributeWildcard, in xmlSchemaCheckSRCRedefineSecond()
20728 (WXS_ATTR_GROUP_CAST redef->target)->attributeWildcard); in xmlSchemaCheckSRCRedefineSecond()
20729 if (err == -1) in xmlSchemaCheckSRCRedefineSecond()
20730 return(-1); in xmlSchemaCheckSRCRedefineSecond()
20735 redef = redef->next; in xmlSchemaCheckSRCRedefineSecond()
20752 if (WXS_IS_BUCKET_IMPMAIN((c)->type)) \ in xmlSchemaAddComponents()
20753 table = &(WXS_IMPBUCKET((c))->schema->slot); \ in xmlSchemaAddComponents()
20755 table = &(WXS_INCBUCKET((c))->ownerImport->schema->slot); } in xmlSchemaAddComponents()
20767 * (I hope I'll still know what this means after some months :-() in xmlSchemaAddComponents()
20770 return(-1); in xmlSchemaAddComponents()
20771 if (bucket->flags & XML_SCHEMA_BUCKET_COMPS_ADDED) in xmlSchemaAddComponents()
20773 bucket->flags |= XML_SCHEMA_BUCKET_COMPS_ADDED; in xmlSchemaAddComponents()
20775 for (i = 0; i < bucket->globals->nbItems; i++) { in xmlSchemaAddComponents()
20776 item = bucket->globals->items[i]; in xmlSchemaAddComponents()
20778 switch (item->type) { in xmlSchemaAddComponents()
20783 name = (WXS_TYPE_CAST item)->name; in xmlSchemaAddComponents()
20787 name = (WXS_ELEM_CAST item)->name; in xmlSchemaAddComponents()
20791 name = (WXS_ATTR_CAST item)->name; in xmlSchemaAddComponents()
20797 name = (WXS_MODEL_GROUPDEF_CAST item)->name; in xmlSchemaAddComponents()
20803 name = (WXS_ATTR_GROUP_CAST item)->name; in xmlSchemaAddComponents()
20809 name = (WXS_IDC_CAST item)->name; in xmlSchemaAddComponents()
20813 name = ((xmlSchemaNotationPtr) item)->name; in xmlSchemaAddComponents()
20822 *table = xmlHashCreateDict(10, pctxt->dict); in xmlSchemaAddComponents()
20826 return(-1); in xmlSchemaAddComponents()
20846 if (bucket->relations != NULL) { in xmlSchemaAddComponents()
20847 xmlSchemaSchemaRelationPtr rel = bucket->relations; in xmlSchemaAddComponents()
20849 if ((rel->bucket != NULL) && in xmlSchemaAddComponents()
20850 ((rel->bucket->flags & XML_SCHEMA_BUCKET_COMPS_ADDED) == 0)) { in xmlSchemaAddComponents()
20851 if (xmlSchemaAddComponents(pctxt, rel->bucket) == -1) in xmlSchemaAddComponents()
20852 return(-1); in xmlSchemaAddComponents()
20854 rel = rel->next; in xmlSchemaAddComponents()
20864 xmlSchemaConstructionCtxtPtr con = pctxt->constructor; in xmlSchemaFixupComponents()
20867 xmlSchemaBucketPtr oldbucket = con->bucket; in xmlSchemaFixupComponents()
20870 #define FIXHFAILURE if (pctxt->err == XML_SCHEMAP_INTERNAL) goto exit_failure; in xmlSchemaFixupComponents()
20872 if ((con->pending == NULL) || in xmlSchemaFixupComponents()
20873 (con->pending->nbItems == 0)) in xmlSchemaFixupComponents()
20883 if (con->bucket == NULL) in xmlSchemaFixupComponents()
20884 con->bucket = rootBucket; in xmlSchemaFixupComponents()
20887 * SPEC (src-redefine): in xmlSchemaFixupComponents()
20888 * (6.2) "If it has no such self-reference, then all of the in xmlSchemaFixupComponents()
20904 pctxt->ctxtType = NULL; in xmlSchemaFixupComponents()
20905 items = (xmlSchemaTreeItemPtr *) con->pending->items; in xmlSchemaFixupComponents()
20906 nbItems = con->pending->nbItems; in xmlSchemaFixupComponents()
20916 * - the type definition in xmlSchemaFixupComponents()
20917 * - the substitution group affiliation in xmlSchemaFixupComponents()
20919 * - the base type definition in xmlSchemaFixupComponents()
20920 * - the memberTypes of union types in xmlSchemaFixupComponents()
20921 * - the itemType of list types in xmlSchemaFixupComponents()
20923 * - the type definition in xmlSchemaFixupComponents()
20924 * - if an attribute use, then the attribute declaration in xmlSchemaFixupComponents()
20926 * - the attribute group definition in xmlSchemaFixupComponents()
20928 * - the term of the particle (e.g. a model group) in xmlSchemaFixupComponents()
20929 * 6. IDC key-references: in xmlSchemaFixupComponents()
20930 * - the referenced IDC 'key' or 'unique' definition in xmlSchemaFixupComponents()
20935 switch (item->type) { in xmlSchemaFixupComponents()
20958 if ((WXS_QNAME_CAST item)->itemType == in xmlSchemaFixupComponents()
20993 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21009 switch (item->type) { in xmlSchemaFixupComponents()
21015 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21022 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21029 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21036 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21048 switch (item->type) { in xmlSchemaFixupComponents()
21058 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21065 switch (item->type) { in xmlSchemaFixupComponents()
21079 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21088 switch (item->type) { in xmlSchemaFixupComponents()
21100 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21108 switch (item->type) { in xmlSchemaFixupComponents()
21110 if (((xmlSchemaTypePtr) item)->memberTypes != NULL) { in xmlSchemaFixupComponents()
21120 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21128 switch (item->type) { in xmlSchemaFixupComponents()
21139 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21149 switch (item->type) { in xmlSchemaFixupComponents()
21158 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21165 switch (item->type) { in xmlSchemaFixupComponents()
21167 if (((xmlSchemaAttributeUsePtr)item)->defValue != NULL) { in xmlSchemaFixupComponents()
21177 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21185 switch (item->type) { in xmlSchemaFixupComponents()
21187 if (( (WXS_ATTR_GROUP_CAST item)->attrUses != NULL) && in xmlSchemaFixupComponents()
21188 ( (WXS_LIST_CAST (WXS_ATTR_GROUP_CAST item)->attrUses)->nbItems > 1)) in xmlSchemaFixupComponents()
21198 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21204 if (WXS_CONSTRUCTOR(pctxt)->redefs != NULL) in xmlSchemaFixupComponents()
21206 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21213 item = con->pending->items[i]; in xmlSchemaFixupComponents()
21214 switch (item->type) { in xmlSchemaFixupComponents()
21225 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21232 items = (xmlSchemaTreeItemPtr *) con->pending->items; in xmlSchemaFixupComponents()
21233 nbItems = con->pending->nbItems; in xmlSchemaFixupComponents()
21240 switch (item->type) { in xmlSchemaFixupComponents()
21244 if ((elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_CHECKED) == 0) in xmlSchemaFixupComponents()
21271 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21281 switch (item->type) { in xmlSchemaFixupComponents()
21290 if (pctxt->nberrors != 0) in xmlSchemaFixupComponents()
21293 * URGENT TODO: cos-element-consistent in xmlSchemaFixupComponents()
21298 ret = pctxt->err; in xmlSchemaFixupComponents()
21302 ret = -1; in xmlSchemaFixupComponents()
21310 con->bucket = oldbucket; in xmlSchemaFixupComponents()
21311 con->pending->nbItems = 0; in xmlSchemaFixupComponents()
21312 if (con->substGroups != NULL) { in xmlSchemaFixupComponents()
21313 xmlHashFree(con->substGroups, xmlSchemaSubstGroupFreeEntry); in xmlSchemaFixupComponents()
21314 con->substGroups = NULL; in xmlSchemaFixupComponents()
21316 if (con->redefs != NULL) { in xmlSchemaFixupComponents()
21317 xmlSchemaRedefListFree(con->redefs); in xmlSchemaFixupComponents()
21318 con->redefs = NULL; in xmlSchemaFixupComponents()
21324 * @ctxt: a schema validation context
21350 ctxt->nberrors = 0; in xmlSchemaParse()
21351 ctxt->err = 0; in xmlSchemaParse()
21352 ctxt->counter = 0; in xmlSchemaParse()
21361 if (ctxt->constructor == NULL) { in xmlSchemaParse()
21362 ctxt->constructor = xmlSchemaConstructionCtxtCreate(ctxt->dict); in xmlSchemaParse()
21363 if (ctxt->constructor == NULL) in xmlSchemaParse()
21366 ctxt->ownsConstructor = 1; in xmlSchemaParse()
21368 ctxt->constructor->mainSchema = mainSchema; in xmlSchemaParse()
21373 ctxt->URL, ctxt->doc, ctxt->buffer, ctxt->size, NULL, in xmlSchemaParse()
21375 if (res == -1) in xmlSchemaParse()
21382 if (ctxt->URL) in xmlSchemaParse()
21386 ctxt->URL, NULL); in xmlSchemaParse()
21395 if (xmlSchemaParseNewDocWithContext(ctxt, mainSchema, bucket) == -1) in xmlSchemaParse()
21397 if (ctxt->nberrors != 0) in xmlSchemaParse()
21400 mainSchema->doc = bucket->doc; in xmlSchemaParse()
21401 mainSchema->preserve = ctxt->preserve; in xmlSchemaParse()
21403 ctxt->schema = mainSchema; in xmlSchemaParse()
21405 if (xmlSchemaFixupComponents(ctxt, WXS_CONSTRUCTOR(ctxt)->mainBucket) == -1) in xmlSchemaParse()
21413 if (ctxt->nberrors != 0) { in xmlSchemaParse()
21418 if (ctxt->constructor) { in xmlSchemaParse()
21419 xmlSchemaConstructionCtxtFree(ctxt->constructor); in xmlSchemaParse()
21420 ctxt->constructor = NULL; in xmlSchemaParse()
21421 ctxt->ownsConstructor = 0; in xmlSchemaParse()
21424 ctxt->schema = NULL; in xmlSchemaParse()
21435 if (ctxt->constructor) { in xmlSchemaParse()
21436 xmlSchemaConstructionCtxtFree(ctxt->constructor); in xmlSchemaParse()
21437 ctxt->constructor = NULL; in xmlSchemaParse()
21438 ctxt->ownsConstructor = 0; in xmlSchemaParse()
21442 ctxt->schema = NULL; in xmlSchemaParse()
21448 * @ctxt: a schema validation context
21453 * Set the callback functions used to handle errors for a validation context
21462 ctxt->error = err; in xmlSchemaSetParserErrors()
21463 ctxt->warning = warn; in xmlSchemaSetParserErrors()
21464 ctxt->errCtxt = ctx; in xmlSchemaSetParserErrors()
21465 if (ctxt->vctxt != NULL) in xmlSchemaSetParserErrors()
21466 xmlSchemaSetValidErrors(ctxt->vctxt, err, warn, ctx); in xmlSchemaSetParserErrors()
21484 ctxt->serror = serror; in xmlSchemaSetParserStructuredErrors()
21485 ctxt->errCtxt = ctx; in xmlSchemaSetParserStructuredErrors()
21486 if (ctxt->vctxt != NULL) in xmlSchemaSetParserStructuredErrors()
21487 xmlSchemaSetValidStructuredErrors(ctxt->vctxt, serror, ctx); in xmlSchemaSetParserStructuredErrors()
21492 * @ctxt: a XMl-Schema parser context
21499 * Returns -1 in case of failure, 0 otherwise
21507 return(-1); in xmlSchemaGetParserErrors()
21509 *err = ctxt->error; in xmlSchemaGetParserErrors()
21511 *warn = ctxt->warning; in xmlSchemaGetParserErrors()
21513 *ctx = ctxt->errCtxt; in xmlSchemaGetParserErrors()
21567 if (type->type == XML_SCHEMA_TYPE_BASIC) { in xmlSchemaGetWhiteSpaceFacetValue()
21571 if ((type->builtInType == XML_SCHEMAS_STRING) || in xmlSchemaGetWhiteSpaceFacetValue()
21572 (type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) in xmlSchemaGetWhiteSpaceFacetValue()
21574 else if (type->builtInType == XML_SCHEMAS_NORMSTRING) in xmlSchemaGetWhiteSpaceFacetValue()
21581 * Note that this includes built-in list datatypes. in xmlSchemaGetWhiteSpaceFacetValue()
21593 if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE) in xmlSchemaGetWhiteSpaceFacetValue()
21595 else if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_REPLACE) in xmlSchemaGetWhiteSpaceFacetValue()
21600 return (-1); in xmlSchemaGetWhiteSpaceFacetValue()
21605 * Simple type validation *
21612 * DOM Validation code *
21619 * @vctxt: a schema validation context
21628 * number otherwise and -1 in case of an internal or API error.
21642 return (-1); in xmlSchemaAssembleByLocation()
21644 if (vctxt->pctxt == NULL) { in xmlSchemaAssembleByLocation()
21647 return(-1); in xmlSchemaAssembleByLocation()
21649 pctxt = vctxt->pctxt; in xmlSchemaAssembleByLocation()
21650 if (pctxt->constructor == NULL) { in xmlSchemaAssembleByLocation()
21653 return(-1); in xmlSchemaAssembleByLocation()
21658 location = xmlSchemaBuildAbsoluteURI(pctxt->dict, in xmlSchemaAssembleByLocation()
21685 (WXS_CONSTRUCTOR(pctxt)->bucket == NULL)) in xmlSchemaAssembleByLocation()
21686 WXS_CONSTRUCTOR(pctxt)->bucket = bucket; in xmlSchemaAssembleByLocation()
21697 pctxt->nberrors = 0; in xmlSchemaAssembleByLocation()
21698 pctxt->err = 0; in xmlSchemaAssembleByLocation()
21699 pctxt->doc = bucket->doc; in xmlSchemaAssembleByLocation()
21702 if (ret == -1) { in xmlSchemaAssembleByLocation()
21703 pctxt->doc = NULL; in xmlSchemaAssembleByLocation()
21707 if ((ret == 0) && (pctxt->nberrors != 0)) in xmlSchemaAssembleByLocation()
21708 ret = pctxt->err; in xmlSchemaAssembleByLocation()
21709 if (pctxt->nberrors == 0) { in xmlSchemaAssembleByLocation()
21713 * For every XSI acquired schema (and its sub-schemata) we will in xmlSchemaAssembleByLocation()
21717 ret = pctxt->err; in xmlSchemaAssembleByLocation()
21720 * error to the validation context. in xmlSchemaAssembleByLocation()
21722 if ((ret != 0) && (vctxt->err == 0)) in xmlSchemaAssembleByLocation()
21723 vctxt->err = ret; in xmlSchemaAssembleByLocation()
21724 vctxt->nberrors += pctxt->nberrors; in xmlSchemaAssembleByLocation()
21726 /* Add to validation error sum. */ in xmlSchemaAssembleByLocation()
21727 vctxt->nberrors += pctxt->nberrors; in xmlSchemaAssembleByLocation()
21729 pctxt->doc = NULL; in xmlSchemaAssembleByLocation()
21732 pctxt->doc = NULL; in xmlSchemaAssembleByLocation()
21733 return (-1); in xmlSchemaAssembleByLocation()
21740 if (vctxt->nbAttrInfos == 0) in xmlSchemaGetMetaAttrInfo()
21746 for (i = 0; i < vctxt->nbAttrInfos; i++) { in xmlSchemaGetMetaAttrInfo()
21747 iattr = vctxt->attrInfos[i]; in xmlSchemaGetMetaAttrInfo()
21748 if (iattr->metaType == metaType) in xmlSchemaGetMetaAttrInfo()
21758 * @vctxt: a schema validation context
21766 * number otherwise and -1 in case of an internal or API error.
21792 cur = iattr->value; in xmlSchemaAssembleByXSI()
21797 if (iattr->metaType == XML_SCHEMA_ATTR_INFO_META_XSI_SCHEMA_LOC) { in xmlSchemaAssembleByXSI()
21809 nsname = xmlDictLookup(vctxt->schema->dict, cur, end - cur); in xmlSchemaAssembleByXSI()
21821 if (iattr->metaType == in xmlSchemaAssembleByXSI()
21829 iattr->node, NULL, in xmlSchemaAssembleByXSI()
21836 location = xmlDictLookup(vctxt->schema->dict, cur, end - cur); in xmlSchemaAssembleByXSI()
21838 ret = xmlSchemaAssembleByLocation(vctxt, vctxt->schema, in xmlSchemaAssembleByXSI()
21839 iattr->node, nsname, location); in xmlSchemaAssembleByXSI()
21840 if (ret == -1) { in xmlSchemaAssembleByXSI()
21843 return (-1); in xmlSchemaAssembleByXSI()
21853 if (vctxt->sax != NULL) { in xmlSchemaLookupNamespace()
21857 for (i = vctxt->depth; i >= 0; i--) { in xmlSchemaLookupNamespace()
21858 if (vctxt->elemInfos[i]->nbNsBindings != 0) { in xmlSchemaLookupNamespace()
21859 inode = vctxt->elemInfos[i]; in xmlSchemaLookupNamespace()
21860 for (j = 0; j < inode->nbNsBindings * 2; j += 2) { in xmlSchemaLookupNamespace()
21862 (inode->nsBindings[j] == NULL)) || in xmlSchemaLookupNamespace()
21864 inode->nsBindings[j]))) { in xmlSchemaLookupNamespace()
21870 return (inode->nsBindings[j+1]); in xmlSchemaLookupNamespace()
21877 } else if (vctxt->reader != NULL) { in xmlSchemaLookupNamespace()
21880 nsName = xmlTextReaderLookupNamespace(vctxt->reader, prefix); in xmlSchemaLookupNamespace()
21884 ret = xmlDictLookup(vctxt->dict, nsName, -1); in xmlSchemaLookupNamespace()
21893 if ((vctxt->inode->node == NULL) || in xmlSchemaLookupNamespace()
21894 (vctxt->inode->node->doc == NULL)) { in xmlSchemaLookupNamespace()
21899 ns = xmlSearchNs(vctxt->inode->node->doc, in xmlSchemaLookupNamespace()
21900 vctxt->inode->node, prefix); in xmlSchemaLookupNamespace()
21902 return (ns->href); in xmlSchemaLookupNamespace()
21908 * This one works on the schema of the validation context.
21920 if (vctxt && (vctxt->schema == NULL)) { in xmlSchemaValidateNotation()
21922 "a schema is needed on the validation context"); in xmlSchemaValidateNotation()
21923 return (-1); in xmlSchemaValidateNotation()
21939 xmlNsPtr ns = xmlSearchNs(node->doc, node, prefix); in xmlSchemaValidateNotation()
21941 nsName = ns->href; in xmlSchemaValidateNotation()
21957 ret = -1; in xmlSchemaValidateNotation()
21969 ret = -1; in xmlSchemaValidateNotation()
21985 lname = xmlDictLookup(vctxt->dict, lname, -1); in xmlSchemaVAddNodeQName()
21987 return(-1); in xmlSchemaVAddNodeQName()
21989 nsname = xmlDictLookup(vctxt->dict, nsname, -1); in xmlSchemaVAddNodeQName()
21991 return(-1); in xmlSchemaVAddNodeQName()
21993 for (i = 0; i < vctxt->nodeQNames->nbItems; i += 2) { in xmlSchemaVAddNodeQName()
21994 if ((vctxt->nodeQNames->items [i] == lname) && in xmlSchemaVAddNodeQName()
21995 (vctxt->nodeQNames->items[i +1] == nsname)) in xmlSchemaVAddNodeQName()
22000 i = vctxt->nodeQNames->nbItems; in xmlSchemaVAddNodeQName()
22001 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) lname); in xmlSchemaVAddNodeQName()
22002 xmlSchemaItemListAdd(vctxt->nodeQNames, (void *) nsname); in xmlSchemaVAddNodeQName()
22008 * Validation of identity-constraints (IDC) *
22035 aidc->keyrefDepth = -1; in xmlSchemaAugmentIDC()
22036 aidc->def = idcDef; in xmlSchemaAugmentIDC()
22037 aidc->next = NULL; in xmlSchemaAugmentIDC()
22038 if (vctxt->aidcs == NULL) in xmlSchemaAugmentIDC()
22039 vctxt->aidcs = aidc; in xmlSchemaAugmentIDC()
22041 aidc->next = vctxt->aidcs; in xmlSchemaAugmentIDC()
22042 vctxt->aidcs = aidc; in xmlSchemaAugmentIDC()
22047 if ((vctxt->hasKeyrefs == 0) && in xmlSchemaAugmentIDC()
22048 (idcDef->type == XML_SCHEMA_TYPE_IDC_KEYREF)) in xmlSchemaAugmentIDC()
22049 vctxt->hasKeyrefs = 1; in xmlSchemaAugmentIDC()
22063 if (imported->schema->idcDef != NULL) { in xmlSchemaAugmentImportedIDC()
22064 xmlHashScan(imported->schema->idcDef, xmlSchemaAugmentIDC, vctxt); in xmlSchemaAugmentImportedIDC()
22089 ret->definition = idcDef; in xmlSchemaIDCNewBinding()
22095 * @vctxt: the WXS validation context
22098 * The validation context is used to store IDC node table items.
22099 * They are stored to avoid copying them if IDC node-tables are merged
22100 * with corresponding parent IDC node-tables (bubbling).
22102 * Returns 0 if succeeded, -1 on internal errors.
22111 if (vctxt->idcNodes == NULL) { in xmlSchemaIDCStoreNodeTableItem()
22112 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *) in xmlSchemaIDCStoreNodeTableItem()
22114 if (vctxt->idcNodes == NULL) { in xmlSchemaIDCStoreNodeTableItem()
22117 return (-1); in xmlSchemaIDCStoreNodeTableItem()
22119 vctxt->sizeIdcNodes = 20; in xmlSchemaIDCStoreNodeTableItem()
22120 } else if (vctxt->sizeIdcNodes <= vctxt->nbIdcNodes) { in xmlSchemaIDCStoreNodeTableItem()
22121 vctxt->sizeIdcNodes *= 2; in xmlSchemaIDCStoreNodeTableItem()
22122 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *) in xmlSchemaIDCStoreNodeTableItem()
22123 xmlRealloc(vctxt->idcNodes, vctxt->sizeIdcNodes * in xmlSchemaIDCStoreNodeTableItem()
22125 if (vctxt->idcNodes == NULL) { in xmlSchemaIDCStoreNodeTableItem()
22127 "re-allocating the IDC node table item list", NULL); in xmlSchemaIDCStoreNodeTableItem()
22128 return (-1); in xmlSchemaIDCStoreNodeTableItem()
22131 vctxt->idcNodes[vctxt->nbIdcNodes++] = item; in xmlSchemaIDCStoreNodeTableItem()
22138 * @vctxt: the WXS validation context
22141 * The validation context is used to store an IDC key.
22143 * Returns 0 if succeeded, -1 on internal errors.
22152 if (vctxt->idcKeys == NULL) { in xmlSchemaIDCStoreKey()
22153 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *) in xmlSchemaIDCStoreKey()
22155 if (vctxt->idcKeys == NULL) { in xmlSchemaIDCStoreKey()
22158 return (-1); in xmlSchemaIDCStoreKey()
22160 vctxt->sizeIdcKeys = 40; in xmlSchemaIDCStoreKey()
22161 } else if (vctxt->sizeIdcKeys <= vctxt->nbIdcKeys) { in xmlSchemaIDCStoreKey()
22162 vctxt->sizeIdcKeys *= 2; in xmlSchemaIDCStoreKey()
22163 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *) in xmlSchemaIDCStoreKey()
22164 xmlRealloc(vctxt->idcKeys, vctxt->sizeIdcKeys * in xmlSchemaIDCStoreKey()
22166 if (vctxt->idcKeys == NULL) { in xmlSchemaIDCStoreKey()
22168 "re-allocating the IDC key storage list", NULL); in xmlSchemaIDCStoreKey()
22169 return (-1); in xmlSchemaIDCStoreKey()
22172 vctxt->idcKeys[vctxt->nbIdcKeys++] = key; in xmlSchemaIDCStoreKey()
22180 * @ntItem: the node-table item
22182 * Appends the IDC node-table item to the binding.
22184 * Returns 0 on success and -1 on internal errors.
22190 if (bind->nodeTable == NULL) { in xmlSchemaIDCAppendNodeTableItem()
22191 bind->sizeNodes = 10; in xmlSchemaIDCAppendNodeTableItem()
22192 bind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) in xmlSchemaIDCAppendNodeTableItem()
22194 if (bind->nodeTable == NULL) { in xmlSchemaIDCAppendNodeTableItem()
22196 "allocating an array of IDC node-table items", NULL); in xmlSchemaIDCAppendNodeTableItem()
22197 return(-1); in xmlSchemaIDCAppendNodeTableItem()
22199 } else if (bind->sizeNodes <= bind->nbNodes) { in xmlSchemaIDCAppendNodeTableItem()
22200 bind->sizeNodes *= 2; in xmlSchemaIDCAppendNodeTableItem()
22201 bind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) in xmlSchemaIDCAppendNodeTableItem()
22202 xmlRealloc(bind->nodeTable, bind->sizeNodes * in xmlSchemaIDCAppendNodeTableItem()
22204 if (bind->nodeTable == NULL) { in xmlSchemaIDCAppendNodeTableItem()
22206 "re-allocating an array of IDC node-table items", NULL); in xmlSchemaIDCAppendNodeTableItem()
22207 return(-1); in xmlSchemaIDCAppendNodeTableItem()
22210 bind->nodeTable[bind->nbNodes++] = ntItem; in xmlSchemaIDCAppendNodeTableItem()
22216 * @vctxt: the WXS validation context
22231 ielem = vctxt->elemInfos[matcher->depth]; in xmlSchemaIDCAcquireBinding()
22233 if (ielem->idcTable == NULL) { in xmlSchemaIDCAcquireBinding()
22234 ielem->idcTable = xmlSchemaIDCNewBinding(matcher->aidc->def); in xmlSchemaIDCAcquireBinding()
22235 if (ielem->idcTable == NULL) in xmlSchemaIDCAcquireBinding()
22237 return(ielem->idcTable); in xmlSchemaIDCAcquireBinding()
22241 bind = ielem->idcTable; in xmlSchemaIDCAcquireBinding()
22243 if (bind->definition == matcher->aidc->def) in xmlSchemaIDCAcquireBinding()
22245 if (bind->next == NULL) { in xmlSchemaIDCAcquireBinding()
22246 bind->next = xmlSchemaIDCNewBinding(matcher->aidc->def); in xmlSchemaIDCAcquireBinding()
22247 if (bind->next == NULL) in xmlSchemaIDCAcquireBinding()
22249 return(bind->next); in xmlSchemaIDCAcquireBinding()
22251 bind = bind->next; in xmlSchemaIDCAcquireBinding()
22261 if (matcher->targets == NULL) in xmlSchemaIDCAcquireTargetList()
22262 matcher->targets = xmlSchemaItemListCreate(); in xmlSchemaIDCAcquireTargetList()
22263 return(matcher->targets); in xmlSchemaIDCAcquireTargetList()
22275 if (key->val != NULL) in xmlSchemaIDCFreeKey()
22276 xmlSchemaFreeValue(key->val); in xmlSchemaIDCFreeKey()
22283 * Frees an IDC binding. Note that the node table-items
22289 if (bind->nodeTable != NULL) in xmlSchemaIDCFreeBinding()
22290 xmlFree(bind->nodeTable); in xmlSchemaIDCFreeBinding()
22291 if (bind->dupls != NULL) in xmlSchemaIDCFreeBinding()
22292 xmlSchemaItemListFree(bind->dupls); in xmlSchemaIDCFreeBinding()
22309 bind = bind->next; in xmlSchemaIDCFreeIDCTable()
22326 next = matcher->next; in xmlSchemaIDCFreeMatcherList()
22327 if (matcher->keySeqs != NULL) { in xmlSchemaIDCFreeMatcherList()
22329 for (i = 0; i < matcher->sizeKeySeqs; i++) in xmlSchemaIDCFreeMatcherList()
22330 if (matcher->keySeqs[i] != NULL) in xmlSchemaIDCFreeMatcherList()
22331 xmlFree(matcher->keySeqs[i]); in xmlSchemaIDCFreeMatcherList()
22332 xmlFree(matcher->keySeqs); in xmlSchemaIDCFreeMatcherList()
22334 if (matcher->targets != NULL) { in xmlSchemaIDCFreeMatcherList()
22335 if (matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) { in xmlSchemaIDCFreeMatcherList()
22339 * Node-table items for keyrefs are not stored globally in xmlSchemaIDCFreeMatcherList()
22340 * to the validation context, since they are not bubbled. in xmlSchemaIDCFreeMatcherList()
22343 for (i = 0; i < matcher->targets->nbItems; i++) { in xmlSchemaIDCFreeMatcherList()
22345 (xmlSchemaPSVIIDCNodePtr) matcher->targets->items[i]; in xmlSchemaIDCFreeMatcherList()
22346 xmlFree(idcNode->keys); in xmlSchemaIDCFreeMatcherList()
22350 xmlSchemaItemListFree(matcher->targets); in xmlSchemaIDCFreeMatcherList()
22359 * @vctxt: the WXS validation context
22371 next = matcher->next; in xmlSchemaIDCReleaseMatcherList()
22372 if (matcher->keySeqs != NULL) { in xmlSchemaIDCReleaseMatcherList()
22377 for (i = 0; i < matcher->sizeKeySeqs; i++) in xmlSchemaIDCReleaseMatcherList()
22378 if (matcher->keySeqs[i] != NULL) { in xmlSchemaIDCReleaseMatcherList()
22379 xmlFree(matcher->keySeqs[i]); in xmlSchemaIDCReleaseMatcherList()
22380 matcher->keySeqs[i] = NULL; in xmlSchemaIDCReleaseMatcherList()
22383 if (matcher->targets) { in xmlSchemaIDCReleaseMatcherList()
22384 if (matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) { in xmlSchemaIDCReleaseMatcherList()
22388 * Node-table items for keyrefs are not stored globally in xmlSchemaIDCReleaseMatcherList()
22389 * to the validation context, since they are not bubbled. in xmlSchemaIDCReleaseMatcherList()
22392 for (i = 0; i < matcher->targets->nbItems; i++) { in xmlSchemaIDCReleaseMatcherList()
22394 (xmlSchemaPSVIIDCNodePtr) matcher->targets->items[i]; in xmlSchemaIDCReleaseMatcherList()
22395 xmlFree(idcNode->keys); in xmlSchemaIDCReleaseMatcherList()
22399 xmlSchemaItemListFree(matcher->targets); in xmlSchemaIDCReleaseMatcherList()
22400 matcher->targets = NULL; in xmlSchemaIDCReleaseMatcherList()
22402 matcher->next = NULL; in xmlSchemaIDCReleaseMatcherList()
22406 if (vctxt->idcMatcherCache != NULL) in xmlSchemaIDCReleaseMatcherList()
22407 matcher->nextCached = vctxt->idcMatcherCache; in xmlSchemaIDCReleaseMatcherList()
22408 vctxt->idcMatcherCache = matcher; in xmlSchemaIDCReleaseMatcherList()
22416 * @vctxt: the WXS validation context
22426 * Returns 0 on success and -1 on internal errors.
22439 if (vctxt->xpathStatePool != NULL) { in xmlSchemaIDCAddStateObject()
22440 sto = vctxt->xpathStatePool; in xmlSchemaIDCAddStateObject()
22441 vctxt->xpathStatePool = sto->next; in xmlSchemaIDCAddStateObject()
22442 sto->next = NULL; in xmlSchemaIDCAddStateObject()
22451 return (-1); in xmlSchemaIDCAddStateObject()
22458 if (vctxt->xpathStates != NULL) in xmlSchemaIDCAddStateObject()
22459 sto->next = vctxt->xpathStates; in xmlSchemaIDCAddStateObject()
22460 vctxt->xpathStates = sto; in xmlSchemaIDCAddStateObject()
22463 * Free the old xpath validation context. in xmlSchemaIDCAddStateObject()
22465 if (sto->xpathCtxt != NULL) in xmlSchemaIDCAddStateObject()
22466 xmlFreeStreamCtxt((xmlStreamCtxtPtr) sto->xpathCtxt); in xmlSchemaIDCAddStateObject()
22469 * Create a new XPath (pattern) validation context. in xmlSchemaIDCAddStateObject()
22471 sto->xpathCtxt = (void *) xmlPatternGetStreamCtxt( in xmlSchemaIDCAddStateObject()
22472 (xmlPatternPtr) sel->xpathComp); in xmlSchemaIDCAddStateObject()
22473 if (sto->xpathCtxt == NULL) { in xmlSchemaIDCAddStateObject()
22475 "failed to create an XPath validation context"); in xmlSchemaIDCAddStateObject()
22476 return (-1); in xmlSchemaIDCAddStateObject()
22478 sto->type = type; in xmlSchemaIDCAddStateObject()
22479 sto->depth = vctxt->depth; in xmlSchemaIDCAddStateObject()
22480 sto->matcher = matcher; in xmlSchemaIDCAddStateObject()
22481 sto->sel = sel; in xmlSchemaIDCAddStateObject()
22482 sto->nbHistory = 0; in xmlSchemaIDCAddStateObject()
22486 sto->sel->xpath); in xmlSchemaIDCAddStateObject()
22493 * @vctxt: the WXS validation context
22499 * this node, 0 if none resolved and -1 on internal errors.
22506 int res, resolved = 0, depth = vctxt->depth; in xmlSchemaXPathEvaluate()
22508 if (vctxt->xpathStates == NULL) in xmlSchemaXPathEvaluate()
22518 xmlSchemaFormatQName(&str, vctxt->inode->nsName, in xmlSchemaXPathEvaluate()
22519 vctxt->inode->localName), depth, nodeType); in xmlSchemaXPathEvaluate()
22526 first = vctxt->xpathStates; in xmlSchemaXPathEvaluate()
22530 if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) in xmlSchemaXPathEvaluate()
22532 sto->matcher->aidc->def->name, sto->sel->xpath); in xmlSchemaXPathEvaluate()
22535 sto->matcher->aidc->def->name, sto->sel->xpath); in xmlSchemaXPathEvaluate()
22538 res = xmlStreamPush((xmlStreamCtxtPtr) sto->xpathCtxt, in xmlSchemaXPathEvaluate()
22539 vctxt->inode->localName, vctxt->inode->nsName); in xmlSchemaXPathEvaluate()
22541 res = xmlStreamPushAttr((xmlStreamCtxtPtr) sto->xpathCtxt, in xmlSchemaXPathEvaluate()
22542 vctxt->inode->localName, vctxt->inode->nsName); in xmlSchemaXPathEvaluate()
22544 if (res == -1) { in xmlSchemaXPathEvaluate()
22547 return (-1); in xmlSchemaXPathEvaluate()
22561 if (sto->history == NULL) { in xmlSchemaXPathEvaluate()
22562 sto->history = (int *) xmlMalloc(5 * sizeof(int)); in xmlSchemaXPathEvaluate()
22563 if (sto->history == NULL) { in xmlSchemaXPathEvaluate()
22566 return(-1); in xmlSchemaXPathEvaluate()
22568 sto->sizeHistory = 5; in xmlSchemaXPathEvaluate()
22569 } else if (sto->sizeHistory <= sto->nbHistory) { in xmlSchemaXPathEvaluate()
22570 sto->sizeHistory *= 2; in xmlSchemaXPathEvaluate()
22571 sto->history = (int *) xmlRealloc(sto->history, in xmlSchemaXPathEvaluate()
22572 sto->sizeHistory * sizeof(int)); in xmlSchemaXPathEvaluate()
22573 if (sto->history == NULL) { in xmlSchemaXPathEvaluate()
22575 "re-allocating the state object history", NULL); in xmlSchemaXPathEvaluate()
22576 return(-1); in xmlSchemaXPathEvaluate()
22579 sto->history[sto->nbHistory++] = depth; in xmlSchemaXPathEvaluate()
22583 vctxt->depth); in xmlSchemaXPathEvaluate()
22586 if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) { in xmlSchemaXPathEvaluate()
22596 sel = sto->matcher->aidc->def->fields; in xmlSchemaXPathEvaluate()
22598 if (xmlSchemaIDCAddStateObject(vctxt, sto->matcher, in xmlSchemaXPathEvaluate()
22599 sel, XPATH_STATE_OBJ_TYPE_IDC_FIELD) == -1) in xmlSchemaXPathEvaluate()
22600 return (-1); in xmlSchemaXPathEvaluate()
22601 sel = sel->next; in xmlSchemaXPathEvaluate()
22603 } else if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) { in xmlSchemaXPathEvaluate()
22616 if ((vctxt->inode->flags & in xmlSchemaXPathEvaluate()
22618 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED; in xmlSchemaXPathEvaluate()
22623 if (sto->next == NULL) { in xmlSchemaXPathEvaluate()
22628 sto = vctxt->xpathStates; in xmlSchemaXPathEvaluate()
22630 sto = sto->next; in xmlSchemaXPathEvaluate()
22647 res = xmlSchemaGetCanonValueWhtspExt(seq[i]->val, in xmlSchemaFormatIDCKeySequence()
22648 xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type), in xmlSchemaFormatIDCKeySequence()
22657 if (i < count -1) in xmlSchemaFormatIDCKeySequence()
22673 * @vctxt: the WXS validation context
22677 * Returns 0 on success and -1 on internal errors.
22685 if (vctxt->xpathStates == NULL) in xmlSchemaXPathPop()
22687 sto = vctxt->xpathStates; in xmlSchemaXPathPop()
22689 res = xmlStreamPop((xmlStreamCtxtPtr) sto->xpathCtxt); in xmlSchemaXPathPop()
22690 if (res == -1) in xmlSchemaXPathPop()
22691 return (-1); in xmlSchemaXPathPop()
22692 sto = sto->next; in xmlSchemaXPathPop()
22699 * @vctxt: the WXS validation context
22704 * IDC key-sequences are validated/created on IDC bindings.
22706 * Returns 0 on success and -1 on internal errors.
22715 xmlSchemaTypePtr type = vctxt->inode->typeDef, simpleType = NULL; in xmlSchemaXPathProcessHistory()
22717 if (vctxt->xpathStates == NULL) in xmlSchemaXPathProcessHistory()
22719 sto = vctxt->xpathStates; in xmlSchemaXPathProcessHistory()
22726 xmlSchemaFormatQName(&str, vctxt->inode->nsName, in xmlSchemaXPathProcessHistory()
22727 vctxt->inode->localName), vctxt->depth); in xmlSchemaXPathProcessHistory()
22735 res = xmlStreamPop((xmlStreamCtxtPtr) sto->xpathCtxt); in xmlSchemaXPathProcessHistory()
22736 if (res == -1) { in xmlSchemaXPathProcessHistory()
22739 return (-1); in xmlSchemaXPathProcessHistory()
22743 sto->sel->xpath); in xmlSchemaXPathProcessHistory()
22745 if (sto->nbHistory == 0) in xmlSchemaXPathProcessHistory()
22748 matchDepth = sto->history[sto->nbHistory -1]; in xmlSchemaXPathProcessHistory()
22754 sto = sto->next; in xmlSchemaXPathProcessHistory()
22757 if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) { in xmlSchemaXPathProcessHistory()
22761 * ... the simple-content of complex types is also allowed. in xmlSchemaXPathProcessHistory()
22769 simpleType = type->contentTypeDef; in xmlSchemaXPathProcessHistory()
22774 return (-1); in xmlSchemaXPathProcessHistory()
22789 WXS_BASIC_CAST sto->matcher->aidc->def, in xmlSchemaXPathProcessHistory()
22791 "non-simple type", in xmlSchemaXPathProcessHistory()
22792 sto->sel->xpath, in xmlSchemaXPathProcessHistory()
22793 xmlSchemaGetIDCDesignation(&str, sto->matcher->aidc->def)); in xmlSchemaXPathProcessHistory()
22795 sto->nbHistory--; in xmlSchemaXPathProcessHistory()
22799 if ((key == NULL) && (vctxt->inode->val == NULL)) { in xmlSchemaXPathProcessHistory()
22805 WXS_BASIC_CAST sto->matcher->aidc->def, in xmlSchemaXPathProcessHistory()
22808 sto->nbHistory--; in xmlSchemaXPathProcessHistory()
22811 xmlSchemaIDCMatcherPtr matcher = sto->matcher; in xmlSchemaXPathProcessHistory()
22817 * key-sequences. The position in this list is determined in xmlSchemaXPathProcessHistory()
22821 * Element Depth Pos List-entries in xmlSchemaXPathProcessHistory()
22833 pos = sto->depth - matcher->depth; in xmlSchemaXPathProcessHistory()
22834 idx = sto->sel->index; in xmlSchemaXPathProcessHistory()
22837 * Create/grow the array of key-sequences. in xmlSchemaXPathProcessHistory()
22839 if (matcher->keySeqs == NULL) { in xmlSchemaXPathProcessHistory()
22841 matcher->sizeKeySeqs = pos * 2; in xmlSchemaXPathProcessHistory()
22843 matcher->sizeKeySeqs = 10; in xmlSchemaXPathProcessHistory()
22844 matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) in xmlSchemaXPathProcessHistory()
22845 xmlMalloc(matcher->sizeKeySeqs * in xmlSchemaXPathProcessHistory()
22847 if (matcher->keySeqs == NULL) { in xmlSchemaXPathProcessHistory()
22849 "allocating an array of key-sequences", in xmlSchemaXPathProcessHistory()
22851 return(-1); in xmlSchemaXPathProcessHistory()
22853 memset(matcher->keySeqs, 0, in xmlSchemaXPathProcessHistory()
22854 matcher->sizeKeySeqs * in xmlSchemaXPathProcessHistory()
22856 } else if (pos >= matcher->sizeKeySeqs) { in xmlSchemaXPathProcessHistory()
22857 int i = matcher->sizeKeySeqs; in xmlSchemaXPathProcessHistory()
22859 matcher->sizeKeySeqs *= 2; in xmlSchemaXPathProcessHistory()
22860 matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) in xmlSchemaXPathProcessHistory()
22861 xmlRealloc(matcher->keySeqs, in xmlSchemaXPathProcessHistory()
22862 matcher->sizeKeySeqs * in xmlSchemaXPathProcessHistory()
22864 if (matcher->keySeqs == NULL) { in xmlSchemaXPathProcessHistory()
22866 "reallocating an array of key-sequences", in xmlSchemaXPathProcessHistory()
22868 return (-1); in xmlSchemaXPathProcessHistory()
22874 for (; i < matcher->sizeKeySeqs; i++) in xmlSchemaXPathProcessHistory()
22875 matcher->keySeqs[i] = NULL; in xmlSchemaXPathProcessHistory()
22879 * Get/create the key-sequence. in xmlSchemaXPathProcessHistory()
22881 keySeq = matcher->keySeqs[pos]; in xmlSchemaXPathProcessHistory()
22887 * cvc-identity-constraint: in xmlSchemaXPathProcessHistory()
22890 * node, evaluate to either an empty node-set or in xmlSchemaXPathProcessHistory()
22891 * a node-set with exactly one member, which must in xmlSchemaXPathProcessHistory()
22898 WXS_BASIC_CAST matcher->aidc->def, in xmlSchemaXPathProcessHistory()
22900 "node-set with more than one member", in xmlSchemaXPathProcessHistory()
22901 sto->sel->xpath, in xmlSchemaXPathProcessHistory()
22902 xmlSchemaGetIDCDesignation(&str, matcher->aidc->def)); in xmlSchemaXPathProcessHistory()
22904 sto->nbHistory--; in xmlSchemaXPathProcessHistory()
22911 * Create a key-sequence. in xmlSchemaXPathProcessHistory()
22914 matcher->aidc->def->nbFields * in xmlSchemaXPathProcessHistory()
22918 "allocating an IDC key-sequence", NULL); in xmlSchemaXPathProcessHistory()
22919 return(-1); in xmlSchemaXPathProcessHistory()
22921 memset(keySeq, 0, matcher->aidc->def->nbFields * in xmlSchemaXPathProcessHistory()
22923 matcher->keySeqs[pos] = keySeq; in xmlSchemaXPathProcessHistory()
22935 matcher->keySeqs[pos] = NULL; in xmlSchemaXPathProcessHistory()
22936 return(-1); in xmlSchemaXPathProcessHistory()
22941 key->type = simpleType; in xmlSchemaXPathProcessHistory()
22942 key->val = vctxt->inode->val; in xmlSchemaXPathProcessHistory()
22943 vctxt->inode->val = NULL; in xmlSchemaXPathProcessHistory()
22947 if (xmlSchemaIDCStoreKey(vctxt, key) == -1) { in xmlSchemaXPathProcessHistory()
22949 return (-1); in xmlSchemaXPathProcessHistory()
22954 } else if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) { in xmlSchemaXPathProcessHistory()
22967 * ancestor-or-self axis, the 'field' state object(s) looked in xmlSchemaXPathProcessHistory()
22968 * out for matching nodes to create a key-sequence for this in xmlSchemaXPathProcessHistory()
22970 * to put the key-sequence, together with the target node in xmlSchemaXPathProcessHistory()
22971 * itself, into the node-table of the corresponding IDC in xmlSchemaXPathProcessHistory()
22974 matcher = sto->matcher; in xmlSchemaXPathProcessHistory()
22975 idc = matcher->aidc->def; in xmlSchemaXPathProcessHistory()
22976 nbKeys = idc->nbFields; in xmlSchemaXPathProcessHistory()
22977 pos = depth - matcher->depth; in xmlSchemaXPathProcessHistory()
22979 * Check if the matcher has any key-sequences at all, plus in xmlSchemaXPathProcessHistory()
22980 * if it has a key-sequence for the current target node. in xmlSchemaXPathProcessHistory()
22982 if ((matcher->keySeqs == NULL) || in xmlSchemaXPathProcessHistory()
22983 (matcher->sizeKeySeqs <= pos)) { in xmlSchemaXPathProcessHistory()
22984 if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) in xmlSchemaXPathProcessHistory()
22990 keySeq = &(matcher->keySeqs[pos]); in xmlSchemaXPathProcessHistory()
22992 if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) in xmlSchemaXPathProcessHistory()
23003 if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) { in xmlSchemaXPathProcessHistory()
23017 * 4.1 If the {identity-constraint category} is unique(/key), in xmlSchemaXPathProcessHistory()
23019 * `key-sequences` whose members are pairwise equal, as in xmlSchemaXPathProcessHistory()
23023 * duplicate key-sequences. in xmlSchemaXPathProcessHistory()
23029 if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) && in xmlSchemaXPathProcessHistory()
23030 (targets->nbItems != 0)) { in xmlSchemaXPathProcessHistory()
23036 * Compare the key-sequences, key by key. in xmlSchemaXPathProcessHistory()
23040 ((xmlSchemaPSVIIDCNodePtr) targets->items[i])->keys; in xmlSchemaXPathProcessHistory()
23044 res = xmlSchemaAreValuesEqual(ckey->val, bkey->val); in xmlSchemaXPathProcessHistory()
23045 if (res == -1) { in xmlSchemaXPathProcessHistory()
23046 return (-1); in xmlSchemaXPathProcessHistory()
23049 * One of the keys differs, so the key-sequence in xmlSchemaXPathProcessHistory()
23057 * Duplicate key-sequence found. in xmlSchemaXPathProcessHistory()
23062 } while (i < targets->nbItems); in xmlSchemaXPathProcessHistory()
23063 if (i != targets->nbItems) { in xmlSchemaXPathProcessHistory()
23066 * TODO: Try to report the key-sequence. in xmlSchemaXPathProcessHistory()
23071 "Duplicate key-sequence %s in %s", in xmlSchemaXPathProcessHistory()
23081 * Add a node-table item to the IDC binding. in xmlSchemaXPathProcessHistory()
23087 "allocating an IDC node-table item", NULL); in xmlSchemaXPathProcessHistory()
23090 return(-1); in xmlSchemaXPathProcessHistory()
23095 * Store the node-table item in a global list. in xmlSchemaXPathProcessHistory()
23097 if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) { in xmlSchemaXPathProcessHistory()
23098 if (xmlSchemaIDCStoreNodeTableItem(vctxt, ntItem) == -1) { in xmlSchemaXPathProcessHistory()
23102 return (-1); in xmlSchemaXPathProcessHistory()
23104 ntItem->nodeQNameID = -1; in xmlSchemaXPathProcessHistory()
23110 ntItem->nodeQNameID = xmlSchemaVAddNodeQName(vctxt, in xmlSchemaXPathProcessHistory()
23111 vctxt->inode->localName, vctxt->inode->nsName); in xmlSchemaXPathProcessHistory()
23112 if (ntItem->nodeQNameID == -1) { in xmlSchemaXPathProcessHistory()
23116 return (-1); in xmlSchemaXPathProcessHistory()
23120 * Init the node-table item: Save the node, position and in xmlSchemaXPathProcessHistory()
23121 * consume the key-sequence. in xmlSchemaXPathProcessHistory()
23123 ntItem->node = vctxt->node; in xmlSchemaXPathProcessHistory()
23124 ntItem->nodeLine = vctxt->inode->nodeLine; in xmlSchemaXPathProcessHistory()
23125 ntItem->keys = *keySeq; in xmlSchemaXPathProcessHistory()
23128 if (xmlSchemaIDCAppendNodeTableItem(bind, ntItem) == -1) in xmlSchemaXPathProcessHistory()
23130 if (xmlSchemaItemListAdd(targets, ntItem) == -1) { in xmlSchemaXPathProcessHistory()
23131 if (idc->type == XML_SCHEMA_TYPE_IDC_KEYREF) { in xmlSchemaXPathProcessHistory()
23136 xmlFree(ntItem->keys); in xmlSchemaXPathProcessHistory()
23139 return (-1); in xmlSchemaXPathProcessHistory()
23161 * Free the key-sequence if not added to the IDC table. in xmlSchemaXPathProcessHistory()
23169 sto->nbHistory--; in xmlSchemaXPathProcessHistory()
23175 if ((sto->nbHistory == 0) && (sto->depth == depth)) { in xmlSchemaXPathProcessHistory()
23178 sto->sel->xpath); in xmlSchemaXPathProcessHistory()
23180 if (vctxt->xpathStates != sto) { in xmlSchemaXPathProcessHistory()
23185 nextsto = sto->next; in xmlSchemaXPathProcessHistory()
23189 vctxt->xpathStates = sto->next; in xmlSchemaXPathProcessHistory()
23190 sto->next = vctxt->xpathStatePool; in xmlSchemaXPathProcessHistory()
23194 vctxt->xpathStatePool = sto; in xmlSchemaXPathProcessHistory()
23197 sto = sto->next; in xmlSchemaXPathProcessHistory()
23204 * @vctxt: the WXS validation context
23210 * Returns 0 if OK and -1 on internal errors.
23220 idc = (xmlSchemaIDCPtr) elemDecl->idcs; in xmlSchemaIDCRegisterMatchers()
23229 (char *) xmlSchemaFormatQName(&str, vctxt->inode->nsName, in xmlSchemaIDCRegisterMatchers()
23230 vctxt->inode->localName), vctxt->depth); in xmlSchemaIDCRegisterMatchers()
23234 if (vctxt->inode->idcMatchers != NULL) { in xmlSchemaIDCRegisterMatchers()
23237 return (-1); in xmlSchemaIDCRegisterMatchers()
23240 if (idc->type == XML_SCHEMA_TYPE_IDC_KEYREF) { in xmlSchemaIDCRegisterMatchers()
23244 * the depth of the top-most keyref IDC. If no keyref in xmlSchemaIDCRegisterMatchers()
23246 * be -1, indicating that no bubbles are needed. in xmlSchemaIDCRegisterMatchers()
23248 refIdc = (xmlSchemaIDCPtr) idc->ref->item; in xmlSchemaIDCRegisterMatchers()
23253 vctxt->inode->hasKeyrefs = 1; in xmlSchemaIDCRegisterMatchers()
23257 aidc = vctxt->aidcs; in xmlSchemaIDCRegisterMatchers()
23259 if (aidc->def == refIdc) in xmlSchemaIDCRegisterMatchers()
23261 aidc = aidc->next; in xmlSchemaIDCRegisterMatchers()
23267 return (-1); in xmlSchemaIDCRegisterMatchers()
23269 if ((aidc->keyrefDepth == -1) || in xmlSchemaIDCRegisterMatchers()
23270 (vctxt->depth < aidc->keyrefDepth)) in xmlSchemaIDCRegisterMatchers()
23271 aidc->keyrefDepth = vctxt->depth; in xmlSchemaIDCRegisterMatchers()
23277 aidc = vctxt->aidcs; in xmlSchemaIDCRegisterMatchers()
23279 if (aidc->def == idc) in xmlSchemaIDCRegisterMatchers()
23281 aidc = aidc->next; in xmlSchemaIDCRegisterMatchers()
23286 return (-1); in xmlSchemaIDCRegisterMatchers()
23291 if (vctxt->idcMatcherCache != NULL) { in xmlSchemaIDCRegisterMatchers()
23295 matcher = vctxt->idcMatcherCache; in xmlSchemaIDCRegisterMatchers()
23296 vctxt->idcMatcherCache = matcher->nextCached; in xmlSchemaIDCRegisterMatchers()
23297 matcher->nextCached = NULL; in xmlSchemaIDCRegisterMatchers()
23304 return (-1); in xmlSchemaIDCRegisterMatchers()
23309 vctxt->inode->idcMatchers = matcher; in xmlSchemaIDCRegisterMatchers()
23311 last->next = matcher; in xmlSchemaIDCRegisterMatchers()
23314 matcher->type = IDC_MATCHER; in xmlSchemaIDCRegisterMatchers()
23315 matcher->depth = vctxt->depth; in xmlSchemaIDCRegisterMatchers()
23316 matcher->aidc = aidc; in xmlSchemaIDCRegisterMatchers()
23317 matcher->idcType = aidc->def->type; in xmlSchemaIDCRegisterMatchers()
23325 idc->selector, XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) == -1) in xmlSchemaIDCRegisterMatchers()
23326 return (-1); in xmlSchemaIDCRegisterMatchers()
23328 idc = idc->next; in xmlSchemaIDCRegisterMatchers()
23342 xmlSchemaIDCMatcherPtr matcher = ielem->idcMatchers; in xmlSchemaIDCFillNodeTables()
23343 /* vctxt->createIDCNodeTables */ in xmlSchemaIDCFillNodeTables()
23346 * Skip keyref IDCs and empty IDC target-lists. in xmlSchemaIDCFillNodeTables()
23348 if ((matcher->aidc->def->type == XML_SCHEMA_TYPE_IDC_KEYREF) || in xmlSchemaIDCFillNodeTables()
23349 WXS_ILIST_IS_EMPTY(matcher->targets)) in xmlSchemaIDCFillNodeTables()
23351 matcher = matcher->next; in xmlSchemaIDCFillNodeTables()
23355 * If we _want_ the IDC node-table to be created in any case in xmlSchemaIDCFillNodeTables()
23358 if ((! vctxt->createIDCNodeTables) && in xmlSchemaIDCFillNodeTables()
23359 ((matcher->aidc->keyrefDepth == -1) || in xmlSchemaIDCFillNodeTables()
23360 (matcher->aidc->keyrefDepth > vctxt->depth))) in xmlSchemaIDCFillNodeTables()
23362 matcher = matcher->next; in xmlSchemaIDCFillNodeTables()
23370 if (! WXS_ILIST_IS_EMPTY(bind->dupls)) { in xmlSchemaIDCFillNodeTables()
23371 dupls = (xmlSchemaPSVIIDCNodePtr *) bind->dupls->items; in xmlSchemaIDCFillNodeTables()
23372 nbDupls = bind->dupls->nbItems; in xmlSchemaIDCFillNodeTables()
23377 if (bind->nodeTable != NULL) { in xmlSchemaIDCFillNodeTables()
23378 nbNodeTable = bind->nbNodes; in xmlSchemaIDCFillNodeTables()
23385 * Transfer all IDC target-nodes to the IDC node-table. in xmlSchemaIDCFillNodeTables()
23387 bind->nodeTable = in xmlSchemaIDCFillNodeTables()
23388 (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; in xmlSchemaIDCFillNodeTables()
23389 bind->sizeNodes = matcher->targets->sizeItems; in xmlSchemaIDCFillNodeTables()
23390 bind->nbNodes = matcher->targets->nbItems; in xmlSchemaIDCFillNodeTables()
23392 matcher->targets->items = NULL; in xmlSchemaIDCFillNodeTables()
23393 matcher->targets->sizeItems = 0; in xmlSchemaIDCFillNodeTables()
23394 matcher->targets->nbItems = 0; in xmlSchemaIDCFillNodeTables()
23397 * Compare the key-sequences and add to the IDC node-table. in xmlSchemaIDCFillNodeTables()
23399 nbTargets = matcher->targets->nbItems; in xmlSchemaIDCFillNodeTables()
23400 targets = (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; in xmlSchemaIDCFillNodeTables()
23401 nbFields = matcher->aidc->def->nbFields; in xmlSchemaIDCFillNodeTables()
23404 keys = targets[i]->keys; in xmlSchemaIDCFillNodeTables()
23412 res = xmlSchemaAreValuesEqual(keys[0]->val, in xmlSchemaIDCFillNodeTables()
23413 dupls[j]->keys[0]->val); in xmlSchemaIDCFillNodeTables()
23414 if (res == -1) in xmlSchemaIDCFillNodeTables()
23418 * Equal key-sequence. in xmlSchemaIDCFillNodeTables()
23424 ntkeys = dupls[j]->keys; in xmlSchemaIDCFillNodeTables()
23426 res = xmlSchemaAreValuesEqual(keys[k]->val, in xmlSchemaIDCFillNodeTables()
23427 ntkeys[k]->val); in xmlSchemaIDCFillNodeTables()
23428 if (res == -1) in xmlSchemaIDCFillNodeTables()
23439 * Equal key-sequence found. in xmlSchemaIDCFillNodeTables()
23451 res = xmlSchemaAreValuesEqual(keys[0]->val, in xmlSchemaIDCFillNodeTables()
23452 bind->nodeTable[j]->keys[0]->val); in xmlSchemaIDCFillNodeTables()
23453 if (res == -1) in xmlSchemaIDCFillNodeTables()
23457 * The key-sequence differs. in xmlSchemaIDCFillNodeTables()
23463 ntkeys = bind->nodeTable[j]->keys; in xmlSchemaIDCFillNodeTables()
23465 res = xmlSchemaAreValuesEqual(keys[k]->val, in xmlSchemaIDCFillNodeTables()
23466 ntkeys[k]->val); in xmlSchemaIDCFillNodeTables()
23467 if (res == -1) in xmlSchemaIDCFillNodeTables()
23480 if (bind->dupls == NULL) { in xmlSchemaIDCFillNodeTables()
23481 bind->dupls = xmlSchemaItemListCreate(); in xmlSchemaIDCFillNodeTables()
23482 if (bind->dupls == NULL) in xmlSchemaIDCFillNodeTables()
23485 if (xmlSchemaItemListAdd(bind->dupls, bind->nodeTable[j]) == -1) in xmlSchemaIDCFillNodeTables()
23488 * Remove the duplicate entry from the IDC node-table. in xmlSchemaIDCFillNodeTables()
23490 bind->nodeTable[j] = bind->nodeTable[bind->nbNodes -1]; in xmlSchemaIDCFillNodeTables()
23491 bind->nbNodes--; in xmlSchemaIDCFillNodeTables()
23500 * If everything is fine, then add the IDC target-node to in xmlSchemaIDCFillNodeTables()
23501 * the IDC node-table. in xmlSchemaIDCFillNodeTables()
23503 if (xmlSchemaIDCAppendNodeTableItem(bind, targets[i]) == -1) in xmlSchemaIDCFillNodeTables()
23510 matcher = matcher->next; in xmlSchemaIDCFillNodeTables()
23515 return(-1); in xmlSchemaIDCFillNodeTables()
23523 * bindings of its parent element. If a duplicate note-table entry is found,
23524 * both, the parent node-table entry and child entry are discarded from the
23525 * node-table of the parent.
23527 * Returns 0 if OK and -1 on internal errors.
23534 xmlSchemaPSVIIDCNodePtr node, parNode = NULL, *dupls, *parNodes; /* node-table entries. */ in xmlSchemaBubbleIDCNodeTables()
23538 bind = vctxt->inode->idcTable; in xmlSchemaBubbleIDCNodeTables()
23544 parTable = &(vctxt->elemInfos[vctxt->depth -1]->idcTable); in xmlSchemaBubbleIDCNodeTables()
23547 * Remove duplicate key-sequences. in xmlSchemaBubbleIDCNodeTables()
23551 if ((bind->nbNodes == 0) && WXS_ILIST_IS_EMPTY(bind->dupls)) in xmlSchemaBubbleIDCNodeTables()
23556 if (! vctxt->createIDCNodeTables) { in xmlSchemaBubbleIDCNodeTables()
23557 aidc = vctxt->aidcs; in xmlSchemaBubbleIDCNodeTables()
23559 if (aidc->def == bind->definition) { in xmlSchemaBubbleIDCNodeTables()
23560 if ((aidc->keyrefDepth == -1) || in xmlSchemaBubbleIDCNodeTables()
23561 (aidc->keyrefDepth >= vctxt->depth)) { in xmlSchemaBubbleIDCNodeTables()
23566 aidc = aidc->next; in xmlSchemaBubbleIDCNodeTables()
23577 if (parBind->definition == bind->definition) in xmlSchemaBubbleIDCNodeTables()
23579 parBind = parBind->next; in xmlSchemaBubbleIDCNodeTables()
23584 * Compare every node-table entry of the child node, in xmlSchemaBubbleIDCNodeTables()
23585 * i.e. the key-sequence within, ... in xmlSchemaBubbleIDCNodeTables()
23587 oldNum = parBind->nbNodes; /* Skip newly added items. */ in xmlSchemaBubbleIDCNodeTables()
23589 if (! WXS_ILIST_IS_EMPTY(parBind->dupls)) { in xmlSchemaBubbleIDCNodeTables()
23590 oldDupls = parBind->dupls->nbItems; in xmlSchemaBubbleIDCNodeTables()
23591 dupls = (xmlSchemaPSVIIDCNodePtr *) parBind->dupls->items; in xmlSchemaBubbleIDCNodeTables()
23597 parNodes = parBind->nodeTable; in xmlSchemaBubbleIDCNodeTables()
23598 nbFields = bind->definition->nbFields; in xmlSchemaBubbleIDCNodeTables()
23600 for (i = 0; i < bind->nbNodes; i++) { in xmlSchemaBubbleIDCNodeTables()
23601 node = bind->nodeTable[i]; in xmlSchemaBubbleIDCNodeTables()
23605 * ...with every key-sequence of the parent node, already in xmlSchemaBubbleIDCNodeTables()
23606 * evaluated to be a duplicate key-sequence. in xmlSchemaBubbleIDCNodeTables()
23613 node->keys[0]->val, in xmlSchemaBubbleIDCNodeTables()
23614 dupls[j]->keys[0]->val); in xmlSchemaBubbleIDCNodeTables()
23615 if (ret == -1) in xmlSchemaBubbleIDCNodeTables()
23625 node->keys[k]->val, in xmlSchemaBubbleIDCNodeTables()
23626 parNode->keys[k]->val); in xmlSchemaBubbleIDCNodeTables()
23627 if (ret == -1) in xmlSchemaBubbleIDCNodeTables()
23644 * ... and with every key-sequence of the parent node. in xmlSchemaBubbleIDCNodeTables()
23652 node->keys[0]->val, in xmlSchemaBubbleIDCNodeTables()
23653 parNode->keys[0]->val); in xmlSchemaBubbleIDCNodeTables()
23654 if (ret == -1) in xmlSchemaBubbleIDCNodeTables()
23663 node->keys[k]->val, in xmlSchemaBubbleIDCNodeTables()
23664 parNode->keys[k]->val); in xmlSchemaBubbleIDCNodeTables()
23665 if (ret == -1) in xmlSchemaBubbleIDCNodeTables()
23679 * the parent's node-table to the list of in xmlSchemaBubbleIDCNodeTables()
23682 oldNum--; in xmlSchemaBubbleIDCNodeTables()
23683 parBind->nbNodes--; in xmlSchemaBubbleIDCNodeTables()
23689 if (parBind->nbNodes != oldNum) { in xmlSchemaBubbleIDCNodeTables()
23695 parNodes[parBind->nbNodes]; in xmlSchemaBubbleIDCNodeTables()
23697 if (parBind->dupls == NULL) { in xmlSchemaBubbleIDCNodeTables()
23698 parBind->dupls = xmlSchemaItemListCreate(); in xmlSchemaBubbleIDCNodeTables()
23699 if (parBind->dupls == NULL) in xmlSchemaBubbleIDCNodeTables()
23702 xmlSchemaItemListAdd(parBind->dupls, parNode); in xmlSchemaBubbleIDCNodeTables()
23705 * Add the node-table entry (node and key-sequence) of in xmlSchemaBubbleIDCNodeTables()
23708 if (parBind->nodeTable == NULL) { in xmlSchemaBubbleIDCNodeTables()
23709 parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) in xmlSchemaBubbleIDCNodeTables()
23711 if (parBind->nodeTable == NULL) { in xmlSchemaBubbleIDCNodeTables()
23713 "allocating IDC list of node-table items", NULL); in xmlSchemaBubbleIDCNodeTables()
23716 parBind->sizeNodes = 1; in xmlSchemaBubbleIDCNodeTables()
23717 } else if (parBind->nbNodes >= parBind->sizeNodes) { in xmlSchemaBubbleIDCNodeTables()
23718 parBind->sizeNodes *= 2; in xmlSchemaBubbleIDCNodeTables()
23719 parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) in xmlSchemaBubbleIDCNodeTables()
23720 xmlRealloc(parBind->nodeTable, parBind->sizeNodes * in xmlSchemaBubbleIDCNodeTables()
23722 if (parBind->nodeTable == NULL) { in xmlSchemaBubbleIDCNodeTables()
23724 "re-allocating IDC list of node-table items", NULL); in xmlSchemaBubbleIDCNodeTables()
23728 parNodes = parBind->nodeTable; in xmlSchemaBubbleIDCNodeTables()
23730 * Append the new node-table entry to the 'new node-table in xmlSchemaBubbleIDCNodeTables()
23733 parNodes[parBind->nbNodes++] = node; in xmlSchemaBubbleIDCNodeTables()
23742 * copy all node-tables. in xmlSchemaBubbleIDCNodeTables()
23744 parBind = xmlSchemaIDCNewBinding(bind->definition); in xmlSchemaBubbleIDCNodeTables()
23752 if (bind->nbNodes != 0) { in xmlSchemaBubbleIDCNodeTables()
23754 * Add all IDC node-table entries. in xmlSchemaBubbleIDCNodeTables()
23756 if (! vctxt->psviExposeIDCNodeTables) { in xmlSchemaBubbleIDCNodeTables()
23763 parBind->nodeTable = bind->nodeTable; in xmlSchemaBubbleIDCNodeTables()
23764 bind->nodeTable = NULL; in xmlSchemaBubbleIDCNodeTables()
23765 parBind->sizeNodes = bind->sizeNodes; in xmlSchemaBubbleIDCNodeTables()
23766 bind->sizeNodes = 0; in xmlSchemaBubbleIDCNodeTables()
23767 parBind->nbNodes = bind->nbNodes; in xmlSchemaBubbleIDCNodeTables()
23768 bind->nbNodes = 0; in xmlSchemaBubbleIDCNodeTables()
23773 parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) in xmlSchemaBubbleIDCNodeTables()
23774 xmlMalloc(bind->nbNodes * in xmlSchemaBubbleIDCNodeTables()
23776 if (parBind->nodeTable == NULL) { in xmlSchemaBubbleIDCNodeTables()
23778 "allocating an array of IDC node-table " in xmlSchemaBubbleIDCNodeTables()
23783 parBind->sizeNodes = bind->nbNodes; in xmlSchemaBubbleIDCNodeTables()
23784 parBind->nbNodes = bind->nbNodes; in xmlSchemaBubbleIDCNodeTables()
23785 memcpy(parBind->nodeTable, bind->nodeTable, in xmlSchemaBubbleIDCNodeTables()
23786 bind->nbNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); in xmlSchemaBubbleIDCNodeTables()
23789 if (bind->dupls) { in xmlSchemaBubbleIDCNodeTables()
23793 if (parBind->dupls != NULL) in xmlSchemaBubbleIDCNodeTables()
23794 xmlSchemaItemListFree(parBind->dupls); in xmlSchemaBubbleIDCNodeTables()
23795 parBind->dupls = bind->dupls; in xmlSchemaBubbleIDCNodeTables()
23796 bind->dupls = NULL; in xmlSchemaBubbleIDCNodeTables()
23802 parBind->next = *parTable; in xmlSchemaBubbleIDCNodeTables()
23809 bind = bind->next; in xmlSchemaBubbleIDCNodeTables()
23814 return(-1); in xmlSchemaBubbleIDCNodeTables()
23819 * @vctxt: the WXS validation context
23822 * Check the cvc-idc-keyref constraints.
23830 matcher = vctxt->inode->idcMatchers; in xmlSchemaCheckCVCIDCKeyRef()
23835 if ((matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) && in xmlSchemaCheckCVCIDCKeyRef()
23836 matcher->targets && in xmlSchemaCheckCVCIDCKeyRef()
23837 matcher->targets->nbItems) in xmlSchemaCheckCVCIDCKeyRef()
23843 nbFields = matcher->aidc->def->nbFields; in xmlSchemaCheckCVCIDCKeyRef()
23846 * Find the IDC node-table for the referenced IDC key/unique. in xmlSchemaCheckCVCIDCKeyRef()
23848 bind = vctxt->inode->idcTable; in xmlSchemaCheckCVCIDCKeyRef()
23850 if ((xmlSchemaIDCPtr) matcher->aidc->def->ref->item == in xmlSchemaCheckCVCIDCKeyRef()
23851 bind->definition) in xmlSchemaCheckCVCIDCKeyRef()
23853 bind = bind->next; in xmlSchemaCheckCVCIDCKeyRef()
23855 hasDupls = (bind && bind->dupls && bind->dupls->nbItems) ? 1 : 0; in xmlSchemaCheckCVCIDCKeyRef()
23857 * Search for a matching key-sequences. in xmlSchemaCheckCVCIDCKeyRef()
23859 for (i = 0; i < matcher->targets->nbItems; i++) { in xmlSchemaCheckCVCIDCKeyRef()
23861 refNode = matcher->targets->items[i]; in xmlSchemaCheckCVCIDCKeyRef()
23863 refKeys = refNode->keys; in xmlSchemaCheckCVCIDCKeyRef()
23864 for (j = 0; j < bind->nbNodes; j++) { in xmlSchemaCheckCVCIDCKeyRef()
23865 keys = bind->nodeTable[j]->keys; in xmlSchemaCheckCVCIDCKeyRef()
23867 res = xmlSchemaAreValuesEqual(keys[k]->val, in xmlSchemaCheckCVCIDCKeyRef()
23868 refKeys[k]->val); in xmlSchemaCheckCVCIDCKeyRef()
23871 else if (res == -1) { in xmlSchemaCheckCVCIDCKeyRef()
23872 return (-1); in xmlSchemaCheckCVCIDCKeyRef()
23886 for (j = 0; j < bind->dupls->nbItems; j++) { in xmlSchemaCheckCVCIDCKeyRef()
23888 bind->dupls->items[j])->keys; in xmlSchemaCheckCVCIDCKeyRef()
23890 res = xmlSchemaAreValuesEqual(keys[k]->val, in xmlSchemaCheckCVCIDCKeyRef()
23891 refKeys[k]->val); in xmlSchemaCheckCVCIDCKeyRef()
23894 else if (res == -1) { in xmlSchemaCheckCVCIDCKeyRef()
23895 return (-1); in xmlSchemaCheckCVCIDCKeyRef()
23905 (xmlSchemaTypePtr) matcher->aidc->def, in xmlSchemaCheckCVCIDCKeyRef()
23907 "key-sequence %s of keyref '%s'", in xmlSchemaCheckCVCIDCKeyRef()
23909 refNode->keys, nbFields), in xmlSchemaCheckCVCIDCKeyRef()
23911 matcher->aidc->def)); in xmlSchemaCheckCVCIDCKeyRef()
23924 (xmlSchemaTypePtr) matcher->aidc->def, in xmlSchemaCheckCVCIDCKeyRef()
23925 "No match found for key-sequence %s of keyref '%s'", in xmlSchemaCheckCVCIDCKeyRef()
23927 refNode->keys, nbFields), in xmlSchemaCheckCVCIDCKeyRef()
23928 xmlSchemaGetComponentQName(&strB, matcher->aidc->def)); in xmlSchemaCheckCVCIDCKeyRef()
23934 matcher = matcher->next; in xmlSchemaCheckCVCIDCKeyRef()
23942 * XML Reader validation code *
23953 if (vctxt->attrInfos == NULL) { in xmlSchemaGetFreshAttrInfo()
23954 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *) in xmlSchemaGetFreshAttrInfo()
23956 vctxt->sizeAttrInfos = 1; in xmlSchemaGetFreshAttrInfo()
23957 if (vctxt->attrInfos == NULL) { in xmlSchemaGetFreshAttrInfo()
23962 } else if (vctxt->sizeAttrInfos <= vctxt->nbAttrInfos) { in xmlSchemaGetFreshAttrInfo()
23963 vctxt->sizeAttrInfos++; in xmlSchemaGetFreshAttrInfo()
23964 vctxt->attrInfos = (xmlSchemaAttrInfoPtr *) in xmlSchemaGetFreshAttrInfo()
23965 xmlRealloc(vctxt->attrInfos, in xmlSchemaGetFreshAttrInfo()
23966 vctxt->sizeAttrInfos * sizeof(xmlSchemaAttrInfoPtr)); in xmlSchemaGetFreshAttrInfo()
23967 if (vctxt->attrInfos == NULL) { in xmlSchemaGetFreshAttrInfo()
23969 "re-allocating attribute info list", NULL); in xmlSchemaGetFreshAttrInfo()
23973 iattr = vctxt->attrInfos[vctxt->nbAttrInfos++]; in xmlSchemaGetFreshAttrInfo()
23974 if (iattr->localName != NULL) { in xmlSchemaGetFreshAttrInfo()
23979 iattr->nodeType = XML_ATTRIBUTE_NODE; in xmlSchemaGetFreshAttrInfo()
23992 iattr->nodeType = XML_ATTRIBUTE_NODE; in xmlSchemaGetFreshAttrInfo()
23993 vctxt->attrInfos[vctxt->nbAttrInfos++] = iattr; in xmlSchemaGetFreshAttrInfo()
24014 return (-1); in xmlSchemaValidatorPushAttribute()
24016 attr->node = attrNode; in xmlSchemaValidatorPushAttribute()
24017 attr->nodeLine = nodeLine; in xmlSchemaValidatorPushAttribute()
24018 attr->state = XML_SCHEMAS_ATTR_UNKNOWN; in xmlSchemaValidatorPushAttribute()
24019 attr->localName = localName; in xmlSchemaValidatorPushAttribute()
24020 attr->nsName = nsName; in xmlSchemaValidatorPushAttribute()
24022 attr->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES; in xmlSchemaValidatorPushAttribute()
24028 if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { in xmlSchemaValidatorPushAttribute()
24029 attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_NIL; in xmlSchemaValidatorPushAttribute()
24032 if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { in xmlSchemaValidatorPushAttribute()
24033 attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_TYPE; in xmlSchemaValidatorPushAttribute()
24036 if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { in xmlSchemaValidatorPushAttribute()
24037 attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_SCHEMA_LOC; in xmlSchemaValidatorPushAttribute()
24040 if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { in xmlSchemaValidatorPushAttribute()
24041 attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_NO_NS_SCHEMA_LOC; in xmlSchemaValidatorPushAttribute()
24043 } else if (xmlStrEqual(attr->nsName, xmlNamespaceNs)) { in xmlSchemaValidatorPushAttribute()
24044 attr->metaType = XML_SCHEMA_ATTR_INFO_META_XMLNS; in xmlSchemaValidatorPushAttribute()
24047 attr->value = value; in xmlSchemaValidatorPushAttribute()
24049 attr->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES; in xmlSchemaValidatorPushAttribute()
24050 if (attr->metaType != 0) in xmlSchemaValidatorPushAttribute()
24051 attr->state = XML_SCHEMAS_ATTR_META; in xmlSchemaValidatorPushAttribute()
24057 * @vctxt: the WXS validation context
24064 ielem->hasKeyrefs = 0; in xmlSchemaClearElemInfo()
24065 ielem->appliedXPath = 0; in xmlSchemaClearElemInfo()
24066 if (ielem->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES) { in xmlSchemaClearElemInfo()
24067 FREE_AND_NULL(ielem->localName); in xmlSchemaClearElemInfo()
24068 FREE_AND_NULL(ielem->nsName); in xmlSchemaClearElemInfo()
24070 ielem->localName = NULL; in xmlSchemaClearElemInfo()
24071 ielem->nsName = NULL; in xmlSchemaClearElemInfo()
24073 if (ielem->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) { in xmlSchemaClearElemInfo()
24074 FREE_AND_NULL(ielem->value); in xmlSchemaClearElemInfo()
24076 ielem->value = NULL; in xmlSchemaClearElemInfo()
24078 if (ielem->val != NULL) { in xmlSchemaClearElemInfo()
24083 xmlSchemaFreeValue(ielem->val); in xmlSchemaClearElemInfo()
24084 ielem->val = NULL; in xmlSchemaClearElemInfo()
24086 if (ielem->idcMatchers != NULL) { in xmlSchemaClearElemInfo()
24091 xmlSchemaIDCReleaseMatcherList(vctxt, ielem->idcMatchers); in xmlSchemaClearElemInfo()
24093 xmlSchemaIDCFreeMatcherList(ielem->idcMatchers); in xmlSchemaClearElemInfo()
24095 ielem->idcMatchers = NULL; in xmlSchemaClearElemInfo()
24097 if (ielem->idcTable != NULL) { in xmlSchemaClearElemInfo()
24101 xmlSchemaIDCFreeIDCTable(ielem->idcTable); in xmlSchemaClearElemInfo()
24102 ielem->idcTable = NULL; in xmlSchemaClearElemInfo()
24104 if (ielem->regexCtxt != NULL) { in xmlSchemaClearElemInfo()
24105 xmlRegFreeExecCtxt(ielem->regexCtxt); in xmlSchemaClearElemInfo()
24106 ielem->regexCtxt = NULL; in xmlSchemaClearElemInfo()
24108 if (ielem->nsBindings != NULL) { in xmlSchemaClearElemInfo()
24109 xmlFree((xmlChar **)ielem->nsBindings); in xmlSchemaClearElemInfo()
24110 ielem->nsBindings = NULL; in xmlSchemaClearElemInfo()
24111 ielem->nbNsBindings = 0; in xmlSchemaClearElemInfo()
24112 ielem->sizeNsBindings = 0; in xmlSchemaClearElemInfo()
24118 * @vctxt: the schema validation context
24130 if (vctxt->depth > vctxt->sizeElemInfos) { in xmlSchemaGetFreshElemInfo()
24135 if (vctxt->elemInfos == NULL) { in xmlSchemaGetFreshElemInfo()
24136 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *) in xmlSchemaGetFreshElemInfo()
24138 if (vctxt->elemInfos == NULL) { in xmlSchemaGetFreshElemInfo()
24143 memset(vctxt->elemInfos, 0, 10 * sizeof(xmlSchemaNodeInfoPtr)); in xmlSchemaGetFreshElemInfo()
24144 vctxt->sizeElemInfos = 10; in xmlSchemaGetFreshElemInfo()
24145 } else if (vctxt->sizeElemInfos <= vctxt->depth) { in xmlSchemaGetFreshElemInfo()
24146 int i = vctxt->sizeElemInfos; in xmlSchemaGetFreshElemInfo()
24148 vctxt->sizeElemInfos *= 2; in xmlSchemaGetFreshElemInfo()
24149 vctxt->elemInfos = (xmlSchemaNodeInfoPtr *) in xmlSchemaGetFreshElemInfo()
24150 xmlRealloc(vctxt->elemInfos, vctxt->sizeElemInfos * in xmlSchemaGetFreshElemInfo()
24152 if (vctxt->elemInfos == NULL) { in xmlSchemaGetFreshElemInfo()
24154 "re-allocating the element info array", NULL); in xmlSchemaGetFreshElemInfo()
24161 for (; i < vctxt->sizeElemInfos; i++) in xmlSchemaGetFreshElemInfo()
24162 vctxt->elemInfos[i] = NULL; in xmlSchemaGetFreshElemInfo()
24164 info = vctxt->elemInfos[vctxt->depth]; in xmlSchemaGetFreshElemInfo()
24174 vctxt->elemInfos[vctxt->depth] = info; in xmlSchemaGetFreshElemInfo()
24176 if (info->localName != NULL) { in xmlSchemaGetFreshElemInfo()
24183 info->nodeType = XML_ELEMENT_NODE; in xmlSchemaGetFreshElemInfo()
24184 info->depth = vctxt->depth; in xmlSchemaGetFreshElemInfo()
24189 #define ACTIVATE_ATTRIBUTE(item) vctxt->inode = (xmlSchemaNodeInfoPtr) item;
24190 #define ACTIVATE_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth];
24191 #define ACTIVATE_PARENT_ELEM vctxt->inode = vctxt->elemInfos[vctxt->depth -1];
24212 * In Libxml2, derived built-in types have currently no explicit facets. in xmlSchemaValidateFacets()
24214 if (type->type == XML_SCHEMA_TYPE_BASIC) in xmlSchemaValidateFacets()
24222 if (type->facetSet == NULL) in xmlSchemaValidateFacets()
24233 * Whitespace handling is only of importance for string-based in xmlSchemaValidateFacets()
24237 if ((tmpType->builtInType == XML_SCHEMAS_STRING) || in xmlSchemaValidateFacets()
24252 for (facetLink = type->facetSet; facetLink != NULL; in xmlSchemaValidateFacets()
24253 facetLink = facetLink->next) { in xmlSchemaValidateFacets()
24258 switch (facetLink->facet->type) { in xmlSchemaValidateFacets()
24266 ret = xmlSchemaValidateLengthFacetWhtsp(facetLink->facet, in xmlSchemaValidateFacets()
24270 ret = xmlSchemaValidateFacetWhtsp(facetLink->facet, ws, in xmlSchemaValidateFacets()
24277 return (-1); in xmlSchemaValidateFacets()
24281 value, len, type, facetLink->facet, NULL, NULL, NULL); in xmlSchemaValidateFacets()
24297 for (facetLink = type->facetSet; facetLink != NULL; in xmlSchemaValidateFacets()
24298 facetLink = facetLink->next) { in xmlSchemaValidateFacets()
24300 switch (facetLink->facet->type) { in xmlSchemaValidateFacets()
24304 ret = xmlSchemaValidateListSimpleTypeFacet(facetLink->facet, in xmlSchemaValidateFacets()
24313 return (-1); in xmlSchemaValidateFacets()
24317 value, length, type, facetLink->facet, NULL, NULL, NULL); in xmlSchemaValidateFacets()
24333 * Only the first set of enumerations in the ancestor-or-self axis in xmlSchemaValidateFacets()
24334 * is used for validation. in xmlSchemaValidateFacets()
24339 for (facet = tmpType->facets; facet != NULL; facet = facet->next) { in xmlSchemaValidateFacets()
24340 if (facet->type != XML_SCHEMA_FACET_ENUMERATION) in xmlSchemaValidateFacets()
24343 ret = xmlSchemaAreValuesEqual(facet->val, val); in xmlSchemaValidateFacets()
24349 return (-1); in xmlSchemaValidateFacets()
24362 tmpType = tmpType->baseType; in xmlSchemaValidateFacets()
24364 (tmpType->type != XML_SCHEMA_TYPE_BASIC)); in xmlSchemaValidateFacets()
24387 for (facetLink = tmpType->facetSet; facetLink != NULL; in xmlSchemaValidateFacets()
24388 facetLink = facetLink->next) { in xmlSchemaValidateFacets()
24389 if (facetLink->facet->type != XML_SCHEMA_FACET_PATTERN) in xmlSchemaValidateFacets()
24396 ret = xmlRegexpExec(facetLink->facet->regexp, value); in xmlSchemaValidateFacets()
24402 return (-1); in xmlSchemaValidateFacets()
24405 * Save the last non-validating facet. in xmlSchemaValidateFacets()
24407 facet = facetLink->facet; in xmlSchemaValidateFacets()
24421 tmpType = tmpType->baseType; in xmlSchemaValidateFacets()
24422 } while ((tmpType != NULL) && (tmpType->type != XML_SCHEMA_TYPE_BASIC)); in xmlSchemaValidateFacets()
24454 if (ret == -1) { in xmlSchemaValidateQName()
24457 return (-1); in xmlSchemaValidateQName()
24470 * - is there any namespace binding? in xmlSchemaValidateQName()
24471 * - is there a default namespace? in xmlSchemaValidateQName()
24506 * cvc-simple-type
24525 (normalize || (type->flags & XML_SCHEMAS_TYPE_NORMVALUENEEDED))) { \ in xmlSchemaVCheckCVCSimpleType()
24537 * 3.14.4 Simple Type Definition Validation Rules in xmlSchemaVCheckCVCSimpleType()
24538 * Validation Rule: String Valid in xmlSchemaVCheckCVCSimpleType()
24541 * 1 It is schema-valid with respect to that definition as defined in xmlSchemaVCheckCVCSimpleType()
24552 * then every whitespace-delimited substring of the string must be a `declared in xmlSchemaVCheckCVCSimpleType()
24558 if ((! valNeeded) && (type->flags & XML_SCHEMAS_TYPE_FACETSNEEDVALUE)) in xmlSchemaVCheckCVCSimpleType()
24563 xmlSchemaTypePtr biType; /* The built-in type. */ in xmlSchemaVCheckCVCSimpleType()
24569 * Whitespace-normalize. in xmlSchemaVCheckCVCSimpleType()
24572 if (type->type != XML_SCHEMA_TYPE_BASIC) { in xmlSchemaVCheckCVCSimpleType()
24574 * Get the built-in type. in xmlSchemaVCheckCVCSimpleType()
24576 biType = type->baseType; in xmlSchemaVCheckCVCSimpleType()
24578 (biType->type != XML_SCHEMA_TYPE_BASIC)) in xmlSchemaVCheckCVCSimpleType()
24579 biType = biType->baseType; in xmlSchemaVCheckCVCSimpleType()
24583 "could not get the built-in type"); in xmlSchemaVCheckCVCSimpleType()
24592 if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) { in xmlSchemaVCheckCVCSimpleType()
24593 switch (biType->builtInType) { in xmlSchemaVCheckCVCSimpleType()
24597 ((xmlSchemaValidCtxtPtr) actxt)->schema, in xmlSchemaVCheckCVCSimpleType()
24614 } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { in xmlSchemaVCheckCVCSimpleType()
24615 switch (biType->builtInType) { in xmlSchemaVCheckCVCSimpleType()
24618 ((xmlSchemaParserCtxtPtr) actxt)->schema, node, in xmlSchemaVCheckCVCSimpleType()
24633 * Validation via a public API is not implemented yet. in xmlSchemaVCheckCVCSimpleType()
24641 "validating against a built-in type"); in xmlSchemaVCheckCVCSimpleType()
24649 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { in xmlSchemaVCheckCVCSimpleType()
24654 (xmlSchemaValType) biType->builtInType, value, val, in xmlSchemaVCheckCVCSimpleType()
24687 * VAL TODO: Optimize validation of empty values. in xmlSchemaVCheckCVCSimpleType()
24700 tmpValue = xmlStrndup(cur, end - cur); in xmlSchemaVCheckCVCSimpleType()
24733 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { in xmlSchemaVCheckCVCSimpleType()
24784 * itself; otherwise a later value-comparison would be in xmlSchemaVCheckCVCSimpleType()
24790 memberLink->type, value, &val, 0, 1, 0); in xmlSchemaVCheckCVCSimpleType()
24793 memberLink->type, value, NULL, 0, 1, 0); in xmlSchemaVCheckCVCSimpleType()
24796 memberLink = memberLink->next; in xmlSchemaVCheckCVCSimpleType()
24809 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { in xmlSchemaVCheckCVCSimpleType()
24815 NORMALIZE(memberLink->type); in xmlSchemaVCheckCVCSimpleType()
24847 return (-1); in xmlSchemaVCheckCVCSimpleType()
24859 return (-1); in xmlSchemaVExpandQName()
24864 if (ret == -1) in xmlSchemaVExpandQName()
24865 return (-1); in xmlSchemaVExpandQName()
24882 *localName = xmlDictLookup(vctxt->dict, value, -1); in xmlSchemaVExpandQName()
24884 *localName = xmlDictLookup(vctxt->dict, local, -1); in xmlSchemaVExpandQName()
24917 * cvc-elt (3.3.4) : (4) in xmlSchemaProcessXSIType()
24919 * Schema-Validity Assessment (Element) (cvc-assess-elt) in xmlSchemaProcessXSIType()
24920 * (1.2.1.2.1) - (1.2.1.2.4) in xmlSchemaProcessXSIType()
24924 return (-1); in xmlSchemaProcessXSIType()
24936 * (cvc-elt) (3.3.4) : (4.1) in xmlSchemaProcessXSIType()
24937 * (cvc-assess-elt) (1.2.1.2.2) in xmlSchemaProcessXSIType()
24939 ret = xmlSchemaVExpandQName(vctxt, iattr->value, in xmlSchemaProcessXSIType()
24951 * (cvc-elt) (3.3.4) : (4.2) in xmlSchemaProcessXSIType()
24952 * (cvc-assess-elt) (1.2.1.2.3) in xmlSchemaProcessXSIType()
24954 *localType = xmlSchemaGetType(vctxt->schema, local, nsName); in xmlSchemaProcessXSIType()
24965 ret = vctxt->err; in xmlSchemaProcessXSIType()
24972 * SPEC cvc-elt (3.3.4) : (4.3) (Type Derivation OK) in xmlSchemaProcessXSIType()
24991 if ((elemDecl->flags & XML_SCHEMAS_ELEM_BLOCK_EXTENSION) || in xmlSchemaProcessXSIType()
24992 (elemDecl->subtypes->flags & in xmlSchemaProcessXSIType()
24996 if ((elemDecl->flags & XML_SCHEMAS_ELEM_BLOCK_RESTRICTION) || in xmlSchemaProcessXSIType()
24997 (elemDecl->subtypes->flags & in xmlSchemaProcessXSIType()
25007 * if ((vctxt->pctxt == NULL) && in xmlSchemaProcessXSIType()
25008 * (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1)) in xmlSchemaProcessXSIType()
25009 * return (-1); in xmlSchemaProcessXSIType()
25013 elemDecl->subtypes, set) != 0) { in xmlSchemaProcessXSIType()
25022 (*localType)->targetNamespace, in xmlSchemaProcessXSIType()
25023 (*localType)->name), in xmlSchemaProcessXSIType()
25026 ret = vctxt->err; in xmlSchemaProcessXSIType()
25036 return (-1); in xmlSchemaProcessXSIType()
25042 xmlSchemaElementPtr elemDecl = vctxt->inode->decl; in xmlSchemaValidateElemDecl()
25046 * cvc-elt (3.3.4) : 1 in xmlSchemaValidateElemDecl()
25051 return (vctxt->err); in xmlSchemaValidateElemDecl()
25055 * cvc-elt (3.3.4) : 2 in xmlSchemaValidateElemDecl()
25057 if (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT) { in xmlSchemaValidateElemDecl()
25060 return (vctxt->err); in xmlSchemaValidateElemDecl()
25067 if (vctxt->nbAttrInfos != 0) { in xmlSchemaValidateElemDecl()
25071 * cvc-elt (3.3.4) : 3 in xmlSchemaValidateElemDecl()
25084 iattr->value, &(iattr->val), 1, 0, 0); in xmlSchemaValidateElemDecl()
25090 return (-1); in xmlSchemaValidateElemDecl()
25093 if ((elemDecl->flags & XML_SCHEMAS_ELEM_NILLABLE) == 0) { in xmlSchemaValidateElemDecl()
25095 * cvc-elt (3.3.4) : 3.1 in xmlSchemaValidateElemDecl()
25101 if (xmlSchemaValueGetAsBoolean(iattr->val)) { in xmlSchemaValidateElemDecl()
25103 * cvc-elt (3.3.4) : 3.2.2 in xmlSchemaValidateElemDecl()
25105 if ((elemDecl->flags & XML_SCHEMAS_ELEM_FIXED) && in xmlSchemaValidateElemDecl()
25106 (elemDecl->value != NULL)) { in xmlSchemaValidateElemDecl()
25113 vctxt->inode->flags |= in xmlSchemaValidateElemDecl()
25120 * cvc-elt (3.3.4) : 4 in xmlSchemaValidateElemDecl()
25131 if (ret == -1) { in xmlSchemaValidateElemDecl()
25135 return (-1); in xmlSchemaValidateElemDecl()
25140 vctxt->inode->flags |= XML_SCHEMA_ELEM_INFO_LOCAL_TYPE; in xmlSchemaValidateElemDecl()
25146 * IDC: Register identity-constraint XPath matchers. in xmlSchemaValidateElemDecl()
25148 if ((elemDecl->idcs != NULL) && in xmlSchemaValidateElemDecl()
25149 (xmlSchemaIDCRegisterMatchers(vctxt, elemDecl) == -1)) in xmlSchemaValidateElemDecl()
25150 return (-1); in xmlSchemaValidateElemDecl()
25162 vctxt->inode->typeDef = actualType; in xmlSchemaValidateElemDecl()
25174 * SPEC cvc-type (3.1.1) in xmlSchemaVAttributesSimple()
25176 * name is identical to http://www.w3.org/2001/XMLSchema-instance and in xmlSchemaVAttributesSimple()
25180 if (vctxt->nbAttrInfos == 0) in xmlSchemaVAttributesSimple()
25182 for (i = 0; i < vctxt->nbAttrInfos; i++) { in xmlSchemaVAttributesSimple()
25183 iattr = vctxt->attrInfos[i]; in xmlSchemaVAttributesSimple()
25184 if (! iattr->metaType) { in xmlSchemaVAttributesSimple()
25204 if (vctxt->nbAttrInfos == 0) in xmlSchemaClearAttrInfos()
25206 for (i = 0; i < vctxt->nbAttrInfos; i++) { in xmlSchemaClearAttrInfos()
25207 attr = vctxt->attrInfos[i]; in xmlSchemaClearAttrInfos()
25208 if (attr->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES) { in xmlSchemaClearAttrInfos()
25209 if (attr->localName != NULL) in xmlSchemaClearAttrInfos()
25210 xmlFree((xmlChar *) attr->localName); in xmlSchemaClearAttrInfos()
25211 if (attr->nsName != NULL) in xmlSchemaClearAttrInfos()
25212 xmlFree((xmlChar *) attr->nsName); in xmlSchemaClearAttrInfos()
25214 if (attr->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) { in xmlSchemaClearAttrInfos()
25215 if (attr->value != NULL) in xmlSchemaClearAttrInfos()
25216 xmlFree((xmlChar *) attr->value); in xmlSchemaClearAttrInfos()
25218 if (attr->val != NULL) { in xmlSchemaClearAttrInfos()
25219 xmlSchemaFreeValue(attr->val); in xmlSchemaClearAttrInfos()
25220 attr->val = NULL; in xmlSchemaClearAttrInfos()
25224 vctxt->nbAttrInfos = 0; in xmlSchemaClearAttrInfos()
25228 * 3.4.4 Complex Type Definition Validation Rules
25229 * Element Locally Valid (Complex Type) (cvc-complex-type)
25230 * 3.2.4 Attribute Declaration Validation Rules
25231 * Validation Rule: Attribute Locally Valid (cvc-attribute)
25232 * Attribute Locally Valid (Use) (cvc-au)
25240 xmlSchemaTypePtr type = vctxt->inode->typeDef; in xmlSchemaVAttributesComplex()
25250 * SPEC (cvc-attribute) in xmlSchemaVAttributesComplex()
25252 * Sub-components ($5.3) for how this can fail to be in xmlSchemaVAttributesComplex()
25257 * allow validation against schemas which have missing sub-components. in xmlSchemaVAttributesComplex()
25259 * SPEC (cvc-complex-type) in xmlSchemaVAttributesComplex()
25262 * identical to http://www.w3.org/2001/XMLSchema-instance and whose in xmlSchemaVAttributesComplex()
25268 attrUseList = (xmlSchemaItemListPtr) type->attrUses; in xmlSchemaVAttributesComplex()
25272 nbAttrs = vctxt->nbAttrInfos; in xmlSchemaVAttributesComplex()
25274 nbUses = attrUseList->nbItems; in xmlSchemaVAttributesComplex()
25279 attrUse = attrUseList->items[i]; in xmlSchemaVAttributesComplex()
25282 iattr = vctxt->attrInfos[j]; in xmlSchemaVAttributesComplex()
25284 * SPEC (cvc-complex-type) (3) in xmlSchemaVAttributesComplex()
25287 if (iattr->metaType) in xmlSchemaVAttributesComplex()
25289 if (iattr->localName[0] != attrDecl->name[0]) in xmlSchemaVAttributesComplex()
25291 if (!xmlStrEqual(iattr->localName, attrDecl->name)) in xmlSchemaVAttributesComplex()
25293 if (!xmlStrEqual(iattr->nsName, attrDecl->targetNamespace)) in xmlSchemaVAttributesComplex()
25297 * SPEC (cvc-complex-type) in xmlSchemaVAttributesComplex()
25307 * attribute use is the `context-determined declaration` for the in xmlSchemaVAttributesComplex()
25308 * attribute information item with respect to Schema-Validity in xmlSchemaVAttributesComplex()
25312 iattr->state = XML_SCHEMAS_ATTR_ASSESSED; in xmlSchemaVAttributesComplex()
25313 iattr->use = attrUse; in xmlSchemaVAttributesComplex()
25315 * Context-determined declaration. in xmlSchemaVAttributesComplex()
25317 iattr->decl = attrDecl; in xmlSchemaVAttributesComplex()
25318 iattr->typeDef = attrDecl->subtypes; in xmlSchemaVAttributesComplex()
25325 if (attrUse->occurs == XML_SCHEMAS_ATTR_USE_REQUIRED) { in xmlSchemaVAttributesComplex()
25327 * Handle non-existent, required attributes. in xmlSchemaVAttributesComplex()
25329 * SPEC (cvc-complex-type) in xmlSchemaVAttributesComplex()
25340 return (-1); in xmlSchemaVAttributesComplex()
25342 tmpiattr->state = XML_SCHEMAS_ATTR_ERR_MISSING; in xmlSchemaVAttributesComplex()
25343 tmpiattr->use = attrUse; in xmlSchemaVAttributesComplex()
25344 tmpiattr->decl = attrDecl; in xmlSchemaVAttributesComplex()
25345 } else if ((attrUse->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && in xmlSchemaVAttributesComplex()
25346 ((attrUse->defValue != NULL) || in xmlSchemaVAttributesComplex()
25347 (attrDecl->defValue != NULL))) { in xmlSchemaVAttributesComplex()
25349 * Handle non-existent, optional, default/fixed attributes. in xmlSchemaVAttributesComplex()
25356 return (-1); in xmlSchemaVAttributesComplex()
25358 tmpiattr->state = XML_SCHEMAS_ATTR_DEFAULT; in xmlSchemaVAttributesComplex()
25359 tmpiattr->use = attrUse; in xmlSchemaVAttributesComplex()
25360 tmpiattr->decl = attrDecl; in xmlSchemaVAttributesComplex()
25361 tmpiattr->typeDef = attrDecl->subtypes; in xmlSchemaVAttributesComplex()
25362 tmpiattr->localName = attrDecl->name; in xmlSchemaVAttributesComplex()
25363 tmpiattr->nsName = attrDecl->targetNamespace; in xmlSchemaVAttributesComplex()
25367 if (vctxt->nbAttrInfos == 0) in xmlSchemaVAttributesComplex()
25372 if (type->attributeWildcard != NULL) { in xmlSchemaVAttributesComplex()
25374 * SPEC (cvc-complex-type) in xmlSchemaVAttributesComplex()
25378 iattr = vctxt->attrInfos[i]; in xmlSchemaVAttributesComplex()
25380 * SPEC (cvc-complex-type) (3) in xmlSchemaVAttributesComplex()
25383 if (iattr->state != XML_SCHEMAS_ATTR_UNKNOWN) in xmlSchemaVAttributesComplex()
25386 * SPEC (cvc-complex-type) in xmlSchemaVAttributesComplex()
25390 * SPEC Item Valid (Wildcard) (cvc-wildcard) in xmlSchemaVAttributesComplex()
25395 if (xmlSchemaCheckCVCWildcardNamespace(type->attributeWildcard, in xmlSchemaVAttributesComplex()
25396 iattr->nsName) == 0) { in xmlSchemaVAttributesComplex()
25400 * SPEC (cvc-wildcard): in xmlSchemaVAttributesComplex()
25401 * processContents | context-determined declaration: in xmlSchemaVAttributesComplex()
25406 if (type->attributeWildcard->processContents == in xmlSchemaVAttributesComplex()
25409 * context-determined declaration = "skip" in xmlSchemaVAttributesComplex()
25413 * [validation attempted] = "none" in xmlSchemaVAttributesComplex()
25415 iattr->state = XML_SCHEMAS_ATTR_WILD_SKIP; in xmlSchemaVAttributesComplex()
25421 iattr->decl = xmlSchemaGetAttributeDecl(vctxt->schema, in xmlSchemaVAttributesComplex()
25422 iattr->localName, iattr->nsName); in xmlSchemaVAttributesComplex()
25423 if (iattr->decl != NULL) { in xmlSchemaVAttributesComplex()
25424 iattr->state = XML_SCHEMAS_ATTR_ASSESSED; in xmlSchemaVAttributesComplex()
25426 * SPEC (cvc-complex-type) in xmlSchemaVAttributesComplex()
25429 * applied and whose `validation` resulted in a in xmlSchemaVAttributesComplex()
25430 * `context-determined declaration` of mustFind or no in xmlSchemaVAttributesComplex()
25431 * `context-determined declaration` at all, and whose in xmlSchemaVAttributesComplex()
25438 iattr->typeDef = WXS_ATTR_TYPEDEF(iattr->decl); in xmlSchemaVAttributesComplex()
25440 iattr->typeDef, XML_SCHEMAS_ID)) { in xmlSchemaVAttributesComplex()
25447 iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_ID; in xmlSchemaVAttributesComplex()
25453 * SPEC (cvc-complex-type) in xmlSchemaVAttributesComplex()
25454 * (5.2) "If `wild IDs` is non-empty, there must not in xmlSchemaVAttributesComplex()
25460 for (j = 0; j < attrUseList->nbItems; j++) { in xmlSchemaVAttributesComplex()
25462 WXS_ATTRUSE_TYPEDEF(attrUseList->items[j]), in xmlSchemaVAttributesComplex()
25465 iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID; in xmlSchemaVAttributesComplex()
25472 } else if (type->attributeWildcard->processContents == in xmlSchemaVAttributesComplex()
25474 iattr->state = XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL; in xmlSchemaVAttributesComplex()
25478 * [validation attempted] = "none" in xmlSchemaVAttributesComplex()
25481 iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL; in xmlSchemaVAttributesComplex()
25487 if (vctxt->nbAttrInfos == 0) in xmlSchemaVAttributesComplex()
25494 if (vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) { in xmlSchemaVAttributesComplex()
25495 xmlSchemaNodeInfoPtr ielem = vctxt->elemInfos[vctxt->depth]; in xmlSchemaVAttributesComplex()
25496 if (ielem && ielem->node && ielem->node->doc) in xmlSchemaVAttributesComplex()
25497 defAttrOwnerElem = ielem->node; in xmlSchemaVAttributesComplex()
25502 for (i = 0; i < vctxt->nbAttrInfos; i++) { in xmlSchemaVAttributesComplex()
25503 iattr = vctxt->attrInfos[i]; in xmlSchemaVAttributesComplex()
25509 if ((iattr->state != XML_SCHEMAS_ATTR_ASSESSED) && in xmlSchemaVAttributesComplex()
25510 (iattr->state != XML_SCHEMAS_ATTR_DEFAULT)) in xmlSchemaVAttributesComplex()
25515 if (iattr->typeDef == NULL) { in xmlSchemaVAttributesComplex()
25516 iattr->state = XML_SCHEMAS_ATTR_ERR_NO_TYPE; in xmlSchemaVAttributesComplex()
25524 if (vctxt->xpathStates != NULL) { in xmlSchemaVAttributesComplex()
25530 if (xpathRes == -1) { in xmlSchemaVAttributesComplex()
25537 if (iattr->state == XML_SCHEMAS_ATTR_DEFAULT) { in xmlSchemaVAttributesComplex()
25544 if (iattr->use->defValue != NULL) { in xmlSchemaVAttributesComplex()
25545 iattr->value = (xmlChar *) iattr->use->defValue; in xmlSchemaVAttributesComplex()
25546 iattr->val = iattr->use->defVal; in xmlSchemaVAttributesComplex()
25548 iattr->value = (xmlChar *) iattr->decl->defValue; in xmlSchemaVAttributesComplex()
25549 iattr->val = iattr->decl->defVal; in xmlSchemaVAttributesComplex()
25555 if (iattr->val == NULL) { in xmlSchemaVAttributesComplex()
25561 iattr->val = xmlSchemaCopyValue(iattr->val); in xmlSchemaVAttributesComplex()
25562 if (iattr->val == NULL) { in xmlSchemaVAttributesComplex()
25578 value = iattr->value; in xmlSchemaVAttributesComplex()
25582 normValue = xmlSchemaNormalizeValue(iattr->typeDef, in xmlSchemaVAttributesComplex()
25583 iattr->value); in xmlSchemaVAttributesComplex()
25587 if (iattr->nsName == NULL) { in xmlSchemaVAttributesComplex()
25589 iattr->localName, value) == NULL) { in xmlSchemaVAttributesComplex()
25599 ns = xmlSearchNsByHref(defAttrOwnerElem->doc, in xmlSchemaVAttributesComplex()
25600 defAttrOwnerElem, iattr->nsName); in xmlSchemaVAttributesComplex()
25606 * Create a namespace declaration on the validation in xmlSchemaVAttributesComplex()
25611 ns = xmlSearchNs(defAttrOwnerElem->doc, in xmlSchemaVAttributesComplex()
25623 ns = xmlNewNs(vctxt->validationRoot, in xmlSchemaVAttributesComplex()
25624 iattr->nsName, BAD_CAST prefix); in xmlSchemaVAttributesComplex()
25628 * http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/0406.html in xmlSchemaVAttributesComplex()
25632 xmlNewNsProp(defAttrOwnerElem, ns, iattr->localName, value); in xmlSchemaVAttributesComplex()
25645 if (vctxt->value != NULL) { in xmlSchemaVAttributesComplex()
25649 xmlSchemaFreeValue(vctxt->value); in xmlSchemaVAttributesComplex()
25650 vctxt->value = NULL; in xmlSchemaVAttributesComplex()
25656 if ((iattr->decl->flags & XML_SCHEMAS_ATTR_FIXED) || in xmlSchemaVAttributesComplex()
25657 ((iattr->use != NULL) && in xmlSchemaVAttributesComplex()
25658 (iattr->use->flags & XML_SCHEMAS_ATTR_FIXED))) in xmlSchemaVAttributesComplex()
25663 * SPEC (cvc-attribute) in xmlSchemaVAttributesComplex()
25672 iattr->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED; in xmlSchemaVAttributesComplex()
25678 iattr->node, iattr->typeDef, iattr->value, &(iattr->val), in xmlSchemaVAttributesComplex()
25683 iattr->node, iattr->typeDef, iattr->value, NULL, in xmlSchemaVAttributesComplex()
25688 if (res == -1) { in xmlSchemaVAttributesComplex()
25693 iattr->state = XML_SCHEMAS_ATTR_INVALID_VALUE; in xmlSchemaVAttributesComplex()
25703 * SPEC Attribute Locally Valid (Use) (cvc-au) in xmlSchemaVAttributesComplex()
25714 * SPEC Attribute Locally Valid (cvc-attribute) in xmlSchemaVAttributesComplex()
25718 if (iattr->val == NULL) { in xmlSchemaVAttributesComplex()
25723 if ((iattr->use != NULL) && in xmlSchemaVAttributesComplex()
25724 (iattr->use->defValue != NULL)) { in xmlSchemaVAttributesComplex()
25725 if (iattr->use->defVal == NULL) { in xmlSchemaVAttributesComplex()
25730 iattr->vcValue = iattr->use->defValue; in xmlSchemaVAttributesComplex()
25732 if (xmlSchemaCompareValuesWhtsp(attr->val, in xmlSchemaVAttributesComplex()
25734 attr->use->defVal, in xmlSchemaVAttributesComplex()
25737 if (! xmlSchemaAreValuesEqual(iattr->val, iattr->use->defVal)) in xmlSchemaVAttributesComplex()
25738 iattr->state = XML_SCHEMAS_ATTR_ERR_FIXED_VALUE; in xmlSchemaVAttributesComplex()
25740 if (iattr->decl->defVal == NULL) { in xmlSchemaVAttributesComplex()
25745 iattr->vcValue = iattr->decl->defValue; in xmlSchemaVAttributesComplex()
25747 if (xmlSchemaCompareValuesWhtsp(attr->val, in xmlSchemaVAttributesComplex()
25749 attrDecl->defVal, in xmlSchemaVAttributesComplex()
25752 if (! xmlSchemaAreValuesEqual(iattr->val, iattr->decl->defVal)) in xmlSchemaVAttributesComplex()
25753 iattr->state = XML_SCHEMAS_ATTR_ERR_FIXED_VALUE; in xmlSchemaVAttributesComplex()
25765 vctxt->depth +1) == -1) { in xmlSchemaVAttributesComplex()
25770 } else if (vctxt->xpathStates != NULL) in xmlSchemaVAttributesComplex()
25777 for (i = 0; i < vctxt->nbAttrInfos; i++) { in xmlSchemaVAttributesComplex()
25778 iattr = vctxt->attrInfos[i]; in xmlSchemaVAttributesComplex()
25779 if ((iattr->state == XML_SCHEMAS_ATTR_META) || in xmlSchemaVAttributesComplex()
25780 (iattr->state == XML_SCHEMAS_ATTR_ASSESSED) || in xmlSchemaVAttributesComplex()
25781 (iattr->state == XML_SCHEMAS_ATTR_WILD_SKIP) || in xmlSchemaVAttributesComplex()
25782 (iattr->state == XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL)) in xmlSchemaVAttributesComplex()
25785 switch (iattr->state) { in xmlSchemaVAttributesComplex()
25793 iattr->decl->targetNamespace, in xmlSchemaVAttributesComplex()
25794 iattr->decl->name), in xmlSchemaVAttributesComplex()
25808 iattr->value, iattr->vcValue); in xmlSchemaVAttributesComplex()
25816 if (iattr->metaType) in xmlSchemaVAttributesComplex()
25822 if (type->attributeWildcard == NULL) { in xmlSchemaVAttributesComplex()
25839 return (-1); in xmlSchemaVAttributesComplex()
25846 xmlSchemaWildcardPtr wild = (xmlSchemaWildcardPtr) vctxt->inode->decl; in xmlSchemaValidateElemWildcard()
25852 (wild->type != XML_SCHEMA_TYPE_ANY)) { in xmlSchemaValidateElemWildcard()
25855 return (-1); in xmlSchemaValidateElemWildcard()
25858 if (wild->processContents == XML_SCHEMAS_ANY_SKIP) { in xmlSchemaValidateElemWildcard()
25869 decl = xmlSchemaGetElem(vctxt->schema, in xmlSchemaValidateElemWildcard()
25870 vctxt->inode->localName, vctxt->inode->nsName); in xmlSchemaValidateElemWildcard()
25872 vctxt->inode->decl = decl; in xmlSchemaValidateElemWildcard()
25876 if (wild->processContents == XML_SCHEMAS_ANY_STRICT) { in xmlSchemaValidateElemWildcard()
25881 return (vctxt->err); in xmlSchemaValidateElemWildcard()
25883 if (vctxt->nbAttrInfos != 0) { in xmlSchemaValidateElemWildcard()
25886 * SPEC Validation Rule: Schema-Validity Assessment (Element) in xmlSchemaValidateElemWildcard()
25887 * (1.2.1.2.1) - (1.2.1.2.3 ) in xmlSchemaValidateElemWildcard()
25895 &(vctxt->inode->typeDef), NULL) == -1) { in xmlSchemaValidateElemWildcard()
25899 return (-1); in xmlSchemaValidateElemWildcard()
25908 * SPEC Validation Rule: Schema-Validity Assessment (Element) in xmlSchemaValidateElemWildcard()
25912 vctxt->inode->typeDef = in xmlSchemaValidateElemWildcard()
25930 xmlSchemaNodeInfoPtr inode = vctxt->inode; in xmlSchemaCheckCOSValidDefault()
25933 * cos-valid-default: in xmlSchemaCheckCOSValidDefault()
25938 if WXS_IS_COMPLEX(inode->typeDef) { in xmlSchemaCheckCOSValidDefault()
25948 if ((! WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) && in xmlSchemaCheckCOSValidDefault()
25949 ((! WXS_HAS_MIXED_CONTENT(inode->typeDef)) || in xmlSchemaCheckCOSValidDefault()
25950 (! WXS_EMPTIABLE(inode->typeDef)))) { in xmlSchemaCheckCOSValidDefault()
25971 if (WXS_IS_SIMPLE(inode->typeDef)) { in xmlSchemaCheckCOSValidDefault()
25974 NULL, inode->typeDef, value, val, 1, 1, 0); in xmlSchemaCheckCOSValidDefault()
25976 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { in xmlSchemaCheckCOSValidDefault()
25979 NULL, inode->typeDef->contentTypeDef, value, val, 1, 1, 0); in xmlSchemaCheckCOSValidDefault()
25995 inode->decl = item; in xmlSchemaVContentModelCallback()
26000 if (item->type == XML_SCHEMA_TYPE_ELEMENT) { in xmlSchemaVContentModelCallback()
26004 inode->localName, inode->nsName)); in xmlSchemaVContentModelCallback()
26009 inode->localName, inode->nsName)); in xmlSchemaVContentModelCallback()
26020 vctxt->inode = xmlSchemaGetFreshElemInfo(vctxt); in xmlSchemaValidatorPushElem()
26021 if (vctxt->inode == NULL) { in xmlSchemaValidatorPushElem()
26024 return (-1); in xmlSchemaValidatorPushElem()
26026 vctxt->nbAttrInfos = 0; in xmlSchemaValidatorPushElem()
26036 if (inode->flags & XML_SCHEMA_NODE_INFO_VALUE_NEEDED) in xmlSchemaVCheckINodeDataType()
26039 type, value, &(inode->val), 1, 1, 0)); in xmlSchemaVCheckINodeDataType()
26055 xmlSchemaNodeInfoPtr inode = vctxt->inode; in xmlSchemaValidatorPopElem()
26057 if (vctxt->nbAttrInfos != 0) in xmlSchemaValidatorPopElem()
26059 if (inode->flags & XML_SCHEMA_NODE_INFO_ERR_NOT_EXPECTED) { in xmlSchemaValidatorPopElem()
26063 * Skip validation of all content of the parent. in xmlSchemaValidatorPopElem()
26065 vctxt->skipDepth = vctxt->depth -1; in xmlSchemaValidatorPopElem()
26068 if ((inode->typeDef == NULL) || in xmlSchemaValidatorPopElem()
26069 (inode->flags & XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE)) { in xmlSchemaValidatorPopElem()
26080 if ((inode->typeDef->contentType == XML_SCHEMA_CONTENT_MIXED) || in xmlSchemaValidatorPopElem()
26081 (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS)) { in xmlSchemaValidatorPopElem()
26086 if (inode->typeDef->builtInType == XML_SCHEMAS_ANYTYPE) in xmlSchemaValidatorPopElem()
26089 if ((inode->flags & XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT) == 0) { in xmlSchemaValidatorPopElem()
26093 if (inode->regexCtxt == NULL) { in xmlSchemaValidatorPopElem()
26097 inode->regexCtxt = in xmlSchemaValidatorPopElem()
26098 xmlRegNewExecCtxt(inode->typeDef->contModel, in xmlSchemaValidatorPopElem()
26100 if (inode->regexCtxt == NULL) { in xmlSchemaValidatorPopElem()
26107 "AUTOMATON create on '%s'\n", inode->localName); in xmlSchemaValidatorPopElem()
26119 inode->localName); in xmlSchemaValidatorPopElem()
26128 xmlRegExecNextValues(inode->regexCtxt, in xmlSchemaValidatorPopElem()
26130 ret = xmlRegExecPushString(inode->regexCtxt, NULL, NULL); in xmlSchemaValidatorPopElem()
26136 inode->flags |= in xmlSchemaValidatorPopElem()
26145 inode->localName); in xmlSchemaValidatorPopElem()
26155 inode->localName); in xmlSchemaValidatorPopElem()
26164 if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS) in xmlSchemaValidatorPopElem()
26169 if (vctxt->value != NULL) { in xmlSchemaValidatorPopElem()
26170 xmlSchemaFreeValue(vctxt->value); in xmlSchemaValidatorPopElem()
26171 vctxt->value = NULL; in xmlSchemaValidatorPopElem()
26176 if (inode->decl == NULL) { in xmlSchemaValidatorPopElem()
26180 if (WXS_IS_SIMPLE(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26182 inode, inode->typeDef, inode->value); in xmlSchemaValidatorPopElem()
26183 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26185 inode, inode->typeDef->contentTypeDef, in xmlSchemaValidatorPopElem()
26186 inode->value); in xmlSchemaValidatorPopElem()
26196 * cvc-elt (3.3.4) : 5 in xmlSchemaValidatorPopElem()
26200 * cvc-elt (3.3.4) : 5.1 in xmlSchemaValidatorPopElem()
26205 if ((inode->decl->value != NULL) && in xmlSchemaValidatorPopElem()
26206 (inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) && in xmlSchemaValidatorPopElem()
26209 * cvc-elt (3.3.4) : 5.1.1 in xmlSchemaValidatorPopElem()
26221 if (inode->flags & XML_SCHEMA_ELEM_INFO_LOCAL_TYPE) { in xmlSchemaValidatorPopElem()
26224 inode->decl->value, &(inode->val)); in xmlSchemaValidatorPopElem()
26234 * Stop here, to avoid redundant validation of the value in xmlSchemaValidatorPopElem()
26240 * cvc-elt (3.3.4) : 5.1.2 in xmlSchemaValidatorPopElem()
26247 if (WXS_IS_SIMPLE(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26249 inode, inode->typeDef, inode->decl->value); in xmlSchemaValidatorPopElem()
26250 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26252 inode, inode->typeDef->contentTypeDef, in xmlSchemaValidatorPopElem()
26253 inode->decl->value); in xmlSchemaValidatorPopElem()
26268 if ((vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) && in xmlSchemaValidatorPopElem()
26269 (inode->node != NULL)) { in xmlSchemaValidatorPopElem()
26275 normValue = xmlSchemaNormalizeValue(inode->typeDef, in xmlSchemaValidatorPopElem()
26276 inode->decl->value); in xmlSchemaValidatorPopElem()
26281 textChild = xmlNewText(inode->decl->value); in xmlSchemaValidatorPopElem()
26287 xmlAddChild(inode->node, textChild); in xmlSchemaValidatorPopElem()
26296 if (WXS_IS_SIMPLE(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26298 * SPEC (cvc-type) (3.1) in xmlSchemaValidatorPopElem()
26306 inode, inode->typeDef, inode->value); in xmlSchemaValidatorPopElem()
26307 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26309 * SPEC (cvc-type) (3.2) "If the type definition is a complex type in xmlSchemaValidatorPopElem()
26314 * SPEC (cvc-complex-type) (2.2) in xmlSchemaValidatorPopElem()
26321 inode, inode->typeDef->contentTypeDef, inode->value); in xmlSchemaValidatorPopElem()
26335 if ((inode->decl->value != NULL) && in xmlSchemaValidatorPopElem()
26336 (inode->decl->flags & XML_SCHEMAS_ELEM_FIXED)) { in xmlSchemaValidatorPopElem()
26346 if (inode->flags & in xmlSchemaValidatorPopElem()
26358 if (WXS_HAS_MIXED_CONTENT(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26370 if (! xmlStrEqual(inode->value, inode->decl->value)){ in xmlSchemaValidatorPopElem()
26380 inode->value, inode->decl->value); in xmlSchemaValidatorPopElem()
26383 } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { in xmlSchemaValidatorPopElem()
26396 if (! xmlStrEqual(inode->value, in xmlSchemaValidatorPopElem()
26397 inode->decl->value)) { in xmlSchemaValidatorPopElem()
26403 inode->value, in xmlSchemaValidatorPopElem()
26404 inode->decl->value); in xmlSchemaValidatorPopElem()
26413 if (vctxt->depth < 0) { in xmlSchemaValidatorPopElem()
26417 if (vctxt->depth == vctxt->skipDepth) in xmlSchemaValidatorPopElem()
26418 vctxt->skipDepth = -1; in xmlSchemaValidatorPopElem()
26422 if (inode->appliedXPath && in xmlSchemaValidatorPopElem()
26423 (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1)) in xmlSchemaValidatorPopElem()
26428 * respect to each of the {identity-constraint definitions} as per in xmlSchemaValidatorPopElem()
26429 * Identity-constraint Satisfied ($3.11.4)." in xmlSchemaValidatorPopElem()
26432 * PSVI TODO: If we expose IDC node-tables via PSVI then the tables in xmlSchemaValidatorPopElem()
26434 * We will currently build IDC node-tables and bubble them only if in xmlSchemaValidatorPopElem()
26439 * Add the current IDC target-nodes to the IDC node-tables. in xmlSchemaValidatorPopElem()
26441 if ((inode->idcMatchers != NULL) && in xmlSchemaValidatorPopElem()
26442 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables)) in xmlSchemaValidatorPopElem()
26444 if (xmlSchemaIDCFillNodeTables(vctxt, inode) == -1) in xmlSchemaValidatorPopElem()
26450 if (vctxt->inode->hasKeyrefs) in xmlSchemaValidatorPopElem()
26451 if (xmlSchemaCheckCVCIDCKeyRef(vctxt) == -1) in xmlSchemaValidatorPopElem()
26456 if (inode->idcTable != NULL) { in xmlSchemaValidatorPopElem()
26459 inode->nsName, in xmlSchemaValidatorPopElem()
26460 inode->localName, in xmlSchemaValidatorPopElem()
26461 inode->idcTable); in xmlSchemaValidatorPopElem()
26463 if ((vctxt->depth > 0) && in xmlSchemaValidatorPopElem()
26464 (vctxt->hasKeyrefs || vctxt->createIDCNodeTables)) in xmlSchemaValidatorPopElem()
26469 if (xmlSchemaBubbleIDCNodeTables(vctxt) == -1) in xmlSchemaValidatorPopElem()
26480 * Skip further processing if we are on the validation root. in xmlSchemaValidatorPopElem()
26482 if (vctxt->depth == 0) { in xmlSchemaValidatorPopElem()
26483 vctxt->depth--; in xmlSchemaValidatorPopElem()
26484 vctxt->inode = NULL; in xmlSchemaValidatorPopElem()
26490 if (vctxt->aidcs != NULL) { in xmlSchemaValidatorPopElem()
26491 xmlSchemaIDCAugPtr aidc = vctxt->aidcs; in xmlSchemaValidatorPopElem()
26493 if (aidc->keyrefDepth == vctxt->depth) { in xmlSchemaValidatorPopElem()
26497 * top-most keyref IDC which refers to this IDC. in xmlSchemaValidatorPopElem()
26499 aidc->keyrefDepth = -1; in xmlSchemaValidatorPopElem()
26501 aidc = aidc->next; in xmlSchemaValidatorPopElem()
26504 vctxt->depth--; in xmlSchemaValidatorPopElem()
26505 vctxt->inode = vctxt->elemInfos[vctxt->depth]; in xmlSchemaValidatorPopElem()
26507 * VAL TODO: 7 If the element information item is the `validation root`, it must be in xmlSchemaValidatorPopElem()
26508 * `valid` per Validation Root Valid (ID/IDREF) ($3.3.4). in xmlSchemaValidatorPopElem()
26513 vctxt->err = -1; in xmlSchemaValidatorPopElem()
26514 return (-1); in xmlSchemaValidatorPopElem()
26518 * 3.4.4 Complex Type Definition Validation Rules
26519 * Validation Rule: Element Locally Valid (Complex Type) (cvc-complex-type)
26528 if (vctxt->depth <= 0) { in xmlSchemaValidateChildElem()
26530 "not intended for the validation root"); in xmlSchemaValidateChildElem()
26531 return (-1); in xmlSchemaValidateChildElem()
26533 pielem = vctxt->elemInfos[vctxt->depth -1]; in xmlSchemaValidateChildElem()
26534 if (pielem->flags & XML_SCHEMA_ELEM_INFO_EMPTY) in xmlSchemaValidateChildElem()
26535 pielem->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY; in xmlSchemaValidateChildElem()
26541 * SPEC (cvc-elt) (3.3.4) : (3.2.1) in xmlSchemaValidateChildElem()
26552 ptype = pielem->typeDef; in xmlSchemaValidateChildElem()
26554 if (ptype->builtInType == XML_SCHEMAS_ANYTYPE) { in xmlSchemaValidateChildElem()
26560 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema, in xmlSchemaValidateChildElem()
26561 vctxt->inode->localName, in xmlSchemaValidateChildElem()
26562 vctxt->inode->nsName); in xmlSchemaValidateChildElem()
26564 if (vctxt->inode->decl == NULL) { in xmlSchemaValidateChildElem()
26568 * SPEC (cvc-assess-elt) (1.2.1.2.1) - (1.2.1.2.3) in xmlSchemaValidateChildElem()
26574 &(vctxt->inode->typeDef), NULL); in xmlSchemaValidateChildElem()
26576 if (ret == -1) { in xmlSchemaValidateChildElem()
26580 return (-1); in xmlSchemaValidateChildElem()
26588 * SPEC (cvc-assess-elt) in xmlSchemaValidateChildElem()
26591 * assessed if its `context-determined declaration` is not in xmlSchemaValidateChildElem()
26592 * skip by `validating` with respect to the `ur-type in xmlSchemaValidateChildElem()
26595 vctxt->inode->typeDef = in xmlSchemaValidateChildElem()
26602 switch (ptype->contentType) { in xmlSchemaValidateChildElem()
26624 /* VAL TODO: Optimized "anyType" validation.*/ in xmlSchemaValidateChildElem()
26626 if (ptype->contModel == NULL) { in xmlSchemaValidateChildElem()
26629 return (-1); in xmlSchemaValidateChildElem()
26635 if (pielem->flags & XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT) { in xmlSchemaValidateChildElem()
26638 return (-1); in xmlSchemaValidateChildElem()
26641 regexCtxt = pielem->regexCtxt; in xmlSchemaValidateChildElem()
26646 regexCtxt = xmlRegNewExecCtxt(ptype->contModel, in xmlSchemaValidateChildElem()
26651 return (-1); in xmlSchemaValidateChildElem()
26653 pielem->regexCtxt = regexCtxt; in xmlSchemaValidateChildElem()
26656 pielem->localName); in xmlSchemaValidateChildElem()
26661 * SPEC (2.4) "If the {content type} is element-only or mixed, in xmlSchemaValidateChildElem()
26669 vctxt->inode->localName, in xmlSchemaValidateChildElem()
26670 vctxt->inode->nsName, in xmlSchemaValidateChildElem()
26671 vctxt->inode); in xmlSchemaValidateChildElem()
26676 vctxt->inode->localName, pielem->localName); in xmlSchemaValidateChildElem()
26680 vctxt->inode->localName, pielem->localName); in xmlSchemaValidateChildElem()
26682 if (vctxt->err == XML_SCHEMAV_INTERNAL) { in xmlSchemaValidateChildElem()
26685 return (-1); in xmlSchemaValidateChildElem()
26694 ret = vctxt->err; in xmlSchemaValidateChildElem()
26705 * SPEC (cvc-complex-type) (2.2) in xmlSchemaValidateChildElem()
26715 * SPEC (cvc-type) (3.1.2) "The element information item must in xmlSchemaValidateChildElem()
26723 ret = vctxt->err; in xmlSchemaValidateChildElem()
26736 vctxt->skipDepth = vctxt->depth; in xmlSchemaValidateChildElem()
26737 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_NOT_EXPECTED; in xmlSchemaValidateChildElem()
26738 pielem->flags |= XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT; in xmlSchemaValidateChildElem()
26762 if (INODE_NILLED(vctxt->inode)) { in xmlSchemaVPushText()
26764 * SPEC cvc-elt (3.3.4 - 3.2.1) in xmlSchemaVPushText()
26771 return (vctxt->err); in xmlSchemaVPushText()
26778 if (vctxt->inode->typeDef->contentType == in xmlSchemaVPushText()
26783 return (vctxt->err); in xmlSchemaVPushText()
26786 if (vctxt->inode->typeDef->contentType == in xmlSchemaVPushText()
26791 * SPEC cvc-complex-type (2.3) in xmlSchemaVPushText()
26792 * "If the {content type} is element-only, then the in xmlSchemaVPushText()
26800 "because the content type is 'element-only'"); in xmlSchemaVPushText()
26801 return (vctxt->err); in xmlSchemaVPushText()
26813 if ((vctxt->inode->typeDef->contentType == XML_SCHEMA_CONTENT_MIXED) && in xmlSchemaVPushText()
26814 ((vctxt->inode->decl == NULL) || in xmlSchemaVPushText()
26815 (vctxt->inode->decl->value == NULL))) in xmlSchemaVPushText()
26818 if (vctxt->inode->value == NULL) { in xmlSchemaVPushText()
26827 vctxt->inode->value = value; in xmlSchemaVPushText()
26834 vctxt->inode->value = value; in xmlSchemaVPushText()
26837 vctxt->inode->flags |= in xmlSchemaVPushText()
26845 if (len != -1) in xmlSchemaVPushText()
26846 vctxt->inode->value = BAD_CAST xmlStrndup(value, len); in xmlSchemaVPushText()
26848 vctxt->inode->value = BAD_CAST xmlStrdup(value); in xmlSchemaVPushText()
26849 vctxt->inode->flags |= in xmlSchemaVPushText()
26861 if (vctxt->inode->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) { in xmlSchemaVPushText()
26862 vctxt->inode->value = BAD_CAST xmlStrncat( in xmlSchemaVPushText()
26863 (xmlChar *) vctxt->inode->value, value, len); in xmlSchemaVPushText()
26865 vctxt->inode->value = in xmlSchemaVPushText()
26866 BAD_CAST xmlStrncatNew(vctxt->inode->value, value, len); in xmlSchemaVPushText()
26867 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES; in xmlSchemaVPushText()
26879 if ((vctxt->skipDepth != -1) && in xmlSchemaValidateElem()
26880 (vctxt->depth >= vctxt->skipDepth)) { in xmlSchemaValidateElem()
26882 "in skip-state"); in xmlSchemaValidateElem()
26885 if (vctxt->xsiAssemble) { in xmlSchemaValidateElem()
26887 * We will stop validation if there was an error during in xmlSchemaValidateElem()
26892 * TODO: If we are sure how to stop the validation at once in xmlSchemaValidateElem()
26894 * instantly stop the validation. in xmlSchemaValidateElem()
26898 if (ret == -1) in xmlSchemaValidateElem()
26900 vctxt->skipDepth = 0; in xmlSchemaValidateElem()
26907 xmlHashScan(vctxt->schema->schemasImports, xmlSchemaAugmentImportedIDC, in xmlSchemaValidateElem()
26910 if (vctxt->depth > 0) { in xmlSchemaValidateElem()
26924 if (vctxt->depth == vctxt->skipDepth) in xmlSchemaValidateElem()
26926 if ((vctxt->inode->decl == NULL) && in xmlSchemaValidateElem()
26927 (vctxt->inode->typeDef == NULL)) { in xmlSchemaValidateElem()
26935 * Get the declaration of the validation root. in xmlSchemaValidateElem()
26937 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema, in xmlSchemaValidateElem()
26938 vctxt->inode->localName, in xmlSchemaValidateElem()
26939 vctxt->inode->nsName); in xmlSchemaValidateElem()
26940 if (vctxt->inode->decl == NULL) { in xmlSchemaValidateElem()
26944 "for the validation root"); in xmlSchemaValidateElem()
26949 if (vctxt->inode->decl == NULL) in xmlSchemaValidateElem()
26952 if (vctxt->inode->decl->type == XML_SCHEMA_TYPE_ANY) { in xmlSchemaValidateElem()
26967 vctxt->skipDepth = vctxt->depth; in xmlSchemaValidateElem()
26971 * The declaration might be set by the wildcard validation, in xmlSchemaValidateElem()
26974 if (vctxt->inode->decl->type != XML_SCHEMA_TYPE_ELEMENT) { in xmlSchemaValidateElem()
26978 vctxt->inode->decl = NULL; in xmlSchemaValidateElem()
26999 if (vctxt->inode->typeDef == NULL) { in xmlSchemaValidateElem()
27000 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; in xmlSchemaValidateElem()
27006 if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) { in xmlSchemaValidateElem()
27007 vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; in xmlSchemaValidateElem()
27015 * during validation against the declaration. This must be done in xmlSchemaValidateElem()
27016 * _before_ attribute validation. in xmlSchemaValidateElem()
27018 if (vctxt->xpathStates != NULL) { in xmlSchemaValidateElem()
27020 vctxt->inode->appliedXPath = 1; in xmlSchemaValidateElem()
27021 if (ret == -1) { in xmlSchemaValidateElem()
27030 if (WXS_IS_COMPLEX(vctxt->inode->typeDef)) { in xmlSchemaValidateElem()
27031 if ((vctxt->nbAttrInfos != 0) || in xmlSchemaValidateElem()
27032 (vctxt->inode->typeDef->attrUses != NULL)) { in xmlSchemaValidateElem()
27036 } else if (vctxt->nbAttrInfos != 0) { in xmlSchemaValidateElem()
27043 if (vctxt->nbAttrInfos != 0) in xmlSchemaValidateElem()
27045 if (ret == -1) { in xmlSchemaValidateElem()
27047 "calling attributes validation"); in xmlSchemaValidateElem()
27057 vctxt->skipDepth = vctxt->depth; in xmlSchemaValidateElem()
27060 return (-1); in xmlSchemaValidateElem()
27071 vctxt->depth = -1; in xmlSchemaVReaderWalk()
27072 ret = xmlTextReaderRead(vctxt->reader); in xmlSchemaVReaderWalk()
27077 nodeType = xmlTextReaderNodeType(vctxt->reader); in xmlSchemaVReaderWalk()
27080 ret = xmlTextReaderRead(vctxt->reader); in xmlSchemaVReaderWalk()
27087 depth = xmlTextReaderDepth(vctxt->reader); in xmlSchemaVReaderWalk()
27088 nodeType = xmlTextReaderNodeType(vctxt->reader); in xmlSchemaVReaderWalk()
27092 vctxt->depth++; in xmlSchemaVReaderWalk()
27093 if (xmlSchemaValidatorPushElem(vctxt) == -1) { in xmlSchemaVReaderWalk()
27098 ielem = vctxt->inode; in xmlSchemaVReaderWalk()
27099 ielem->localName = xmlTextReaderLocalName(vctxt->reader); in xmlSchemaVReaderWalk()
27100 ielem->nsName = xmlTextReaderNamespaceUri(vctxt->reader); in xmlSchemaVReaderWalk()
27101 ielem->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES; in xmlSchemaVReaderWalk()
27105 ret = xmlTextReaderIsEmptyElement(vctxt->reader); in xmlSchemaVReaderWalk()
27106 if (ret == -1) { in xmlSchemaVReaderWalk()
27112 ielem->flags |= XML_SCHEMA_ELEM_INFO_EMPTY; in xmlSchemaVReaderWalk()
27117 vctxt->nbAttrInfos = 0; in xmlSchemaVReaderWalk()
27118 ret = xmlTextReaderMoveToFirstAttribute(vctxt->reader); in xmlSchemaVReaderWalk()
27119 if (ret == -1) { in xmlSchemaVReaderWalk()
27131 (const xmlChar *) xmlTextReaderLocalName(vctxt->reader), in xmlSchemaVReaderWalk()
27132 xmlTextReaderNamespaceUri(vctxt->reader), 1, in xmlSchemaVReaderWalk()
27133 xmlTextReaderValue(vctxt->reader), 1) == -1) { in xmlSchemaVReaderWalk()
27139 ret = xmlTextReaderMoveToNextAttribute(vctxt->reader); in xmlSchemaVReaderWalk()
27140 if (ret == -1) { in xmlSchemaVReaderWalk()
27149 ret = xmlTextReaderMoveToElement(vctxt->reader); in xmlSchemaVReaderWalk()
27150 if (ret == -1) { in xmlSchemaVReaderWalk()
27161 if (ret == -1) { in xmlSchemaVReaderWalk()
27168 if (vctxt->depth == vctxt->skipDepth) { in xmlSchemaVReaderWalk()
27173 if ((ielem->flags & XML_SCHEMA_ELEM_INFO_EMPTY) == 0) { in xmlSchemaVReaderWalk()
27174 ret = xmlTextReaderRead(vctxt->reader); in xmlSchemaVReaderWalk()
27175 curDepth = xmlTextReaderDepth(vctxt->reader); in xmlSchemaVReaderWalk()
27177 ret = xmlTextReaderRead(vctxt->reader); in xmlSchemaVReaderWalk()
27178 curDepth = xmlTextReaderDepth(vctxt->reader); in xmlSchemaVReaderWalk()
27194 if (ielem->flags & XML_SCHEMA_ELEM_INFO_EMPTY) in xmlSchemaVReaderWalk()
27210 if (vctxt->depth >= 0) in xmlSchemaVReaderWalk()
27211 ielem = vctxt->inode; in xmlSchemaVReaderWalk()
27226 value = xmlTextReaderValue(vctxt->reader); in xmlSchemaVReaderWalk()
27228 -1, XML_SCHEMA_PUSH_TEXT_CREATED, &consumed); in xmlSchemaVReaderWalk()
27231 if (ret == -1) { in xmlSchemaVReaderWalk()
27246 ret = xmlTextReaderRead(vctxt->reader); in xmlSchemaVReaderWalk()
27252 return (-1); in xmlSchemaVReaderWalk()
27258 * SAX validation handlers *
27272 if (vctxt->depth < 0) in xmlSchemaSAXHandleText()
27274 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth)) in xmlSchemaSAXHandleText()
27276 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) in xmlSchemaSAXHandleText()
27277 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY; in xmlSchemaSAXHandleText()
27279 XML_SCHEMA_PUSH_TEXT_VOLATILE, NULL) == -1) { in xmlSchemaSAXHandleText()
27282 vctxt->err = -1; in xmlSchemaSAXHandleText()
27283 xmlStopParser(vctxt->parserCtxt); in xmlSchemaSAXHandleText()
27297 if (vctxt->depth < 0) in xmlSchemaSAXHandleCDataSection()
27299 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth)) in xmlSchemaSAXHandleCDataSection()
27301 if (vctxt->inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) in xmlSchemaSAXHandleCDataSection()
27302 vctxt->inode->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY; in xmlSchemaSAXHandleCDataSection()
27304 XML_SCHEMA_PUSH_TEXT_VOLATILE, NULL) == -1) { in xmlSchemaSAXHandleCDataSection()
27307 vctxt->err = -1; in xmlSchemaSAXHandleCDataSection()
27308 xmlStopParser(vctxt->parserCtxt); in xmlSchemaSAXHandleCDataSection()
27318 if (vctxt->depth < 0) in xmlSchemaSAXHandleReference()
27320 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth)) in xmlSchemaSAXHandleReference()
27348 vctxt->depth++; in xmlSchemaSAXHandleStartElementNs()
27349 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth)) in xmlSchemaSAXHandleStartElementNs()
27354 if (xmlSchemaValidatorPushElem(vctxt) == -1) { in xmlSchemaSAXHandleStartElementNs()
27359 ielem = vctxt->inode; in xmlSchemaSAXHandleStartElementNs()
27363 ielem->nodeLine = xmlSAX2GetLineNumber(vctxt->parserCtxt); in xmlSchemaSAXHandleStartElementNs()
27364 ielem->localName = localname; in xmlSchemaSAXHandleStartElementNs()
27365 ielem->nsName = URI; in xmlSchemaSAXHandleStartElementNs()
27366 ielem->flags |= XML_SCHEMA_ELEM_INFO_EMPTY; in xmlSchemaSAXHandleStartElementNs()
27379 if (ielem->nsBindings == NULL) { in xmlSchemaSAXHandleStartElementNs()
27380 ielem->nsBindings = in xmlSchemaSAXHandleStartElementNs()
27383 if (ielem->nsBindings == NULL) { in xmlSchemaSAXHandleStartElementNs()
27385 "allocating namespace bindings for SAX validation", in xmlSchemaSAXHandleStartElementNs()
27389 ielem->nbNsBindings = 0; in xmlSchemaSAXHandleStartElementNs()
27390 ielem->sizeNsBindings = 5; in xmlSchemaSAXHandleStartElementNs()
27391 } else if (ielem->sizeNsBindings <= ielem->nbNsBindings) { in xmlSchemaSAXHandleStartElementNs()
27392 ielem->sizeNsBindings *= 2; in xmlSchemaSAXHandleStartElementNs()
27393 ielem->nsBindings = in xmlSchemaSAXHandleStartElementNs()
27395 (void *) ielem->nsBindings, in xmlSchemaSAXHandleStartElementNs()
27396 ielem->sizeNsBindings * 2 * sizeof(const xmlChar *)); in xmlSchemaSAXHandleStartElementNs()
27397 if (ielem->nsBindings == NULL) { in xmlSchemaSAXHandleStartElementNs()
27399 "re-allocating namespace bindings for SAX validation", in xmlSchemaSAXHandleStartElementNs()
27405 ielem->nsBindings[ielem->nbNsBindings * 2] = namespaces[j]; in xmlSchemaSAXHandleStartElementNs()
27410 ielem->nsBindings[ielem->nbNsBindings * 2 + 1] = NULL; in xmlSchemaSAXHandleStartElementNs()
27412 ielem->nsBindings[ielem->nbNsBindings * 2 + 1] = in xmlSchemaSAXHandleStartElementNs()
27414 ielem->nbNsBindings++; in xmlSchemaSAXHandleStartElementNs()
27435 valueLen = attributes[j+4] - attributes[j+3]; in xmlSchemaSAXHandleStartElementNs()
27444 if (k < valueLen - 4 && in xmlSchemaSAXHandleStartElementNs()
27462 NULL, ielem->nodeLine, attributes[j], attributes[j+2], 0, in xmlSchemaSAXHandleStartElementNs()
27464 if (ret == -1) { in xmlSchemaSAXHandleStartElementNs()
27476 if (ret == -1) { in xmlSchemaSAXHandleStartElementNs()
27487 vctxt->err = -1; in xmlSchemaSAXHandleStartElementNs()
27488 xmlStopParser(vctxt->parserCtxt); in xmlSchemaSAXHandleStartElementNs()
27504 if (vctxt->skipDepth != -1) { in xmlSchemaSAXHandleEndElementNs()
27505 if (vctxt->depth > vctxt->skipDepth) { in xmlSchemaSAXHandleEndElementNs()
27506 vctxt->depth--; in xmlSchemaSAXHandleEndElementNs()
27509 vctxt->skipDepth = -1; in xmlSchemaSAXHandleEndElementNs()
27514 if ((!xmlStrEqual(vctxt->inode->localName, localname)) || in xmlSchemaSAXHandleEndElementNs()
27515 (!xmlStrEqual(vctxt->inode->nsName, URI))) { in xmlSchemaSAXHandleEndElementNs()
27531 vctxt->err = -1; in xmlSchemaSAXHandleEndElementNs()
27532 xmlStopParser(vctxt->parserCtxt); in xmlSchemaSAXHandleEndElementNs()
27538 * Validation interfaces *
27546 * Create an XML Schemas validation context based on the given schema.
27548 * Returns the validation context or NULL in case of error
27557 xmlSchemaVErrMemory(NULL, "allocating validation context", NULL); in xmlSchemaNewValidCtxt()
27561 ret->type = XML_SCHEMA_CTXT_VALIDATOR; in xmlSchemaNewValidCtxt()
27562 ret->dict = xmlDictCreate(); in xmlSchemaNewValidCtxt()
27563 ret->nodeQNames = xmlSchemaItemListCreate(); in xmlSchemaNewValidCtxt()
27564 ret->schema = schema; in xmlSchemaNewValidCtxt()
27570 * @vctxt: the schema validation context
27580 if (vctxt->filename != NULL) in xmlSchemaValidateSetFilename()
27581 xmlFree(vctxt->filename); in xmlSchemaValidateSetFilename()
27583 vctxt->filename = (char *) xmlStrdup((const xmlChar *) filename); in xmlSchemaValidateSetFilename()
27585 vctxt->filename = NULL; in xmlSchemaValidateSetFilename()
27590 * @vctxt: the schema validation context
27592 * Free the resources associated to the schema validation context;
27606 vctxt->flags = 0; in xmlSchemaClearValidCtxt()
27607 vctxt->validationRoot = NULL; in xmlSchemaClearValidCtxt()
27608 vctxt->doc = NULL; in xmlSchemaClearValidCtxt()
27610 vctxt->reader = NULL; in xmlSchemaClearValidCtxt()
27612 vctxt->hasKeyrefs = 0; in xmlSchemaClearValidCtxt()
27614 if (vctxt->value != NULL) { in xmlSchemaClearValidCtxt()
27615 xmlSchemaFreeValue(vctxt->value); in xmlSchemaClearValidCtxt()
27616 vctxt->value = NULL; in xmlSchemaClearValidCtxt()
27621 if (vctxt->aidcs != NULL) { in xmlSchemaClearValidCtxt()
27622 xmlSchemaIDCAugPtr cur = vctxt->aidcs, next; in xmlSchemaClearValidCtxt()
27624 next = cur->next; in xmlSchemaClearValidCtxt()
27628 vctxt->aidcs = NULL; in xmlSchemaClearValidCtxt()
27630 if (vctxt->idcMatcherCache != NULL) { in xmlSchemaClearValidCtxt()
27631 xmlSchemaIDCMatcherPtr matcher = vctxt->idcMatcherCache, tmp; in xmlSchemaClearValidCtxt()
27635 matcher = matcher->nextCached; in xmlSchemaClearValidCtxt()
27638 vctxt->idcMatcherCache = NULL; in xmlSchemaClearValidCtxt()
27642 if (vctxt->idcNodes != NULL) { in xmlSchemaClearValidCtxt()
27646 for (i = 0; i < vctxt->nbIdcNodes; i++) { in xmlSchemaClearValidCtxt()
27647 item = vctxt->idcNodes[i]; in xmlSchemaClearValidCtxt()
27648 xmlFree(item->keys); in xmlSchemaClearValidCtxt()
27651 xmlFree(vctxt->idcNodes); in xmlSchemaClearValidCtxt()
27652 vctxt->idcNodes = NULL; in xmlSchemaClearValidCtxt()
27653 vctxt->nbIdcNodes = 0; in xmlSchemaClearValidCtxt()
27654 vctxt->sizeIdcNodes = 0; in xmlSchemaClearValidCtxt()
27657 if (vctxt->idcKeys != NULL) { in xmlSchemaClearValidCtxt()
27659 for (i = 0; i < vctxt->nbIdcKeys; i++) in xmlSchemaClearValidCtxt()
27660 xmlSchemaIDCFreeKey(vctxt->idcKeys[i]); in xmlSchemaClearValidCtxt()
27661 xmlFree(vctxt->idcKeys); in xmlSchemaClearValidCtxt()
27662 vctxt->idcKeys = NULL; in xmlSchemaClearValidCtxt()
27663 vctxt->nbIdcKeys = 0; in xmlSchemaClearValidCtxt()
27664 vctxt->sizeIdcKeys = 0; in xmlSchemaClearValidCtxt()
27670 if (vctxt->xpathStates != NULL) { in xmlSchemaClearValidCtxt()
27671 xmlSchemaFreeIDCStateObjList(vctxt->xpathStates); in xmlSchemaClearValidCtxt()
27672 vctxt->xpathStates = NULL; in xmlSchemaClearValidCtxt()
27677 if (vctxt->nbAttrInfos != 0) { in xmlSchemaClearValidCtxt()
27683 if (vctxt->elemInfos != NULL) { in xmlSchemaClearValidCtxt()
27687 for (i = 0; i < vctxt->sizeElemInfos; i++) { in xmlSchemaClearValidCtxt()
27688 ei = vctxt->elemInfos[i]; in xmlSchemaClearValidCtxt()
27694 xmlSchemaItemListClear(vctxt->nodeQNames); in xmlSchemaClearValidCtxt()
27696 xmlDictFree(vctxt->dict); in xmlSchemaClearValidCtxt()
27701 vctxt->dict = xmlDictCreate(); in xmlSchemaClearValidCtxt()
27703 if (vctxt->filename != NULL) { in xmlSchemaClearValidCtxt()
27704 xmlFree(vctxt->filename); in xmlSchemaClearValidCtxt()
27705 vctxt->filename = NULL; in xmlSchemaClearValidCtxt()
27711 * @ctxt: the schema validation context
27713 * Free the resources associated to the schema validation context
27720 if (ctxt->value != NULL) in xmlSchemaFreeValidCtxt()
27721 xmlSchemaFreeValue(ctxt->value); in xmlSchemaFreeValidCtxt()
27722 if (ctxt->pctxt != NULL) in xmlSchemaFreeValidCtxt()
27723 xmlSchemaFreeParserCtxt(ctxt->pctxt); in xmlSchemaFreeValidCtxt()
27724 if (ctxt->idcNodes != NULL) { in xmlSchemaFreeValidCtxt()
27728 for (i = 0; i < ctxt->nbIdcNodes; i++) { in xmlSchemaFreeValidCtxt()
27729 item = ctxt->idcNodes[i]; in xmlSchemaFreeValidCtxt()
27730 xmlFree(item->keys); in xmlSchemaFreeValidCtxt()
27733 xmlFree(ctxt->idcNodes); in xmlSchemaFreeValidCtxt()
27735 if (ctxt->idcKeys != NULL) { in xmlSchemaFreeValidCtxt()
27737 for (i = 0; i < ctxt->nbIdcKeys; i++) in xmlSchemaFreeValidCtxt()
27738 xmlSchemaIDCFreeKey(ctxt->idcKeys[i]); in xmlSchemaFreeValidCtxt()
27739 xmlFree(ctxt->idcKeys); in xmlSchemaFreeValidCtxt()
27742 if (ctxt->xpathStates != NULL) { in xmlSchemaFreeValidCtxt()
27743 xmlSchemaFreeIDCStateObjList(ctxt->xpathStates); in xmlSchemaFreeValidCtxt()
27744 ctxt->xpathStates = NULL; in xmlSchemaFreeValidCtxt()
27746 if (ctxt->xpathStatePool != NULL) { in xmlSchemaFreeValidCtxt()
27747 xmlSchemaFreeIDCStateObjList(ctxt->xpathStatePool); in xmlSchemaFreeValidCtxt()
27748 ctxt->xpathStatePool = NULL; in xmlSchemaFreeValidCtxt()
27754 if (ctxt->aidcs != NULL) { in xmlSchemaFreeValidCtxt()
27755 xmlSchemaIDCAugPtr cur = ctxt->aidcs, next; in xmlSchemaFreeValidCtxt()
27757 next = cur->next; in xmlSchemaFreeValidCtxt()
27762 if (ctxt->attrInfos != NULL) { in xmlSchemaFreeValidCtxt()
27767 if (ctxt->nbAttrInfos != 0) in xmlSchemaFreeValidCtxt()
27769 for (i = 0; i < ctxt->sizeAttrInfos; i++) { in xmlSchemaFreeValidCtxt()
27770 attr = ctxt->attrInfos[i]; in xmlSchemaFreeValidCtxt()
27773 xmlFree(ctxt->attrInfos); in xmlSchemaFreeValidCtxt()
27775 if (ctxt->elemInfos != NULL) { in xmlSchemaFreeValidCtxt()
27779 for (i = 0; i < ctxt->sizeElemInfos; i++) { in xmlSchemaFreeValidCtxt()
27780 ei = ctxt->elemInfos[i]; in xmlSchemaFreeValidCtxt()
27786 xmlFree(ctxt->elemInfos); in xmlSchemaFreeValidCtxt()
27788 if (ctxt->nodeQNames != NULL) in xmlSchemaFreeValidCtxt()
27789 xmlSchemaItemListFree(ctxt->nodeQNames); in xmlSchemaFreeValidCtxt()
27790 if (ctxt->dict != NULL) in xmlSchemaFreeValidCtxt()
27791 xmlDictFree(ctxt->dict); in xmlSchemaFreeValidCtxt()
27792 if (ctxt->filename != NULL) in xmlSchemaFreeValidCtxt()
27793 xmlFree(ctxt->filename); in xmlSchemaFreeValidCtxt()
27799 * @ctxt: the schema validation context
27801 * Check if any error was detected during validation.
27803 * Returns 1 if valid so far, 0 if errors were detected, and -1 in case
27810 return(-1); in xmlSchemaIsValid()
27811 return(ctxt->err == 0); in xmlSchemaIsValid()
27816 * @ctxt: a schema validation context
27830 ctxt->error = err; in xmlSchemaSetValidErrors()
27831 ctxt->warning = warn; in xmlSchemaSetValidErrors()
27832 ctxt->errCtxt = ctx; in xmlSchemaSetValidErrors()
27833 if (ctxt->pctxt != NULL) in xmlSchemaSetValidErrors()
27834 xmlSchemaSetParserErrors(ctxt->pctxt, err, warn, ctx); in xmlSchemaSetValidErrors()
27839 * @ctxt: a schema validation context
27851 ctxt->serror = serror; in xmlSchemaSetValidStructuredErrors()
27852 ctxt->error = NULL; in xmlSchemaSetValidStructuredErrors()
27853 ctxt->warning = NULL; in xmlSchemaSetValidStructuredErrors()
27854 ctxt->errCtxt = ctx; in xmlSchemaSetValidStructuredErrors()
27855 if (ctxt->pctxt != NULL) in xmlSchemaSetValidStructuredErrors()
27856 xmlSchemaSetParserStructuredErrors(ctxt->pctxt, serror, ctx); in xmlSchemaSetValidStructuredErrors()
27861 * @ctxt: a XML-Schema validation context
27868 * Returns -1 in case of error and 0 otherwise
27876 return (-1); in xmlSchemaGetValidErrors()
27878 *err = ctxt->error; in xmlSchemaGetValidErrors()
27880 *warn = ctxt->warning; in xmlSchemaGetValidErrors()
27882 *ctx = ctxt->errCtxt; in xmlSchemaGetValidErrors()
27889 * @ctxt: a schema validation context
27892 * Sets the options to be used during the validation.
27894 * Returns 0 in case of success, -1 in case of an
27905 return (-1); in xmlSchemaSetValidOptions()
27914 return (-1); in xmlSchemaSetValidOptions()
27916 ctxt->options = options; in xmlSchemaSetValidOptions()
27922 * @ctxt: a schema validation context
27924 * Get the validation context options.
27926 * Returns the option combination or -1 on error.
27933 return (-1); in xmlSchemaValidCtxtGetOptions()
27935 return (ctxt->options); in xmlSchemaValidCtxtGetOptions()
27948 if (vctxt->validationRoot != NULL) in xmlSchemaVDocWalk()
27949 valRoot = vctxt->validationRoot; in xmlSchemaVDocWalk()
27951 valRoot = xmlDocGetRootElement(vctxt->doc); in xmlSchemaVDocWalk()
27957 vctxt->depth = -1; in xmlSchemaVDocWalk()
27958 vctxt->validationRoot = valRoot; in xmlSchemaVDocWalk()
27961 if ((vctxt->skipDepth != -1) && (vctxt->depth >= vctxt->skipDepth)) in xmlSchemaVDocWalk()
27963 if (node->type == XML_ELEMENT_NODE) { in xmlSchemaVDocWalk()
27966 * Init the node-info. in xmlSchemaVDocWalk()
27968 vctxt->depth++; in xmlSchemaVDocWalk()
27969 if (xmlSchemaValidatorPushElem(vctxt) == -1) in xmlSchemaVDocWalk()
27971 ielem = vctxt->inode; in xmlSchemaVDocWalk()
27972 ielem->node = node; in xmlSchemaVDocWalk()
27973 ielem->nodeLine = node->line; in xmlSchemaVDocWalk()
27974 ielem->localName = node->name; in xmlSchemaVDocWalk()
27975 if (node->ns != NULL) in xmlSchemaVDocWalk()
27976 ielem->nsName = node->ns->href; in xmlSchemaVDocWalk()
27977 ielem->flags |= XML_SCHEMA_ELEM_INFO_EMPTY; in xmlSchemaVDocWalk()
27983 vctxt->nbAttrInfos = 0; in xmlSchemaVDocWalk()
27984 if (node->properties != NULL) { in xmlSchemaVDocWalk()
27985 attr = node->properties; in xmlSchemaVDocWalk()
27987 if (attr->ns != NULL) in xmlSchemaVDocWalk()
27988 nsName = attr->ns->href; in xmlSchemaVDocWalk()
27997 ielem->nodeLine, in xmlSchemaVDocWalk()
27998 attr->name, nsName, 0, in xmlSchemaVDocWalk()
27999 xmlNodeListGetString(attr->doc, attr->children, 1), 1); in xmlSchemaVDocWalk()
28000 if (ret == -1) { in xmlSchemaVDocWalk()
28005 attr = attr->next; in xmlSchemaVDocWalk()
28013 if (ret == -1) { in xmlSchemaVDocWalk()
28019 * Don't stop validation; just skip the content in xmlSchemaVDocWalk()
28024 if ((vctxt->skipDepth != -1) && in xmlSchemaVDocWalk()
28025 (vctxt->depth >= vctxt->skipDepth)) in xmlSchemaVDocWalk()
28027 } else if ((node->type == XML_TEXT_NODE) || in xmlSchemaVDocWalk()
28028 (node->type == XML_CDATA_SECTION_NODE)) { in xmlSchemaVDocWalk()
28032 if ((ielem != NULL) && (ielem->flags & XML_SCHEMA_ELEM_INFO_EMPTY)) in xmlSchemaVDocWalk()
28033 ielem->flags ^= XML_SCHEMA_ELEM_INFO_EMPTY; in xmlSchemaVDocWalk()
28034 ret = xmlSchemaVPushText(vctxt, node->type, node->content, in xmlSchemaVDocWalk()
28035 -1, XML_SCHEMA_PUSH_TEXT_PERSIST, NULL); in xmlSchemaVDocWalk()
28042 * DOC VAL TODO: Should we skip further validation of the in xmlSchemaVDocWalk()
28045 } else if ((node->type == XML_ENTITY_NODE) || in xmlSchemaVDocWalk()
28046 (node->type == XML_ENTITY_REF_NODE)) { in xmlSchemaVDocWalk()
28051 "there is at least one entity reference in the node-tree " in xmlSchemaVDocWalk()
28054 "substitute entities before validation."); in xmlSchemaVDocWalk()
28065 if (node->children != NULL) { in xmlSchemaVDocWalk()
28066 node = node->children; in xmlSchemaVDocWalk()
28070 if (node->type == XML_ELEMENT_NODE) { in xmlSchemaVDocWalk()
28074 if (node != vctxt->inode->node) { in xmlSchemaVDocWalk()
28091 if (node->next != NULL) in xmlSchemaVDocWalk()
28092 node = node->next; in xmlSchemaVDocWalk()
28094 node = node->parent; in xmlSchemaVDocWalk()
28102 return (-1); in xmlSchemaVDocWalk()
28110 vctxt->err = 0; in xmlSchemaPreRun()
28111 vctxt->nberrors = 0; in xmlSchemaPreRun()
28112 vctxt->depth = -1; in xmlSchemaPreRun()
28113 vctxt->skipDepth = -1; in xmlSchemaPreRun()
28114 vctxt->xsiAssemble = 0; in xmlSchemaPreRun()
28115 vctxt->hasKeyrefs = 0; in xmlSchemaPreRun()
28117 vctxt->createIDCNodeTables = 1; in xmlSchemaPreRun()
28119 vctxt->createIDCNodeTables = 0; in xmlSchemaPreRun()
28124 if (vctxt->schema == NULL) { in xmlSchemaPreRun()
28127 vctxt->xsiAssemble = 1; in xmlSchemaPreRun()
28134 if ((vctxt->pctxt == NULL) && in xmlSchemaPreRun()
28135 (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1)) in xmlSchemaPreRun()
28136 return (-1); in xmlSchemaPreRun()
28137 pctxt = vctxt->pctxt; in xmlSchemaPreRun()
28138 pctxt->xsiAssemble = 1; in xmlSchemaPreRun()
28142 vctxt->schema = xmlSchemaNewSchema(pctxt); in xmlSchemaPreRun()
28143 if (vctxt->schema == NULL) in xmlSchemaPreRun()
28144 return (-1); in xmlSchemaPreRun()
28148 pctxt->constructor = xmlSchemaConstructionCtxtCreate(pctxt->dict); in xmlSchemaPreRun()
28149 if (pctxt->constructor == NULL) in xmlSchemaPreRun()
28150 return(-1); in xmlSchemaPreRun()
28151 pctxt->constructor->mainSchema = vctxt->schema; in xmlSchemaPreRun()
28155 pctxt->ownsConstructor = 1; in xmlSchemaPreRun()
28161 xmlHashScan(vctxt->schema->schemasImports, xmlSchemaAugmentImportedIDC, in xmlSchemaPreRun()
28169 if (vctxt->xsiAssemble) { in xmlSchemaPostRun()
28170 if (vctxt->schema != NULL) { in xmlSchemaPostRun()
28171 xmlSchemaFree(vctxt->schema); in xmlSchemaPostRun()
28172 vctxt->schema = NULL; in xmlSchemaPostRun()
28184 return(-1); in xmlSchemaVStart()
28186 if (vctxt->doc != NULL) { in xmlSchemaVStart()
28188 * Tree validation. in xmlSchemaVStart()
28192 } else if (vctxt->reader != NULL) { in xmlSchemaVStart()
28194 * XML Reader validation. in xmlSchemaVStart()
28200 } else if ((vctxt->sax != NULL) && (vctxt->parserCtxt != NULL)) { in xmlSchemaVStart()
28202 * SAX validation. in xmlSchemaVStart()
28204 ret = xmlParseDocument(vctxt->parserCtxt); in xmlSchemaVStart()
28208 ret = -1; in xmlSchemaVStart()
28213 ret = vctxt->err; in xmlSchemaVStart()
28219 * @ctxt: a schema validation context
28225 * code number otherwise and -1 in case of an internal or API error.
28230 if ((ctxt == NULL) || (elem == NULL) || (elem->type != XML_ELEMENT_NODE)) in xmlSchemaValidateOneElement()
28231 return (-1); in xmlSchemaValidateOneElement()
28233 if (ctxt->schema == NULL) in xmlSchemaValidateOneElement()
28234 return (-1); in xmlSchemaValidateOneElement()
28236 ctxt->doc = elem->doc; in xmlSchemaValidateOneElement()
28237 ctxt->node = elem; in xmlSchemaValidateOneElement()
28238 ctxt->validationRoot = elem; in xmlSchemaValidateOneElement()
28244 * @ctxt: a schema validation context
28250 * number otherwise and -1 in case of internal or API error.
28256 return (-1); in xmlSchemaValidateDoc()
28258 ctxt->doc = doc; in xmlSchemaValidateDoc()
28259 ctxt->node = xmlDocGetRootElement(doc); in xmlSchemaValidateDoc()
28260 if (ctxt->node == NULL) { in xmlSchemaValidateDoc()
28265 return (ctxt->err); in xmlSchemaValidateDoc()
28267 ctxt->validationRoot = ctxt->node; in xmlSchemaValidateDoc()
28298 /* the block plugged back and validation informations */
28309 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in internalSubsetSplit()
28310 (ctxt->user_sax->internalSubset != NULL)) in internalSubsetSplit()
28311 ctxt->user_sax->internalSubset(ctxt->user_data, name, ExternalID, in internalSubsetSplit()
28319 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in isStandaloneSplit()
28320 (ctxt->user_sax->isStandalone != NULL)) in isStandaloneSplit()
28321 return(ctxt->user_sax->isStandalone(ctxt->user_data)); in isStandaloneSplit()
28329 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in hasInternalSubsetSplit()
28330 (ctxt->user_sax->hasInternalSubset != NULL)) in hasInternalSubsetSplit()
28331 return(ctxt->user_sax->hasInternalSubset(ctxt->user_data)); in hasInternalSubsetSplit()
28339 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in hasExternalSubsetSplit()
28340 (ctxt->user_sax->hasExternalSubset != NULL)) in hasExternalSubsetSplit()
28341 return(ctxt->user_sax->hasExternalSubset(ctxt->user_data)); in hasExternalSubsetSplit()
28350 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in externalSubsetSplit()
28351 (ctxt->user_sax->externalSubset != NULL)) in externalSubsetSplit()
28352 ctxt->user_sax->externalSubset(ctxt->user_data, name, ExternalID, in externalSubsetSplit()
28360 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in resolveEntitySplit()
28361 (ctxt->user_sax->resolveEntity != NULL)) in resolveEntitySplit()
28362 return(ctxt->user_sax->resolveEntity(ctxt->user_data, publicId, in resolveEntitySplit()
28371 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in getEntitySplit()
28372 (ctxt->user_sax->getEntity != NULL)) in getEntitySplit()
28373 return(ctxt->user_sax->getEntity(ctxt->user_data, name)); in getEntitySplit()
28381 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in getParameterEntitySplit()
28382 (ctxt->user_sax->getParameterEntity != NULL)) in getParameterEntitySplit()
28383 return(ctxt->user_sax->getParameterEntity(ctxt->user_data, name)); in getParameterEntitySplit()
28393 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in entityDeclSplit()
28394 (ctxt->user_sax->entityDecl != NULL)) in entityDeclSplit()
28395 ctxt->user_sax->entityDecl(ctxt->user_data, name, type, publicId, in entityDeclSplit()
28405 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in attributeDeclSplit()
28406 (ctxt->user_sax->attributeDecl != NULL)) { in attributeDeclSplit()
28407 ctxt->user_sax->attributeDecl(ctxt->user_data, elem, name, type, in attributeDeclSplit()
28419 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in elementDeclSplit()
28420 (ctxt->user_sax->elementDecl != NULL)) in elementDeclSplit()
28421 ctxt->user_sax->elementDecl(ctxt->user_data, name, type, content); in elementDeclSplit()
28429 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in notationDeclSplit()
28430 (ctxt->user_sax->notationDecl != NULL)) in notationDeclSplit()
28431 ctxt->user_sax->notationDecl(ctxt->user_data, name, publicId, in notationDeclSplit()
28441 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in unparsedEntityDeclSplit()
28442 (ctxt->user_sax->unparsedEntityDecl != NULL)) in unparsedEntityDeclSplit()
28443 ctxt->user_sax->unparsedEntityDecl(ctxt->user_data, name, publicId, in unparsedEntityDeclSplit()
28451 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in setDocumentLocatorSplit()
28452 (ctxt->user_sax->setDocumentLocator != NULL)) in setDocumentLocatorSplit()
28453 ctxt->user_sax->setDocumentLocator(ctxt->user_data, loc); in setDocumentLocatorSplit()
28460 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in startDocumentSplit()
28461 (ctxt->user_sax->startDocument != NULL)) in startDocumentSplit()
28462 ctxt->user_sax->startDocument(ctxt->user_data); in startDocumentSplit()
28469 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in endDocumentSplit()
28470 (ctxt->user_sax->endDocument != NULL)) in endDocumentSplit()
28471 ctxt->user_sax->endDocument(ctxt->user_data); in endDocumentSplit()
28479 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in processingInstructionSplit()
28480 (ctxt->user_sax->processingInstruction != NULL)) in processingInstructionSplit()
28481 ctxt->user_sax->processingInstruction(ctxt->user_data, target, data); in processingInstructionSplit()
28488 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in commentSplit()
28489 (ctxt->user_sax->comment != NULL)) in commentSplit()
28490 ctxt->user_sax->comment(ctxt->user_data, value); in commentSplit()
28500 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in warningSplit()
28501 (ctxt->user_sax->warning != NULL)) { in warningSplit()
28508 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in errorSplit()
28509 (ctxt->user_sax->error != NULL)) { in errorSplit()
28516 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in fatalErrorSplit()
28517 (ctxt->user_sax->fatalError != NULL)) { in fatalErrorSplit()
28532 if ((ctxt->user_sax != NULL) && (ctxt->user_sax->characters != NULL)) in charactersSplit()
28533 ctxt->user_sax->characters(ctxt->user_data, ch, len); in charactersSplit()
28534 if (ctxt->ctxt != NULL) in charactersSplit()
28535 xmlSchemaSAXHandleText(ctxt->ctxt, ch, len); in charactersSplit()
28544 if ((ctxt->user_sax != NULL) && in ignorableWhitespaceSplit()
28545 (ctxt->user_sax->ignorableWhitespace != NULL)) in ignorableWhitespaceSplit()
28546 ctxt->user_sax->ignorableWhitespace(ctxt->user_data, ch, len); in ignorableWhitespaceSplit()
28547 if (ctxt->ctxt != NULL) in ignorableWhitespaceSplit()
28548 xmlSchemaSAXHandleText(ctxt->ctxt, ch, len); in ignorableWhitespaceSplit()
28557 if ((ctxt->user_sax != NULL) && in cdataBlockSplit()
28558 (ctxt->user_sax->cdataBlock != NULL)) in cdataBlockSplit()
28559 ctxt->user_sax->cdataBlock(ctxt->user_data, value, len); in cdataBlockSplit()
28560 if (ctxt->ctxt != NULL) in cdataBlockSplit()
28561 xmlSchemaSAXHandleCDataSection(ctxt->ctxt, value, len); in cdataBlockSplit()
28570 if ((ctxt != NULL) && (ctxt->user_sax != NULL) && in referenceSplit()
28571 (ctxt->user_sax->reference != NULL)) in referenceSplit()
28572 ctxt->user_sax->reference(ctxt->user_data, name); in referenceSplit()
28573 if (ctxt->ctxt != NULL) in referenceSplit()
28574 xmlSchemaSAXHandleReference(ctxt->user_data, name); in referenceSplit()
28586 if ((ctxt->user_sax != NULL) && in startElementNsSplit()
28587 (ctxt->user_sax->startElementNs != NULL)) in startElementNsSplit()
28588 ctxt->user_sax->startElementNs(ctxt->user_data, localname, prefix, in startElementNsSplit()
28592 if (ctxt->ctxt != NULL) in startElementNsSplit()
28593 xmlSchemaSAXHandleStartElementNs(ctxt->ctxt, localname, prefix, in startElementNsSplit()
28605 if ((ctxt->user_sax != NULL) && in endElementNsSplit()
28606 (ctxt->user_sax->endElementNs != NULL)) in endElementNsSplit()
28607 ctxt->user_sax->endElementNs(ctxt->user_data, localname, prefix, URI); in endElementNsSplit()
28608 if (ctxt->ctxt != NULL) in endElementNsSplit()
28609 xmlSchemaSAXHandleEndElementNs(ctxt->ctxt, localname, prefix, URI); in endElementNsSplit()
28614 * @ctxt: a schema validation context
28618 * Plug a SAX based validation layer in a SAX parsing event flow.
28622 * Returns a pointer to a data structure needed to unplug the validation layer
28639 if ((old_sax != NULL) && (old_sax->initialized != XML_SAX2_MAGIC)) in xmlSchemaSAXPlug()
28642 (old_sax->startElementNs == NULL) && (old_sax->endElementNs == NULL) && in xmlSchemaSAXPlug()
28643 ((old_sax->startElement != NULL) || (old_sax->endElement != NULL))) in xmlSchemaSAXPlug()
28654 ret->magic = XML_SAX_PLUG_MAGIC; in xmlSchemaSAXPlug()
28655 ret->schemas_sax.initialized = XML_SAX2_MAGIC; in xmlSchemaSAXPlug()
28656 ret->ctxt = ctxt; in xmlSchemaSAXPlug()
28657 ret->user_sax_ptr = sax; in xmlSchemaSAXPlug()
28658 ret->user_sax = old_sax; in xmlSchemaSAXPlug()
28663 ret->schemas_sax.startElementNs = xmlSchemaSAXHandleStartElementNs; in xmlSchemaSAXPlug()
28664 ret->schemas_sax.endElementNs = xmlSchemaSAXHandleEndElementNs; in xmlSchemaSAXPlug()
28666 * Note that we use the same text-function for both, to prevent in xmlSchemaSAXPlug()
28669 ret->schemas_sax.ignorableWhitespace = xmlSchemaSAXHandleText; in xmlSchemaSAXPlug()
28670 ret->schemas_sax.characters = xmlSchemaSAXHandleText; in xmlSchemaSAXPlug()
28672 ret->schemas_sax.cdataBlock = xmlSchemaSAXHandleCDataSection; in xmlSchemaSAXPlug()
28673 ret->schemas_sax.reference = xmlSchemaSAXHandleReference; in xmlSchemaSAXPlug()
28675 ret->user_data = ctxt; in xmlSchemaSAXPlug()
28683 if (old_sax->internalSubset != NULL) in xmlSchemaSAXPlug()
28684 ret->schemas_sax.internalSubset = internalSubsetSplit; in xmlSchemaSAXPlug()
28685 if (old_sax->isStandalone != NULL) in xmlSchemaSAXPlug()
28686 ret->schemas_sax.isStandalone = isStandaloneSplit; in xmlSchemaSAXPlug()
28687 if (old_sax->hasInternalSubset != NULL) in xmlSchemaSAXPlug()
28688 ret->schemas_sax.hasInternalSubset = hasInternalSubsetSplit; in xmlSchemaSAXPlug()
28689 if (old_sax->hasExternalSubset != NULL) in xmlSchemaSAXPlug()
28690 ret->schemas_sax.hasExternalSubset = hasExternalSubsetSplit; in xmlSchemaSAXPlug()
28691 if (old_sax->resolveEntity != NULL) in xmlSchemaSAXPlug()
28692 ret->schemas_sax.resolveEntity = resolveEntitySplit; in xmlSchemaSAXPlug()
28693 if (old_sax->getEntity != NULL) in xmlSchemaSAXPlug()
28694 ret->schemas_sax.getEntity = getEntitySplit; in xmlSchemaSAXPlug()
28695 if (old_sax->entityDecl != NULL) in xmlSchemaSAXPlug()
28696 ret->schemas_sax.entityDecl = entityDeclSplit; in xmlSchemaSAXPlug()
28697 if (old_sax->notationDecl != NULL) in xmlSchemaSAXPlug()
28698 ret->schemas_sax.notationDecl = notationDeclSplit; in xmlSchemaSAXPlug()
28699 if (old_sax->attributeDecl != NULL) in xmlSchemaSAXPlug()
28700 ret->schemas_sax.attributeDecl = attributeDeclSplit; in xmlSchemaSAXPlug()
28701 if (old_sax->elementDecl != NULL) in xmlSchemaSAXPlug()
28702 ret->schemas_sax.elementDecl = elementDeclSplit; in xmlSchemaSAXPlug()
28703 if (old_sax->unparsedEntityDecl != NULL) in xmlSchemaSAXPlug()
28704 ret->schemas_sax.unparsedEntityDecl = unparsedEntityDeclSplit; in xmlSchemaSAXPlug()
28705 if (old_sax->setDocumentLocator != NULL) in xmlSchemaSAXPlug()
28706 ret->schemas_sax.setDocumentLocator = setDocumentLocatorSplit; in xmlSchemaSAXPlug()
28707 if (old_sax->startDocument != NULL) in xmlSchemaSAXPlug()
28708 ret->schemas_sax.startDocument = startDocumentSplit; in xmlSchemaSAXPlug()
28709 if (old_sax->endDocument != NULL) in xmlSchemaSAXPlug()
28710 ret->schemas_sax.endDocument = endDocumentSplit; in xmlSchemaSAXPlug()
28711 if (old_sax->processingInstruction != NULL) in xmlSchemaSAXPlug()
28712 ret->schemas_sax.processingInstruction = processingInstructionSplit; in xmlSchemaSAXPlug()
28713 if (old_sax->comment != NULL) in xmlSchemaSAXPlug()
28714 ret->schemas_sax.comment = commentSplit; in xmlSchemaSAXPlug()
28715 if (old_sax->warning != NULL) in xmlSchemaSAXPlug()
28716 ret->schemas_sax.warning = warningSplit; in xmlSchemaSAXPlug()
28717 if (old_sax->error != NULL) in xmlSchemaSAXPlug()
28718 ret->schemas_sax.error = errorSplit; in xmlSchemaSAXPlug()
28719 if (old_sax->fatalError != NULL) in xmlSchemaSAXPlug()
28720 ret->schemas_sax.fatalError = fatalErrorSplit; in xmlSchemaSAXPlug()
28721 if (old_sax->getParameterEntity != NULL) in xmlSchemaSAXPlug()
28722 ret->schemas_sax.getParameterEntity = getParameterEntitySplit; in xmlSchemaSAXPlug()
28723 if (old_sax->externalSubset != NULL) in xmlSchemaSAXPlug()
28724 ret->schemas_sax.externalSubset = externalSubsetSplit; in xmlSchemaSAXPlug()
28728 * Note that we use the same text-function for ignorableWhitespace in xmlSchemaSAXPlug()
28732 ret->schemas_sax.characters = charactersSplit; in xmlSchemaSAXPlug()
28733 if ((old_sax->ignorableWhitespace != NULL) && in xmlSchemaSAXPlug()
28734 (old_sax->ignorableWhitespace != old_sax->characters)) in xmlSchemaSAXPlug()
28735 ret->schemas_sax.ignorableWhitespace = ignorableWhitespaceSplit; in xmlSchemaSAXPlug()
28737 ret->schemas_sax.ignorableWhitespace = charactersSplit; in xmlSchemaSAXPlug()
28738 ret->schemas_sax.cdataBlock = cdataBlockSplit; in xmlSchemaSAXPlug()
28739 ret->schemas_sax.reference = referenceSplit; in xmlSchemaSAXPlug()
28740 ret->schemas_sax.startElementNs = startElementNsSplit; in xmlSchemaSAXPlug()
28741 ret->schemas_sax.endElementNs = endElementNsSplit; in xmlSchemaSAXPlug()
28743 ret->user_data_ptr = user_data; in xmlSchemaSAXPlug()
28744 ret->user_data = *user_data; in xmlSchemaSAXPlug()
28751 *sax = &(ret->schemas_sax); in xmlSchemaSAXPlug()
28752 ctxt->sax = *sax; in xmlSchemaSAXPlug()
28753 ctxt->flags |= XML_SCHEMA_VALID_CTXT_FLAG_STREAM; in xmlSchemaSAXPlug()
28762 * Unplug a SAX based validation layer in a SAX parsing event flow.
28765 * Returns 0 in case of success and -1 in case of failure.
28773 if ((plug == NULL) || (plug->magic != XML_SAX_PLUG_MAGIC)) in xmlSchemaSAXUnplug()
28774 return(-1); in xmlSchemaSAXUnplug()
28775 plug->magic = 0; in xmlSchemaSAXUnplug()
28777 xmlSchemaPostRun(plug->ctxt); in xmlSchemaSAXUnplug()
28779 sax = plug->user_sax_ptr; in xmlSchemaSAXUnplug()
28780 *sax = plug->user_sax; in xmlSchemaSAXUnplug()
28781 if (plug->user_sax != NULL) { in xmlSchemaSAXUnplug()
28782 user_data = plug->user_data_ptr; in xmlSchemaSAXUnplug()
28783 *user_data = plug->user_data; in xmlSchemaSAXUnplug()
28793 * @vctxt: a schema validation context
28797 * Allows to set a locator function to the validation context,
28799 * those are not provided as part of the SAX validation flow
28800 * Setting @f to NULL disable the locator.
28809 vctxt->locFunc = f; in xmlSchemaValidateSetLocator()
28810 vctxt->locCtxt = ctxt; in xmlSchemaValidateSetLocator()
28821 * Returns 0 in case the Schema validation could be (des)activated and
28822 * -1 in case of error.
28830 return(-1); in xmlSchemaValidateStreamLocator()
28838 if (ctxt->input != NULL) { in xmlSchemaValidateStreamLocator()
28840 *file = ctxt->input->filename; in xmlSchemaValidateStreamLocator()
28842 *line = ctxt->input->line; in xmlSchemaValidateStreamLocator()
28845 return(-1); in xmlSchemaValidateStreamLocator()
28850 * @ctxt: a schema validation context
28861 * number otherwise and -1 in case of internal or API error.
28875 return (-1); in xmlSchemaValidateStream()
28882 return (-1); in xmlSchemaValidateStream()
28883 old_sax = pctxt->sax; in xmlSchemaValidateStream()
28884 pctxt->sax = sax; in xmlSchemaValidateStream()
28885 pctxt->userData = user_data; in xmlSchemaValidateStream()
28890 pctxt->linenumbers = 1; in xmlSchemaValidateStream()
28895 ret = -1; in xmlSchemaValidateStream()
28899 ctxt->parserCtxt = pctxt; in xmlSchemaValidateStream()
28900 ctxt->input = input; in xmlSchemaValidateStream()
28903 * Plug the validation and launch the parsing in xmlSchemaValidateStream()
28905 plug = xmlSchemaSAXPlug(ctxt, &(pctxt->sax), &(pctxt->userData)); in xmlSchemaValidateStream()
28907 ret = -1; in xmlSchemaValidateStream()
28910 ctxt->input = input; in xmlSchemaValidateStream()
28911 ctxt->enc = enc; in xmlSchemaValidateStream()
28912 ctxt->sax = pctxt->sax; in xmlSchemaValidateStream()
28913 ctxt->flags |= XML_SCHEMA_VALID_CTXT_FLAG_STREAM; in xmlSchemaValidateStream()
28916 if ((ret == 0) && (! ctxt->parserCtxt->wellFormed)) { in xmlSchemaValidateStream()
28917 ret = ctxt->parserCtxt->errNo; in xmlSchemaValidateStream()
28923 ctxt->parserCtxt = NULL; in xmlSchemaValidateStream()
28924 ctxt->sax = NULL; in xmlSchemaValidateStream()
28925 ctxt->input = NULL; in xmlSchemaValidateStream()
28931 pctxt->sax = old_sax; in xmlSchemaValidateStream()
28939 * @ctxt: a schema validation context
28943 * Do a schemas validation of the given resource, it will use the
28944 * SAX streamable validation internally.
28947 * number otherwise and -1 in case of an internal or API error.
28958 return (-1); in xmlSchemaValidateFile()
28963 return (-1); in xmlSchemaValidateFile()
28971 * @ctxt: a schema validation context
28973 * allow access to the parser context of the schema validation context
28975 * Returns the parser context of the schema validation context or NULL
28983 return (ctxt->parserCtxt); in xmlSchemaValidCtxtGetParserCtxt()