• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/pyobjc-45/2.6/pyobjc/pyobjc-core/libxml2-src/

Lines Matching +defs:primitive +defs:type +defs:key

14  *     -> need a type equality operation.
16 * need to validate all schema attributes (ref, type, name)
199 (((i)->type == XML_SCHEMA_TYPE_SEQUENCE) || \
200 ((i)->type == XML_SCHEMA_TYPE_CHOICE) || \
201 ((i)->type == XML_SCHEMA_TYPE_ALL))
220 (( (i)->type == XML_SCHEMA_TYPE_BASIC) && \
224 (((i)->type == XML_SCHEMA_TYPE_COMPLEX) || \
228 ((item->type == XML_SCHEMA_TYPE_SIMPLE) || \
229 ((item->type == XML_SCHEMA_TYPE_BASIC) && \
233 (((i)->type == XML_SCHEMA_TYPE_BASIC) && \
243 (((i)->type != XML_SCHEMA_TYPE_BASIC) && \
247 (((item)->type != XML_SCHEMA_TYPE_BASIC) && \
316 #define IS_SCHEMA(node, type) \
318 (xmlStrEqual(node->name, (const xmlChar *) type)) && \
365 int type; /* E.g. XML_SCHEMA_CTXT_VALIDATOR */
385 int type; /* E.g. XML_SCHEMA_SCHEMA_IMPORT */
394 int type;
420 int type; /* Main OR import OR include. */
449 int type;
470 * The abstract base type for schema components.
475 xmlSchemaTypeType type;
481 * The abstract base type for annotated schema components.
487 xmlSchemaTypeType type;
494 * The abstract base type for tree-like structured schema components.
500 xmlSchemaTypeType type;
511 * The abstract base type for tree-like structured schema components.
517 xmlSchemaTypeType type;
542 xmlSchemaTypeType type; /* == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB */
588 int type;
621 xmlSchemaTypePtr ctxtType; /* The current context simple/complex type */
645 xmlSchemaTypeType type;
662 xmlSchemaTypeType type;
682 xmlSchemaTypeType type; /* XML_SCHEMA_TYPE_SEQUENCE, XML_SCHEMA_TYPE_CHOICE, XML_SCHEMA_TYPE_ALL */
700 xmlSchemaTypeType type; /* XML_SCHEMA_TYPE_GROUP */
724 int index; /* an index position if significant for IDC key-sequences */
737 xmlSchemaTypeType type;
766 * The key sequence of a node table item.
771 xmlSchemaTypePtr type;
800 xmlSchemaPSVIIDCNodePtr *nodeTable; /* array of key-sequences */
824 int type;
844 int type;
850 xmlSchemaPSVIIDCKeyPtr **keySeqs; /* the key-sequences of the target
887 xmlSchemaTypePtr typeDef; /* the complex/simple type definition if any */
946 xmlSchemaTypePtr typeDef; /* the complex/simple type definition if any */
965 int type;
984 /* xmlSchemaTypePtr type; */
1058 xmlSchemaTypeFixup(xmlSchemaTypePtr type,
1061 xmlSchemaFacetTypeToString(xmlSchemaTypeType type);
1071 xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type);
1074 xmlNodePtr node, xmlSchemaTypeType type,
1079 xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type);
1086 xmlSchemaTypePtr type,
1107 * @type: the type of the schema item
1112 xmlSchemaItemTypeToStr(xmlSchemaTypeType type)
1114 switch (type) {
1116 return(BAD_CAST "simple type definition");
1118 return(BAD_CAST "simple type definition");
1120 return(BAD_CAST "complex type definition");
1145 return(BAD_CAST "key identity-constraint");
1146 /* return(BAD_CAST "IDC (key)"); */
1163 * @type: the type of the schema item
1170 switch (item->type) {
1173 return(BAD_CAST "complex type definition");
1175 return(BAD_CAST "simple type definition");
1177 return(xmlSchemaItemTypeToStr(item->type));
1194 switch (item->type) {
1242 switch (item->type) {
1319 switch (item->type) {
1374 switch (item->type) {
1443 * @pc: the type of processContents
1445 * Returns a string representation of the type of
1467 * @ws: the whitespace type of the value
1473 * API errors or if the value type is not supported yet.
1581 switch (item->type) {
1583 xmlSchemaTypePtr type = WXS_TYPE_CAST item;
1585 if (WXS_IS_ATOMIC(type))
1586 *buf = xmlStrdup(BAD_CAST "atomic type 'xs:");
1587 else if (WXS_IS_LIST(type))
1588 *buf = xmlStrdup(BAD_CAST "list type 'xs:");
1589 else if (WXS_IS_UNION(type))
1590 *buf = xmlStrdup(BAD_CAST "union type 'xs:");
1592 *buf = xmlStrdup(BAD_CAST "simple type 'xs:");
1593 *buf = xmlStrcat(*buf, type->name);
1598 xmlSchemaTypePtr type = WXS_TYPE_CAST item;
1600 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) {
1605 if (WXS_IS_ATOMIC(type))
1606 *buf = xmlStrcat(*buf, BAD_CAST "atomic type");
1607 else if (WXS_IS_LIST(type))
1608 *buf = xmlStrcat(*buf, BAD_CAST "list type");
1609 else if (WXS_IS_UNION(type))
1610 *buf = xmlStrcat(*buf, BAD_CAST "union type");
1612 *buf = xmlStrcat(*buf, BAD_CAST "simple type");
1613 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) {
1615 *buf = xmlStrcat(*buf, type->name);
1621 xmlSchemaTypePtr type = WXS_TYPE_CAST item;
1623 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL)
1627 *buf = xmlStrcat(*buf, BAD_CAST "complex type");
1628 if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) {
1630 *buf = xmlStrcat(*buf, type->name);
1680 if (item->type == XML_SCHEMA_TYPE_IDC_UNIQUE)
1682 else if (item->type == XML_SCHEMA_TYPE_IDC_KEY)
1683 *buf = xmlStrdup(BAD_CAST "key '");
1708 *buf = xmlStrcat(*buf, xmlSchemaFacetTypeToString(item->type));
1741 if (itemNode->type == XML_ATTRIBUTE_NODE)
1755 if ((itemNode != NULL) && (itemNode->type == XML_ATTRIBUTE_NODE)) {
1773 * @type: the type holding the enumeration facets
1781 xmlChar **buf, xmlSchemaTypePtr type)
1794 * Use the whitespace type of the base type.
1796 ws = xmlSchemaGetWhiteSpaceFacetValue(type->baseType);
1797 for (facet = type->facets; facet != NULL; facet = facet->next) {
1798 if (facet->type != XML_SCHEMA_FACET_ENUMERATION)
1824 * The enumeration facet of a type restricts the enumeration
1825 * facet of the ancestor type; i.e., such restricted enumerations
1826 * do not belong to the set of the given type. Thus we break
1831 type = type->baseType;
1832 } while ((type != NULL) && (type->type != XML_SCHEMA_TYPE_BASIC));
2034 if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
2087 } else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) {
2157 (node->type != XML_ELEMENT_NODE) &&
2158 (node->type != XML_ATTRIBUTE_NODE))
2172 if (node->type == XML_ATTRIBUTE_NODE) {
2196 } else if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
2218 } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) {
2233 if ((type != NULL) && (xmlSchemaIsGlobalItem(type))) {
2236 NULL, type, NULL, 0));
2261 if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR)
2265 else if (actxt->type == XML_SCHEMA_CTXT_PARSER)
2305 (actxt->type == XML_SCHEMA_CTXT_PARSER)) {
2337 xmlSchemaTypePtr type ATTRIBUTE_UNUSED,
2362 xmlSchemaTypePtr type ATTRIBUTE_UNUSED,
2387 return (node->type);
2388 if ((actxt->type == XML_SCHEMA_CTXT_VALIDATOR) &&
2397 switch (item->type) {
2427 xmlSchemaTypePtr type,
2441 if (! xmlSchemaIsGlobalItem(type))
2446 if (WXS_IS_ATOMIC(type))
2447 msg = xmlStrcat(msg, BAD_CAST "atomic type");
2448 else if (WXS_IS_LIST(type))
2449 msg = xmlStrcat(msg, BAD_CAST "list type");
2450 else if (WXS_IS_UNION(type))
2451 msg = xmlStrcat(msg, BAD_CAST "union type");
2453 if (xmlSchemaIsGlobalItem(type)) {
2456 if (type->builtInType != 0) {
2458 msg = xmlStrcat(msg, type->name);
2462 type->targetNamespace, type->name));
2511 xmlSchemaTypePtr type ATTRIBUTE_UNUSED,
2613 xmlSchemaTypePtr type,
2631 facetType = facet->type;
2678 xmlSchemaFormatFacetEnumSet(actxt, &str, type));
2730 #define VERROR(err, type, msg) \
2731 xmlSchemaCustomErr(ACTXT_CAST vctxt, err, NULL, type, msg, NULL, NULL);
2749 * @type: the corresponding type of the attribute node
2950 * @itemDes: the designation of the schema type
2951 * @item: the schema type
2952 * @itemElem: the node of the schema type
2989 * @type: the schema type
2990 * @baseType: the base type of type
2998 xmlSchemaTypePtr type,
3004 xmlSchemaFormatItemForReport(&des, NULL, WXS_BASIC_CAST type, type->node);
3005 xmlSchemaPErrExt(ctxt, type->node, error, NULL, NULL, NULL,
3007 "type %s.\n",
3008 BAD_CAST des, xmlSchemaFacetTypeToString(facet->type),
3028 xmlSchemaTypePtr type,
3033 xmlSchemaFormatItemForReport(&des, NULL, WXS_BASIC_CAST type,
3034 type->node);
3035 xmlSchemaPErr(ctxt, type->node, error,
3037 BAD_CAST des, xmlSchemaFacetTypeToString(facet->type));
3047 * @type: the corresponding type of the attribute node
3072 * @type: the type specifier
3078 * Reports a simple type validation error.
3086 xmlSchemaTypePtr type,
3100 if (type != NULL) {
3101 if (node->type == XML_ATTRIBUTE_NODE)
3106 if (! xmlSchemaIsGlobalItem(type))
3111 if (WXS_IS_ATOMIC(type))
3112 msg = xmlStrcat(msg, BAD_CAST "atomic type");
3113 else if (WXS_IS_LIST(type))
3114 msg = xmlStrcat(msg, BAD_CAST "list type");
3115 else if (WXS_IS_UNION(type))
3116 msg = xmlStrcat(msg, BAD_CAST "union type");
3118 if (xmlSchemaIsGlobalItem(type)) {
3121 if (type->builtInType != 0) {
3123 msg = xmlStrcat(msg, type->name);
3127 type->targetNamespace, type->name));
3132 if (node->type == XML_ATTRIBUTE_NODE)
3144 if (node->type == XML_ATTRIBUTE_NODE)
3480 * @annot: a schema type structure
3518 if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) {
3527 int type, const xmlChar *targetNamespace)
3540 if (WXS_IS_BUCKET_INCREDEF(type))
3551 ret->type = type;
3570 if (WXS_IS_BUCKET_INCREDEF(type)) {
3576 /* Force the type to be XML_SCHEMA_SCHEMA_MAIN. */
3577 ret->type = XML_SCHEMA_SCHEMA_MAIN;
3586 if (type == XML_SCHEMA_SCHEMA_MAIN) {
3591 } else if (type == XML_SCHEMA_SCHEMA_IMPORT) {
3604 if (WXS_IS_BUCKET_IMPMAIN(type)) {
3633 if (WXS_IS_BUCKET_IMPMAIN(WXS_CONSTRUCTOR(pctxt)->bucket->type))
3673 * @annot: a schema type structure
3829 * @alink: a type link
3937 * @type: a schema type structure
3942 xmlSchemaFreeType(xmlSchemaTypePtr type)
3944 if (type == NULL)
3946 if (type->annot != NULL)
3947 xmlSchemaFreeAnnot(type->annot);
3948 if (type->facets != NULL) {
3951 facet = type->facets;
3958 if (type->attrUses != NULL)
3959 xmlSchemaItemListFree((xmlSchemaItemListPtr) type->attrUses);
3960 if (type->memberTypes != NULL)
3961 xmlSchemaFreeTypeLinkList(type->memberTypes);
3962 if (type->facetSet != NULL) {
3965 link = type->facetSet;
3972 if (type->contModel != NULL)
3973 xmlRegFreeRegexp(type->contModel);
3974 xmlFree(type);
4019 switch (item->type) {
4074 "unexpected component type '%s'\n",
4146 xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output); /* forward */
4210 fprintf(output, " type: '%s' ", elem->namedType);
4286 switch (term->type) {
4318 ((term->type == XML_SCHEMA_TYPE_SEQUENCE) ||
4319 (term->type == XML_SCHEMA_TYPE_CHOICE) ||
4320 (term->type == XML_SCHEMA_TYPE_ALL)) &&
4353 if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
4358 } else if (use->type == XML_SCHEMA_EXTRA_QNAMEREF) {
4377 * @type: a type structure
4382 xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output)
4384 if (type == NULL) {
4389 if (type->name != NULL)
4390 fprintf(output, "'%s' ", type->name);
4393 if (type->targetNamespace != NULL)
4394 fprintf(output, "ns '%s' ", type->targetNamespace);
4395 switch (type->type) {
4424 fprintf(output, "[unknown type %d] ", type->type);
4428 switch (type->contentType) {
4455 if (type->base != NULL) {
4456 fprintf(output, " base type: '%s'", type->base);
4457 if (type->baseNs != NULL)
4458 fprintf(output, " ns '%s'\n", type->baseNs);
4462 if (type->attrUses != NULL)
4463 xmlSchemaAttrUsesDump(type->attrUses, output);
4464 if (type->annot != NULL)
4465 xmlSchemaAnnotDump(output, type->annot);
4467 if ((type->type == XML_SCHEMA_TYPE_COMPLEX) &&
4468 (type->subtypes != NULL)) {
4469 xmlSchemaContentModelDump((xmlSchemaParticlePtr) type->subtypes,
4525 xmlSchemaPSVIIDCKeyPtr key;
4543 key = tab->keys[j];
4544 if ((key != NULL) && (key->val != NULL)) {
4545 res = xmlSchemaGetCanonValue(key->val, &value);
4552 } else if (key != NULL)
4555 fprintf(output, "(key missing), ");
4565 key = tab->keys[j];
4566 if ((key != NULL) && (key->val != NULL)) {
4567 res = xmlSchemaGetCanonValue(key->val, &value);
4574 } else if (key != NULL)
4577 fprintf(output, "(key missing), ");
4754 * @name: the type's name
4755 * nsName: the type's namespace
4757 * Lookup a type in the schemas or the predefined types
4789 fprintf(stderr, "Unable to lookup type %s", name);
4791 fprintf(stderr, "Unable to lookup type %s:%s", name,
4975 (((n)->type == XML_TEXT_NODE) && (xmlSchemaIsBlank((n)->content, -1)))
5015 xmlSchemaTypeType type,
5032 if (ret->type == type) {
5033 switch (type) {
5083 type, name, nsName);
5121 ret->type = XML_SCHEMA_TYPE_NOTATION;
5158 ret->type = XML_SCHEMA_TYPE_ATTRIBUTE;
5198 ret->type = XML_SCHEMA_TYPE_ATTRIBUTE_USE;
5272 ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP;
5297 * @name: the type name
5298 * @namespace: the type namespace
5321 ret->type = XML_SCHEMA_TYPE_ELEMENT;
5348 xmlSchemaTypeType type,
5359 xmlSchemaPErrMemory(ctxt, "allocating type", NULL);
5363 ret->type = type;
5400 ret->type = XML_SCHEMA_EXTRA_QNAMEREF;
5425 ret->type = XML_SCHEMA_EXTRA_ATTR_USE_PROHIB;
5435 * @type: the "compositor" type of the model group
5446 xmlSchemaTypeType type,
5462 ret->type = type;
5465 if ((type == XML_SCHEMA_TYPE_SEQUENCE) ||
5466 (type == XML_SCHEMA_TYPE_CHOICE))
5503 ret->type = XML_SCHEMA_TYPE_PARTICLE;
5551 ret->type = XML_SCHEMA_TYPE_GROUP;
5613 ret->type = category;
5637 xmlSchemaTypeType type, xmlNodePtr node)
5650 ret->type = type;
5823 "The value '%s' of simple type 'xs:QName' has no "
5950 "type 'xs:ID'", value, NULL);
5960 NULL, NULL, "The value '%s' of simple type 'xs:ID' is "
6233 * @type: the built-in type to be validated against
6235 * Validates a value against the given built-in type.
6247 xmlSchemaTypePtr type)
6256 if ((pctxt == NULL) || (type == NULL) || (attr == NULL))
6258 if (type->type != XML_SCHEMA_TYPE_BASIC) {
6260 "the given type is not a built-in type");
6263 switch (type->builtInType) {
6269 ret = xmlSchemaValPredefTypeNode(type, value, NULL,
6274 "validation using the given type is not supported while "
6287 if (WXS_IS_LIST(type))
6293 type, NULL, value, NULL, NULL, NULL);
6305 * @type: the built-in type to be validated against
6308 * Extracts and validates a value against the given built-in type.
6319 xmlSchemaTypePtr type,
6324 if ((ctxt == NULL) || (type == NULL) || (attr == NULL))
6332 val, type));
6344 * @type: the built-in type to be validated against
6347 * Extracts and validates a value against the given built-in type.
6359 xmlSchemaTypePtr type,
6364 if ((ctxt == NULL) || (type == NULL)) {
6369 if (type->type != XML_SCHEMA_TYPE_BASIC) {
6375 "type '%s' is not a built-in type.\n",
6376 type->name, NULL);
6386 type, value));
6409 if (WXS_IS_BUCKET_IMPMAIN(rel->type) &&
6442 * @type: the hosting type where the attributes will be anchored
6608 * Returns the new type structure or NULL in case of error
6635 facet->type = XML_SCHEMA_FACET_MININCLUSIVE;
6637 facet->type = XML_SCHEMA_FACET_MINEXCLUSIVE;
6639 facet->type = XML_SCHEMA_FACET_MAXINCLUSIVE;
6641 facet->type = XML_SCHEMA_FACET_MAXEXCLUSIVE;
6643 facet->type = XML_SCHEMA_FACET_TOTALDIGITS;
6645 facet->type = XML_SCHEMA_FACET_FRACTIONDIGITS;
6647 facet->type = XML_SCHEMA_FACET_PATTERN;
6649 facet->type = XML_SCHEMA_FACET_ENUMERATION;
6651 facet->type = XML_SCHEMA_FACET_WHITESPACE;
6653 facet->type = XML_SCHEMA_FACET_LENGTH;
6655 facet->type = XML_SCHEMA_FACET_MAXLENGTH;
6657 facet->type = XML_SCHEMA_FACET_MINLENGTH;
6660 "Unknown facet type %s\n", node->name, NULL);
6666 if ((facet->type != XML_SCHEMA_FACET_PATTERN) &&
6667 (facet->type != XML_SCHEMA_FACET_ENUMERATION)) {
7134 } else if (xmlStrEqual(attr->name, BAD_CAST "type")) {
7371 "pointless when extending a type",
7387 if ((use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) &&
7434 * form and type must be absent.
7451 * type and <simpleType> must not both be present.
7455 "The attribute 'type' and the <simpleType> child "
7546 (!xmlStrEqual(attr->name, BAD_CAST "type")))
7558 node, "type", &ret->typeNs, &ret->typeName);
7594 * type and <simpleType> must not both be present.
7598 "The attribute 'type' and the <simpleType> child "
7693 (pctxt->redef->item->type ==
8095 switch (annItem->type) {
8610 (!xmlStrEqual(attr->name, BAD_CAST "type")) &&
8709 attr = xmlSchemaGetPropNode(node, "type");
8740 * "type" and either <simpleType> or <complexType> are mutually
8747 "The attribute 'type' and the <complexType> child are "
8755 * "type" and either <simpleType> or <complexType> are
8762 "The attribute 'type' and the <simpleType> child are "
8769 (IS_SCHEMA(child, "key")) || (IS_SCHEMA(child, "keyref"))) {
8773 } else if (IS_SCHEMA(child, "key")) {
8792 "(unique | key | keyref)*))");
8836 xmlSchemaTypePtr type;
8844 type = ctxt->ctxtType;
8846 * Mark the simple type as being of variety "union".
8848 type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION;
8850 * SPEC (Base type) (2) "If the <list> or <union> alternative is chosen,
8851 * then the ���simple ur-type definition���."
8853 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE);
8885 type->base = cur;
8898 * Create the member type link.
8904 "allocating a type link", NULL);
8907 link->type = NULL;
8910 type->memberTypes = link;
8925 * later during fixup of the union simple type.
8927 link->type = (xmlSchemaTypePtr) ref;
8940 * Add the annotation to the simple type ancestor.
8942 xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type,
8951 * simple type.
8958 type->subtypes = subtype;
8974 if ((attr == NULL) && (type->subtypes == NULL)) {
9005 xmlSchemaTypePtr type;
9012 type = ctxt->ctxtType;
9014 * Mark the type as being of variety "list".
9016 type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
9018 * SPEC (Base type) (2) "If the <list> or <union> alternative is chosen,
9019 * then the ���simple ur-type definition���."
9021 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE);
9050 node, "itemType", &(type->baseNs), &(type->base));
9056 xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type,
9066 if (type->base != NULL) {
9073 type->subtypes = xmlSchemaParseSimpleType(ctxt, schema, child, 0);
9076 } else if (type->base == NULL) {
9088 if ((type->base == NULL) &&
9089 (type->subtypes == NULL) &&
9116 xmlSchemaTypePtr type, oldCtxtType;
9173 * Parse as local simple type definition.
9177 type = xmlSchemaAddType(ctxt, schema,
9182 type = xmlSchemaAddType(ctxt, schema,
9186 if (type == NULL)
9188 type->type = XML_SCHEMA_TYPE_SIMPLE;
9189 type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
9208 * Parse as global simple type definition.
9212 type = xmlSchemaAddType(ctxt, schema, XML_SCHEMA_TYPE_SIMPLE,
9214 if (type == NULL)
9216 type->type = XML_SCHEMA_TYPE_SIMPLE;
9217 type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
9218 type->flags |= XML_SCHEMAS_TYPE_GLOBAL;
9243 type->flags |= XML_SCHEMAS_TYPE_FINAL_RESTRICTION;
9245 type->flags |= XML_SCHEMAS_TYPE_FINAL_LIST;
9247 type->flags |= XML_SCHEMAS_TYPE_FINAL_UNION;
9250 if (xmlSchemaPValAttrBlockFinal(attrValue, &(type->flags),
9257 WXS_BASIC_CAST type, (xmlNodePtr) attr,
9263 type->targetNamespace = ctxt->targetNamespace;
9270 ctxt->ctxtType = type;
9274 type->annot = xmlSchemaParseAnnotation(ctxt, child, 1);
9312 return (type);
9532 if (cur->type == XML_TEXT_NODE) {
9538 } else if ((cur->type != XML_ELEMENT_NODE) &&
9539 (cur->type != XML_CDATA_SECTION_NODE)) {
9548 if ((cur->children->type != XML_ENTITY_DECL) &&
9549 (cur->children->type != XML_ENTITY_REF_NODE) &&
9550 (cur->children->type != XML_ENTITY_NODE)) {
9627 * Since the version is of type xs:token, we won't bother to
9932 ret->type = XML_SCHEMA_CTXT_PARSER;
10264 int type, /* import or include or redefine */
10283 switch (type) {
10301 if ((type == XML_SCHEMA_SCHEMA_MAIN) || (! WXS_HAS_BUCKETS(pctxt)))
10326 relation->type = type;
10331 if (WXS_IS_BUCKET_IMPMAIN(type)) {
10346 if ((WXS_IS_BUCKET_IMPMAIN(type)) && (! bkt->imported)) {
10362 } else if ((! WXS_IS_BUCKET_IMPMAIN(type)) && (bkt->imported)) {
10382 if (WXS_IS_BUCKET_IMPMAIN(type)) {
10614 * Note that we don't apply a type check for the
10624 bkt = xmlSchemaBucketCreate(pctxt, type,
10639 if (WXS_IS_BUCKET_IMPMAIN(type))
10838 int type)
10906 if (type == XML_SCHEMA_SCHEMA_REDEFINE) {
10933 int type)
10949 node, (xmlChar **) (&schemaLocation), type);
10955 res = xmlSchemaAddSchemaDoc(pctxt, type, schemaLocation, NULL,
10965 if (type == XML_SCHEMA_SCHEMA_INCLUDE) {
11075 if (type == XML_SCHEMA_SCHEMA_REDEFINE) {
11121 if (type == XML_SCHEMA_SCHEMA_REDEFINE) {
11171 * @type: the "compositor" type
11193 xmlNodePtr node, xmlSchemaTypeType type,
11207 item = xmlSchemaAddModelGroup(ctxt, schema, type, node);
11212 if (type == XML_SCHEMA_TYPE_ALL) {
11278 if (type == XML_SCHEMA_TYPE_ALL) {
11348 (ctxt->redef->item->type == XML_SCHEMA_TYPE_GROUP) &&
11455 * Returns the type definition or NULL in case of error
11461 xmlSchemaTypePtr type;
11468 type = ctxt->ctxtType;
11469 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
11496 * Extract the base type. The "base" attribute is mandatory if inside
11497 * a complex type or if redefining.
11500 * among its [children]), the simple type definition which is
11501 * the {content type} of the type definition ���resolved��� to by
11505 &(type->baseNs), &(type->base)) == 0)
11507 if ((type->base == NULL) && (type->type == XML_SCHEMA_TYPE_COMPLEX)) {
11512 (type->flags & XML_SCHEMAS_TYPE_GLOBAL))
11514 if (type->base == NULL) {
11518 } else if ((! xmlStrEqual(type->base, type->name)) ||
11519 (! xmlStrEqual(type->baseNs, type->targetNamespace)))
11532 "type's designation '%s'",
11533 xmlSchemaFormatQName(&str1, type->baseNs, type->base),
11534 xmlSchemaFormatQName(&str2, type->targetNamespace,
11535 type->name), NULL);
11539 type->base = NULL;
11540 type->baseNs = NULL;
11550 * Add the annotation to the simple type ancestor.
11552 xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type,
11561 if (type->base != NULL) {
11573 type->baseType = (xmlSchemaTypePtr)
11577 } else if (type->base == NULL) {
11592 type->subtypes = (xmlSchemaTypePtr)
11597 type->subtypes = (xmlSchemaTypePtr)
11602 type->subtypes = (xmlSchemaTypePtr)
11610 type->subtypes = (xmlSchemaTypePtr)
11622 * "1.1 the simple type definition corresponding to the <simpleType>
11627 * We will store the to-be-restricted simple type in
11628 * type->contentTypeDef *temporarily*.
11630 type->contentTypeDef = (xmlSchemaTypePtr)
11632 if ( type->contentTypeDef == NULL)
11647 * Add the facets to the simple type ancestor.
11669 type->facets = facet;
11680 if (type->facets != NULL) {
11683 facet = type->facets;
11695 type->facetSet = facetLink;
11703 if (type->type == XML_SCHEMA_TYPE_COMPLEX) {
11708 (xmlSchemaItemListPtr *) &(type->attrUses),
11715 type->attributeWildcard =
11736 /* Simple type */
11759 * TODO: Returns the type definition or NULL in case of error
11765 xmlSchemaTypePtr type;
11772 type = ctxt->ctxtType;
11773 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION;
11799 "base", &(type->baseNs), &(type->base)) == 0) &&
11800 (type->base == NULL)) {
11811 * Add the annotation to the type ancestor.
11813 xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type,
11824 type->subtypes = (xmlSchemaTypePtr)
11829 type->subtypes = (xmlSchemaTypePtr)
11834 type->subtypes = (xmlSchemaTypePtr)
11839 type->subtypes = (xmlSchemaTypePtr)
11853 (xmlSchemaItemListPtr *) &(type->attrUses),
11894 * Returns the type definition or NULL in case of error
11901 xmlSchemaTypePtr type;
11910 type = ctxt->ctxtType;
11911 type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
11937 * Add the annotation to the complex type ancestor.
11939 xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type,
11984 * Returns the type definition or NULL in case of error
11991 xmlSchemaTypePtr type;
12000 type = ctxt->ctxtType;
12023 * Set the 'mixed' on the complex type ancestor.
12026 if ((type->flags & XML_SCHEMAS_TYPE_MIXED) == 0)
12027 type->flags |= XML_SCHEMAS_TYPE_MIXED;
12032 * Add the annotation to the complex type ancestor.
12034 xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type,
12079 * Returns the type definition or NULL in case of error
12085 xmlSchemaTypePtr type, ctxtType;
12115 * Parse as local complex type definition.
12119 type = xmlSchemaAddType(ctxt, schema,
12124 type = xmlSchemaAddType(ctxt, schema,
12128 if (type == NULL)
12130 name = type->name;
12131 type->node = node;
12132 type->type = XML_SCHEMA_TYPE_COMPLEX;
12138 * Parse as global complex type definition.
12140 type = xmlSchemaAddType(ctxt, schema,
12143 if (type == NULL)
12145 type->node = node;
12146 type->type = XML_SCHEMA_TYPE_COMPLEX;
12147 type->flags |= XML_SCHEMAS_TYPE_GLOBAL;
12149 type->targetNamespace = ctxt->targetNamespace;
12167 type->flags |= XML_SCHEMAS_TYPE_MIXED;
12170 * Attributes of global complex type definitions.
12180 type->flags |= XML_SCHEMAS_TYPE_ABSTRACT;
12188 &(type->flags),
12207 if (xmlSchemaPValAttrBlockFinal(attrValue, &(type->flags),
12238 type->flags |= XML_SCHEMAS_TYPE_BLOCK_RESTRICTION;
12240 type->flags |= XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
12247 type->flags |= XML_SCHEMAS_TYPE_FINAL_RESTRICTION;
12249 type->flags |= XML_SCHEMAS_TYPE_FINAL_EXTENSION;
12256 type->annot = xmlSchemaParseAnnotation(ctxt, child, 1);
12259 ctxt->ctxtType = type;
12267 if (type->flags & XML_SCHEMAS_TYPE_MIXED)
12268 type->flags ^= XML_SCHEMAS_TYPE_MIXED;
12276 type->contentType = XML_SCHEMA_CONTENT_EMPTY;
12287 * for complex content restricting the ���ur-type definition���, and the
12290 type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE);
12291 type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
12296 type->subtypes = (xmlSchemaTypePtr)
12301 type->subtypes = (xmlSchemaTypePtr)
12306 type->subtypes = (xmlSchemaTypePtr)
12311 type->subtypes = (xmlSchemaTypePtr)
12323 (xmlSchemaItemListPtr *) &(type->attrUses),
12330 type->attributeWildcard = xmlSchemaParseAnyAttribute(ctxt, schema, child);
12352 return (type);
12709 * @name: the complex type's name whose content is being built
12711 * Create the automaton for the {content type} of a complex type.
12733 switch (particle->children->type) {
13098 "found unexpected term of type '%s' in content model",
13108 * @type: the complex type definition
13111 * Builds the content model of the complex type.
13114 xmlSchemaBuildContentModel(xmlSchemaTypePtr type,
13117 if ((type->type != XML_SCHEMA_TYPE_COMPLEX) ||
13118 (type->contModel != NULL) ||
13119 ((type->contentType != XML_SCHEMA_CONTENT_ELEMENTS) &&
13120 (type->contentType != XML_SCHEMA_CONTENT_MIXED)))
13131 "Cannot create automata for complex type %s\n", type->name);
13138 xmlSchemaBuildAContentModel(ctxt, WXS_TYPE_PARTICLE(type));
13140 type->contModel = xmlAutomataCompile(ctxt->am);
13141 if (type->contModel == NULL) {
13144 WXS_BASIC_CAST type, type->node,
13146 } else if (xmlRegexpIsDeterminist(type->contModel) != 1) {
13150 WXS_BASIC_CAST type, type->node,
13155 "Content model of %s:\n", type->name);
13156 xmlRegexpPrint(stderr, type->contModel);
13184 xmlSchemaTypePtr type;
13186 /* (type definition) ... otherwise the type definition ���resolved���
13187 * to by the ���actual value��� of the type [attribute] ...
13189 type = xmlSchemaGetType(ctxt->schema, elemDecl->namedType,
13191 if (type == NULL) {
13195 "type", elemDecl->namedType, elemDecl->namedTypeNs,
13196 XML_SCHEMA_TYPE_BASIC, "type definition");
13198 elemDecl->subtypes = type;
13223 * The type definitions is set to:
13224 * SPEC "...the {type definition} of the element
13233 * SPEC "The definition of anyType serves as the default type definition
13245 * @type: the schema simple type definition
13247 * Checks and builds the "member type definitions" property of the union
13248 * simple type. This handles part (1), part (2) is done in
13255 xmlSchemaTypePtr type)
13263 * define the explicit members as the type definitions ���resolved���
13265 * if any, followed by the type definitions corresponding to the
13271 link = type->memberTypes;
13276 name = ((xmlSchemaQNameRefPtr) link->type)->name;
13277 nsName = ((xmlSchemaQNameRefPtr) link->type)->targetNamespace;
13282 WXS_BASIC_CAST type, type->node, "memberTypes",
13285 * Remove the member type link.
13288 type->memberTypes = link->next;
13295 link->type = memberType;
13303 memberType = type->subtypes;
13307 xmlSchemaPErrMemory(ctxt, "allocating a type link", NULL);
13310 link->type = memberType;
13313 type->memberTypes = link;
13325 * @type: the type definition
13326 * @valType: the value type
13329 * Returns 1 if the type has the given value type, or
13330 * is derived from such a type.
13333 xmlSchemaIsDerivedFromBuiltInType(xmlSchemaTypePtr type, int valType)
13335 if (type == NULL)
13337 if (WXS_IS_COMPLEX(type))
13339 if (type->type == XML_SCHEMA_TYPE_BASIC) {
13340 if (type->builtInType == valType)
13342 if ((type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) ||
13343 (type->builtInType == XML_SCHEMAS_ANYTYPE))
13345 return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType));
13347 return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType));
13354 * @type: the type definition
13355 * @valType: the value type
13358 * Returns 1 if the type has the given value type, or
13359 * is derived from such a type.
13362 xmlSchemaIsUserDerivedFromBuiltInType(xmlSchemaTypePtr type, int valType)
13364 if (type == NULL)
13366 if (WXS_IS_COMPLEX(type))
13368 if (type->type == XML_SCHEMA_TYPE_BASIC) {
13369 if (type->builtInType == valType)
13373 return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType));
13379 xmlSchemaQueryBuiltInType(xmlSchemaTypePtr type)
13381 if (type == NULL)
13383 if (WXS_IS_COMPLEX(type))
13385 if (type->type == XML_SCHEMA_TYPE_BASIC)
13386 return(type);
13387 return(xmlSchemaQueryBuiltInType(type->subtypes));
13393 * @type: the simpleType definition
13395 * Returns the primitive type of the given type or
13399 xmlSchemaGetPrimitiveType(xmlSchemaTypePtr type)
13402 while (type != NULL) {
13404 * Note that anySimpleType is actually not a primitive type
13407 if ((type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) ||
13408 (type->flags & XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE))
13409 return (type);
13410 type = type->baseType;
13419 * @type: the simpleType definition
13421 * Returns the primitive type of the given type or
13425 xmlSchemaGetBuiltInTypeAncestor(xmlSchemaTypePtr type)
13427 if (WXS_IS_LIST(type) || WXS_IS_UNION(type))
13429 while (type != NULL) {
13430 if (type->type == XML_SCHEMA_TYPE_BASIC)
13431 return (type);
13432 type = type->baseType;
14076 * Checking complex type subsumption (practicalSubsumption) (1, 2 and 3)
14109 * uses} of the {base type definition} (call this B) whose
14143 * {type definition} must be validly derived from
14144 * B's {type definition} given the empty set as
14219 * (2.2) "otherwise the {base type definition} must have an
14247 * (3) "For each attribute use in the {attribute uses} of the {base type
14251 * uses} of the complex type definition itself whose {required} is true.
14300 * (4.1) "The {base type definition} must also have one."
14318 * (4.2) "The complex type definition's {attribute wildcard}'s
14319 * {namespace constraint} must be a subset of the {base type
14335 /* 4.3 Unless the {base type definition} is the ���ur-type
14336 * definition���, the complex type definition's {attribute
14338 * stronger than the {base type definition}'s {attribute
14371 * @type: the complex type definition
14374 * Builds the wildcard and the attribute uses on the given complex type.
14380 * NOTE: It is allowed to "extend" the xs:anyType type.
14384 xmlSchemaTypePtr type)
14390 if (type->baseType == NULL) {
14392 "no base type");
14395 baseType = type->baseType;
14400 uses = type->attrUses;
14408 if (WXS_IS_RESTRICTION(type)) {
14414 WXS_BASIC_CAST type, &(type->attributeWildcard), uses,
14424 WXS_BASIC_CAST type, &(type->attributeWildcard), uses,
14433 * Inherit the attribute uses of the base type.
14439 if (WXS_IS_RESTRICTION(type)) {
14481 type->attrUses = xmlSchemaItemListCreate();
14482 if (type->attrUses == NULL)
14484 uses = type->attrUses;
14494 type->attrUses = xmlSchemaItemListCreate();
14495 if (type->attrUses == NULL)
14497 uses = type->attrUses;
14509 type->attrUses = NULL;
14519 if (WXS_IS_EXTENSION(type)) {
14525 if (type->attributeWildcard != NULL) {
14536 if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard,
14544 type->attributeWildcard = baseType->attributeWildcard;
14571 * @type: the type definition
14574 * Evaluates if a type definition contains the given "final".
14577 * Returns 1 if the type does containt the given "final",
14581 xmlSchemaTypeFinalContains(xmlSchemaTypePtr type, int final)
14583 if (type == NULL)
14585 if (type->flags & final)
14593 * @type: the Union Simple Type
14595 * Returns a list of member types of @type if existing,
14599 xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type)
14601 while ((type != NULL) && (type->type == XML_SCHEMA_TYPE_SIMPLE)) {
14602 if (type->memberTypes != NULL)
14603 return (type->memberTypes);
14605 type = type->baseType;
14625 if (particle->children->type == XML_SCHEMA_TYPE_CHOICE) {
14633 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) ||
14634 (part->children->type == XML_SCHEMA_TYPE_ANY))
14654 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) ||
14655 (part->children->type == XML_SCHEMA_TYPE_ANY))
14681 if (particle->children->type == XML_SCHEMA_TYPE_CHOICE) {
14689 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) ||
14690 (part->children->type == XML_SCHEMA_TYPE_ANY))
14710 if ((part->children->type == XML_SCHEMA_TYPE_ELEMENT) ||
14711 (part->children->type == XML_SCHEMA_TYPE_ANY))
14759 * @type: the derived simple type definition
14760 * @baseType: the base type definition
14766 * Checks wheter @type can be validly
14773 xmlSchemaTypePtr type,
14778 * 1 They are the same type definition.
14781 if (type == baseType)
14785 * of its own {base type definition};
14787 * NOTE that this will be used also via "xsi:type".
14789 * TODO: Revise this, it looks strange. How can the "type"
14792 if (WXS_IS_TYPE_NOT_FIXED(type))
14793 if (xmlSchemaTypeFixup(type, actxt) == -1)
14799 (xmlSchemaTypeFinalContains(type->baseType,
14804 if (type->baseType == baseType) {
14806 * 2.2.1 D's ���base type definition��� is B.
14811 * 2.2.2 D's ���base type definition��� is not the ���ur-type definition���
14815 if ((! WXS_IS_ANYTYPE(type->baseType)) &&
14816 (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType,
14821 * 2.2.3 D's {variety} is list or union and B is the ���simple ur-type
14825 (WXS_IS_LIST(type) || WXS_IS_UNION(type))) {
14829 * 2.2.4 B's {variety} is union and D is validly derived from a type
14830 * definition in B's {member type definitions} given the subset, as
14841 if (WXS_IS_TYPE_NOT_FIXED(cur->type))
14842 if (xmlSchemaTypeFixup(cur->type, actxt) == -1)
14845 type, cur->type, subset) == 0)
14849 * member-type.
14862 * @ctxtType: the type definition
14866 * Circular type definitions are not allowed.
14868 * Returns XML_SCHEMAP_ST_PROPS_CORRECT_2 if the given type is
14878 if ((ancestor == NULL) || (ancestor->type == XML_SCHEMA_TYPE_BASIC))
14903 * @item: the complex/simple type definition
14907 * Checks for circular type definitions.
14914 (item->type == XML_SCHEMA_TYPE_BASIC) ||
14922 * Simple Type Definition Representation OK (src-simple-type) 4
14924 * "4 Circular union type definition is disallowed. That is, if the
14944 memberType = member->type;
14946 (memberType->type != XML_SCHEMA_TYPE_BASIC)) {
14951 "The union type definition is circular", NULL);
14975 xmlSchemaTypePtr type)
14977 if (! WXS_IS_UNION(type))
14979 return(xmlSchemaCheckUnionTypeDefCircularRecur(pctxt, type,
14980 type->memberTypes));
14985 * @item: the complex/simple type definition
14989 * Resolvese type definition references
14999 * Resolve the base type.
15049 ((WXS_TYPE_CONTENTTYPE(typeDef))->type ==
15052 ((WXS_TYPE_PARTICLE_TERM(typeDef))->type ==
15086 if (WXS_MODELGROUPDEF_MODEL(groupDef)->type == XML_SCHEMA_TYPE_ALL) {
15091 * the {content type} of a complex type definition."
15112 * @type: the simple type definition
15122 xmlSchemaTypePtr type)
15124 xmlSchemaTypePtr baseType = type->baseType;
15131 * NOTE: This is somehow redundant, since we actually built a simple type
15134 /* Base type: If the datatype has been ���derived��� by ���restriction���
15145 WXS_BASIC_CAST type, NULL,
15146 "No base type existent", NULL);
15153 WXS_BASIC_CAST type, NULL,
15154 "The base type '%s' is not a simple type",
15159 if ( (WXS_IS_LIST(type) || WXS_IS_UNION(type)) &&
15160 (WXS_IS_RESTRICTION(type) == 0) &&
15164 WXS_BASIC_CAST type, NULL,
15165 "A type, derived by list or union, must have "
15166 "the simple ur-type definition as base type, not '%s'",
15174 if ((! WXS_IS_ATOMIC(type)) && (! WXS_IS_UNION(type)) &&
15175 (! WXS_IS_LIST(type))) {
15178 WXS_BASIC_CAST type, NULL,
15185 * 3 The {final} of the {base type definition} must not contain restriction.
15191 WXS_BASIC_CAST type, NULL,
15192 "The 'final' of its base type '%s' must not contain "
15200 * 2 All simple type definitions must be derived ultimately from the ���simple
15201 * ur-type definition (so��� circular definitions are disallowed). That is, it
15202 * must be possible to reach a built-in primitive datatype or the ���simple
15203 * ur-type definition��� by repeatedly following the {base type definition}.
15213 * @type: the simple type definition
15218 * Checks if the given @type (simpleType) is derived validly by restriction.
15221 * Returns -1 on internal errors, 0 if the type is validly derived,
15226 xmlSchemaTypePtr type)
15230 if (type->type != XML_SCHEMA_TYPE_SIMPLE) {
15232 "given type is not a user-derived simpleType");
15236 if (WXS_IS_ATOMIC(type)) {
15237 xmlSchemaTypePtr primitive;
15239 * 1.1 The {base type definition} must be an atomic simple
15240 * type definition or a built-in primitive datatype.
15242 if (! WXS_IS_ATOMIC(type->baseType)) {
15245 WXS_BASIC_CAST type, NULL,
15246 "The base type '%s' is not an atomic simple type",
15247 xmlSchemaGetComponentQName(&str, type->baseType));
15251 /* 1.2 The {final} of the {base type definition} must not contain
15255 if (xmlSchemaTypeFinalContains(type->baseType,
15259 WXS_BASIC_CAST type, NULL,
15260 "The final of its base type '%s' must not contain 'restriction'",
15261 xmlSchemaGetComponentQName(&str, type->baseType));
15267 * 1.3.1 DF must be an allowed constraining facet for the {primitive
15268 * type definition}, as specified in the appropriate subsection of 3.2
15271 if (type->facets != NULL) {
15275 primitive = xmlSchemaGetPrimitiveType(type);
15276 if (primitive == NULL) {
15278 "failed to get primitive type");
15281 facet = type->facets;
15283 if (xmlSchemaIsBuiltInTypeFacet(primitive, facet->type) == 0) {
15287 type, primitive, facet);
15296 * of the {base type definition} (call this BF),then the DF's {value}
15303 } else if (WXS_IS_LIST(type)) {
15306 itemType = type->subtypes;
15309 "failed to evaluate the item type");
15315 * 2.1 The {item type definition} must have a {variety} of atomic or
15316 * union (in which case all the {member type definitions}
15323 WXS_BASIC_CAST type, NULL,
15324 "The item type '%s' does not have a variety of atomic or union",
15333 if (! WXS_IS_ATOMIC(member->type)) {
15336 WXS_BASIC_CAST type, NULL,
15337 "The item type is a union type, but the "
15338 "member type '%s' of this item type is not atomic",
15339 xmlSchemaGetComponentQName(&str, member->type));
15347 if (WXS_IS_ANY_SIMPLE_TYPE(type->baseType)) {
15354 * 2.3.1.1 The {final} of the {item type definition} must not
15361 WXS_BASIC_CAST type, NULL,
15362 "The final of its item type '%s' must not contain 'list'",
15373 if (type->facets != NULL) {
15374 facet = type->facets;
15376 if (facet->type != XML_SCHEMA_FACET_WHITESPACE) {
15379 type, facet);
15389 * a ���union��� datatype any of whose {member type definitions}'s
15399 * 2.3.2.1 The {base type definition} must have a {variety} of list.
15401 if (! WXS_IS_LIST(type->baseType)) {
15404 WXS_BASIC_CAST type, NULL,
15405 "The base type '%s' must be a list type",
15406 xmlSchemaGetComponentQName(&str, type->baseType));
15411 * 2.3.2.2 The {final} of the {base type definition} must not
15414 if (xmlSchemaTypeFinalContains(type->baseType,
15418 WXS_BASIC_CAST type, NULL,
15419 "The 'final' of the base type '%s' must not contain 'restriction'",
15420 xmlSchemaGetComponentQName(&str, type->baseType));
15425 * 2.3.2.3 The {item type definition} must be validly derived
15426 * from the {base type definition}'s {item type definition} given
15432 baseItemType = type->baseType->subtypes;
15435 "failed to eval the item type of a base type");
15444 WXS_BASIC_CAST type, NULL,
15445 "The item type '%s' is not validly derived from "
15446 "the item type '%s' of the base type '%s'",
15449 xmlSchemaGetComponentQName(&strBT, type->baseType));
15458 if (type->facets != NULL) {
15465 facet = type->facets;
15467 switch (facet->type) {
15482 type, facet);
15502 } else if (WXS_IS_UNION(type)) {
15504 * 3.1 The {member type definitions} must all have {variety} of
15509 member = type->memberTypes;
15511 if (WXS_IS_TYPE_NOT_FIXED(member->type))
15512 xmlSchemaTypeFixup(member->type, ACTXT_CAST pctxt);
15514 if ((! WXS_IS_ATOMIC(member->type)) &&
15515 (! WXS_IS_LIST(member->type))) {
15518 WXS_BASIC_CAST type, NULL,
15519 "The member type '%s' is neither an atomic, nor a list type",
15520 xmlSchemaGetComponentQName(&str, member->type));
15527 * 3.3.1 If the {base type definition} is the ���simple ur-type
15530 if (type->baseType->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) {
15532 * 3.3.1.1 All of the {member type definitions} must have a
15535 member = type->memberTypes;
15537 if (xmlSchemaTypeFinalContains(member->type,
15541 WXS_BASIC_CAST type, NULL,
15542 "The 'final' of member type '%s' contains 'union'",
15543 xmlSchemaGetComponentQName(&str, member->type));
15552 if (type->facetSet != NULL) {
15555 WXS_BASIC_CAST type, NULL,
15561 * 3.3.2.1 The {base type definition} must have a {variety} of union.
15564 if (! WXS_IS_UNION(type->baseType)) {
15567 WXS_BASIC_CAST type, NULL,
15568 "The base type '%s' is not a union type",
15569 xmlSchemaGetComponentQName(&str, type->baseType));
15574 * 3.3.2.2 The {final} of the {base type definition} must not contain restriction.
15576 if (xmlSchemaTypeFinalContains(type->baseType,
15580 WXS_BASIC_CAST type, NULL,
15581 "The 'final' of its base type '%s' must not contain 'restriction'",
15582 xmlSchemaGetComponentQName(&str, type->baseType));
15587 * 3.3.2.3 The {member type definitions}, in order, must be validly
15588 * derived from the corresponding type definitions in the {base
15589 * type definition}'s {member type definitions} given the empty set,
15596 * OPTIMIZE: if the type is restricting, it has no local defined
15597 * member types and inherits the member types of the base type;
15602 * union simple type can have other member types as the member
15603 * types of it's base type. This check seems not necessary with
15607 if (type->memberTypes != NULL) {
15608 member = type->memberTypes;
15609 baseMember = xmlSchemaGetUnionSimpleTypeMemberTypes(type->baseType);
15618 } else if ((member->type != baseMember->type) &&
15620 member->type, baseMember->type, 0) != 0)) {
15625 WXS_BASIC_CAST type, NULL,
15626 "The member type %s is not validly "
15628 "type %s of the base type %s",
15629 xmlSchemaGetComponentQName(&str, member->type),
15630 xmlSchemaGetComponentQName(&strBMT, baseMember->type),
15631 xmlSchemaGetComponentQName(&strBT, type->baseType));
15647 if (type->facets != NULL) {
15651 facet = type->facets;
15653 if ((facet->type != XML_SCHEMA_FACET_PATTERN) &&
15654 (facet->type != XML_SCHEMA_FACET_ENUMERATION)) {
15657 type, facet);
15681 * @type: the simple type definition
15683 * Checks crc-simple-type constraints.
15692 xmlSchemaTypePtr type)
15695 * src-simple-type.1 The corresponding simple type definition, if any,
15699 if (WXS_IS_RESTRICTION(type)) {
15701 * src-simple-type.2 "If the <restriction> alternative is chosen,
15709 } else if (WXS_IS_LIST(type)) {
15710 /* src-simple-type.3 "If the <list> alternative is chosen, either it must have
15716 } else if (WXS_IS_UNION(type)) {
15718 * src-simple-type.4 is checked in xmlSchemaCheckUnionTypeDefCircular().
15750 xmlSchemaTypePtr type,
15760 * @type: the simple type definition
15776 xmlSchemaTypePtr type,
15785 * For a string to be a valid default with respect to a type
15788 if WXS_IS_COMPLEX(type) {
15790 * Complex type.
15792 * SPEC (2.1) "its {content type} must be a simple type definition
15794 * SPEC (2.2.2) "If the {content type} is mixed, then the {content
15795 * type}'s particle must be ���emptiable��� as defined by
15798 if ((! WXS_HAS_SIMPLE_CONTENT(type)) &&
15799 ((! WXS_HAS_MIXED_CONTENT(type)) || (! WXS_EMPTIABLE(type)))) {
15803 WXS_BASIC_CAST type, type->node,
15804 "For a string to be a valid default, the type definition "
15805 "must be a simple type or a complex type with mixed content "
15811 * 1 If the type definition is a simple type definition, then the string
15817 * 2.2.1 If the {content type} is a simple type definition, then the
15818 * string must be ���valid��� with respect to that simple type definition
15821 if (WXS_IS_SIMPLE(type))
15823 type, value, val, 1, 1, 0);
15824 else if (WXS_HAS_SIMPLE_CONTENT(type))
15826 type->contentTypeDef, value, val, 1, 1, 0);
15841 * @type: the complex type definition
15853 xmlSchemaTypePtr type)
15858 * SPEC (1) "The values of the properties of a complex type definition must
15863 if ((type->baseType != NULL) &&
15864 (WXS_IS_SIMPLE(type->baseType)) &&
15865 (WXS_IS_EXTENSION(type) == 0)) {
15867 * SPEC (2) "If the {base type definition} is a simple type definition,
15872 NULL, WXS_BASIC_CAST type,
15873 "If the base type is a simple type, the derivation method must be "
15878 * SPEC (3) "Circular definitions are disallowed, except for the ���ur-type
15879 * definition���. That is, it must be possible to reach the ���ur-type
15880 * definition by repeatedly following the {base type definition}."
15890 if (type->attrUses &&
15891 (((xmlSchemaItemListPtr) type->attrUses)->nbItems > 1))
15893 xmlSchemaItemListPtr uses = (xmlSchemaItemListPtr) type->attrUses;
15918 NULL, WXS_BASIC_CAST type,
15935 * {attribute uses} must not have {type definition}s which
15947 NULL, WXS_BASIC_CAST type,
15949 "declaration of type 'xs:ID' "
15986 * @type: the to-be derived complex type definition
15987 * @baseType: the base complex type definition
16000 xmlSchemaTypePtr type,
16004 int equal = xmlSchemaAreEqualTypes(type, baseType);
16007 * SPEC "For a complex type definition (call it D, for derived)
16008 * to be validly derived from a type definition (call this
16014 * SPEC (1) "If B and D are not the same type definition, then the
16017 if (((set & SUBSET_EXTENSION) && (WXS_IS_EXTENSION(type))) ||
16018 ((set & SUBSET_RESTRICTION) && (WXS_IS_RESTRICTION(type))))
16022 * SPEC (2.1) "B and D must be the same type definition."
16027 * SPEC (2.2) "B must be D's {base type definition}."
16029 if (type->baseType == baseType)
16032 * SPEC (2.3.1) "D's {base type definition} must not be the ���ur-type
16035 if (WXS_IS_ANYTYPE(type->baseType))
16038 if (WXS_IS_COMPLEX(type->baseType)) {
16040 * SPEC (2.3.2.1) "If D's {base type definition} is complex, then it
16044 return (xmlSchemaCheckCOSCTDerivedOK(actxt, type->baseType,
16048 * SPEC (2.3.2.2) "If D's {base type definition} is simple, then it
16052 return (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType,
16059 * @type: the derived simple type definition
16060 * @baseType: the base type definition
16065 * Checks wheter @type can be validly derived from @baseType.
16071 xmlSchemaTypePtr type,
16075 if (WXS_IS_SIMPLE(type))
16076 return (xmlSchemaCheckCOSSTDerivedOK(actxt, type, baseType, set));
16078 return (xmlSchemaCheckCOSCTDerivedOK(actxt, type, baseType, set));
16084 * @type: the complex type definition
16100 xmlSchemaTypePtr type)
16102 xmlSchemaTypePtr base = type->baseType;
16108 * SPEC (1) "If the {base type definition} is a complex type definition,
16113 * SPEC (1.1) "The {final} of the {base type definition} must not
16119 WXS_BASIC_CAST type, NULL,
16120 "The 'final' of the base type definition "
16136 * of the complex type definition itself, that is, for every attribute
16137 * use in the {attribute uses} of the {base type definition}, there
16139 * type definition itself whose {attribute declaration} has the same
16140 * {name}, {target namespace} and {type definition} as its attribute
16150 if (type->attrUses != NULL) {
16151 use = (WXS_LIST_CAST type->attrUses)->items[j];
16152 for (j = 0; j < (WXS_LIST_CAST type->attrUses)->nbItems; j ++)
16171 NULL, WXS_BASIC_CAST type,
16174 * type needs to be the same.
16176 "This type is missing a matching correspondent "
16177 "for its {base type}'s %s in its {attribute uses}",
16186 * SPEC (1.3) "If it has an {attribute wildcard}, the complex type
16187 * definition must also have one, and the base type definition's
16189 * of the complex type definition's {attribute wildcard}'s {namespace
16195 * if created the type via a schema construction API.
16198 if (type->attributeWilcard == NULL) {
16203 NULL, type,
16205 "but this type is missing an attribute wildcard",
16210 base->attributeWildcard, type->attributeWildcard))
16216 NULL, type,
16227 if ((type->contentTypeDef != NULL) &&
16228 (type->contentTypeDef == base->contentTypeDef)) {
16230 * SPEC (1.4.1) "The {content type} of the {base type definition}
16231 * and the {content type} of the complex type definition itself
16232 * must be the same simple type definition"
16235 } else if ((type->contentType == XML_SCHEMA_CONTENT_EMPTY) &&
16238 * SPEC (1.4.2) "The {content type} of both the {base type
16239 * definition} and the complex type definition itself must
16247 if (type->subtypes == NULL) {
16249 * SPEC 1.4.3.1 The {content type} of the complex type
16254 WXS_BASIC_CAST type, NULL,
16255 "The content type must specify a particle", NULL);
16263 * SPEC (1.4.3.2.1) "The {content type} of the {base type
16271 if ((type->contentType != base->contentType) ||
16272 ((type->contentType != XML_SCHEMA_CONTENT_MIXED) &&
16273 (type->contentType != XML_SCHEMA_CONTENT_ELEMENTS))) {
16275 * SPEC (1.4.3.2.2.1) "Both {content type}s must be mixed
16280 WXS_BASIC_CAST type, NULL,
16281 "The content type of both, the type and its base "
16282 "type, must either 'mixed' or 'element-only'", NULL);
16287 * complex type definition must be a ���valid extension���
16288 * of the {base type definition}'s particle, as defined
16295 * TODO: !! This is needed to be checked if redefining a type !!
16304 * SPEC (2) "If the {base type definition} is a simple type definition,
16307 if (type->contentTypeDef != base) {
16309 * SPEC (2.1) "The {content type} must be the same simple type
16314 WXS_BASIC_CAST type, NULL,
16315 "The content type must be the simple base type", NULL);
16320 * SPEC (2.2) "The {final} of the {base type definition} must not
16326 WXS_BASIC_CAST type, NULL,
16327 "The 'final' of the base type definition "
16338 * @type: the complex type definition
16350 * Validation Rule: Checking complex type subsumption
16357 xmlSchemaTypePtr type)
16365 base = type->baseType;
16369 type->node, WXS_BASIC_CAST type,
16370 "The base type must be a complex type", NULL, NULL);
16375 * SPEC (1) "The {base type definition} must be a complex type
16380 type->node, WXS_BASIC_CAST type,
16381 "The 'final' of the base type definition "
16393 WXS_BASIC_CAST type, WXS_BASIC_CAST base,
16394 type->attrUses, base->attrUses,
16395 type->attributeWildcard,
16405 * SPEC (5.1) "The {base type definition} must be the
16406 * ���ur-type definition���."
16409 } else if ((type->contentType == XML_SCHEMA_CONTENT_SIMPLE) ||
16410 (type->contentType == XML_SCHEMA_CONTENT_BASIC)) {
16412 * SPEC (5.2.1) "The {content type} of the complex type definition
16413 * must be a simple type definition"
16422 * SPEC (5.2.2.1) "The {content type} of the {base type
16423 * definition} must be a simple type definition from which
16424 * the {content type} is validly derived given the empty
16427 * ATTENTION TODO: This seems not needed if the type implicitely
16428 * derived from the base type.
16432 type->contentTypeDef, base->contentTypeDef, 0);
16440 NULL, WXS_BASIC_CAST type,
16441 "The {content type} %s is not validly derived from the "
16442 "base type's {content type} %s",
16444 type->contentTypeDef),
16455 * SPEC (5.2.2.2) "The {base type definition} must be mixed
16463 WXS_BASIC_CAST type, NULL,
16464 "The content type of the base type must be either "
16465 "a simple type or 'mixed' and an emptiable particle", NULL);
16468 } else if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) {
16470 * SPEC (5.3.1) "The {content type} of the complex type itself must
16475 * SPEC (5.3.2.1) "The {content type} of the {base type
16484 * SPEC (5.3.2.2) "The {content type} of the {base type
16492 WXS_BASIC_CAST type, NULL,
16493 "The content type of the base type must be either "
16498 } else if ((type->contentType == XML_SCHEMA_CONTENT_ELEMENTS) ||
16499 WXS_HAS_MIXED_CONTENT(type)) {
16501 * SPEC (5.4.1.1) "The {content type} of the complex type definition
16504 if (WXS_HAS_MIXED_CONTENT(type) && (! WXS_HAS_MIXED_CONTENT(base))) {
16506 * SPEC (5.4.1.2) "The {content type} of the complex type
16507 * definition itself and of the {base type definition} must be
16512 WXS_BASIC_CAST type, NULL,
16513 "If the content type is 'mixed', then the content type of the "
16514 "base type must also be 'mixed'", NULL);
16518 * SPEC (5.4.2) "The particle of the complex type definition itself
16520 * type} of the {base type definition} as defined in Particle Valid
16528 WXS_BASIC_CAST type, NULL,
16529 "The type is not a valid restriction of its base type", NULL);
16538 * @type: the complex type definition
16547 xmlSchemaTypePtr type)
16553 ret = xmlSchemaCheckCTPropsCorrect(ctxt, type);
16556 if (WXS_IS_EXTENSION(type))
16557 ret = xmlSchemaCheckCOSCTExtends(ctxt, type);
16559 ret = xmlSchemaCheckDerivationOKRestriction(ctxt, type);
16566 * @type: the complex type definition
16577 xmlSchemaTypePtr type)
16586 base = type->baseType;
16587 if (! WXS_HAS_SIMPLE_CONTENT(type)) {
16589 * 1 If the <complexContent> alternative is chosen, the type definition
16591 * must be a complex type definition;
16597 WXS_BASIC_CAST type, type->node,
16598 "If using <complexContent>, the base type is expected to be "
16599 "a complex type. The base type '%s' is a simple type",
16610 * 2.1 The type definition ���resolved��� to by the ���actual value��� of the
16614 if (WXS_IS_EXTENSION(type) == 0) {
16618 * chosen, a simple type definition.
16623 WXS_BASIC_CAST type, NULL,
16625 "type must be a complex type. The base type '%s' is "
16626 "a simple type",
16633 /* Base type is a complex type. */
16637 * 2.1.1 a complex type definition whose {content type} is a
16638 * simple type definition;
16643 WXS_BASIC_CAST type, NULL,
16645 "'%s', base type has no content type",
16646 type->name);
16650 (WXS_IS_RESTRICTION(type))) {
16654 * chosen, a complex type definition whose {content type}
16665 if (type->contentTypeDef == NULL) {
16675 WXS_BASIC_CAST type, NULL,
16678 "the base type '%s' is a complex type",
16690 if (WXS_IS_RESTRICTION(type)) {
16693 WXS_BASIC_CAST type, NULL,
16695 "base type must be a simple type or a complex type with "
16696 "mixed content and particle emptiable. The base type "
16703 WXS_BASIC_CAST type, NULL,
16705 "base type must be a simple type. The base type '%s' "
16706 "is a complex type",
16714 * SPEC (3) "The corresponding complex type definition component must
16733 * @type: the complex type definition
16842 * SPEC (3.2.5) "R's {type definition} is validly derived given
16843 * {extension, list, union} from B's {type definition}"
16971 * SPEC (3) "Unless B is the content model wildcard of the ���ur-type
16988 * @type: the complex type definition
17006 /*part = WXS_TYPE_PARTICLE(type);
17103 (r->children->type != b->children->type))
17127 "same type definition", \
17128 BAD_CAST xmlSchemaFacetTypeToString(fac1->type), \
17129 BAD_CAST xmlSchemaFacetTypeToString(fac2->type), NULL);
17141 "The base type's facet is 'fixed', thus the value must not " \
17155 msg = xmlStrcat(msg, xmlSchemaFacetTypeToString(facet1->type));
17167 msg = xmlStrcat(msg, xmlSchemaFacetTypeToString(facet2->type));
17169 msg = xmlStrcat(msg, BAD_CAST "' of the base type");
17190 xmlSchemaTypePtr type)
17192 xmlSchemaTypePtr base = type->baseType;
17196 fmaxlen = NULL, fminlen = NULL, /* facets of the current type */
17200 bfmaxlen = NULL, bfminlen = NULL, /* facets of the base type */
17211 * "If {variety} is atomic, the {primitive type definition}
17229 if ((type->facetSet == NULL) && (base->facetSet == NULL))
17232 last = type->facetSet;
17237 for (cur = type->facetSet; cur != NULL; cur = cur->next) {
17239 switch (facet->type) {
17264 switch (facet->type) {
17293 "the same type definition")
17647 * for validation, plus we need to use the base type of those
17651 * type level and ANDed at ancestor level. This will
17653 * of the type.
17661 if ((bfacet->type == XML_SCHEMA_FACET_PATTERN) ||
17662 (bfacet->type == XML_SCHEMA_FACET_ENUMERATION))
17665 * Search for a duplicate facet in the current type.
17667 link = type->facetSet;
17672 if (facet->type == bfacet->type) {
17673 switch (facet->type) {
17682 "the base type")
17712 type->facetSet = link;
17729 xmlSchemaTypePtr type)
17733 * The actual value is then formed by replacing any union type
17735 * {member type definitions}, in order.
17741 link = type->memberTypes;
17744 if (WXS_IS_TYPE_NOT_FIXED(link->type))
17745 xmlSchemaTypeFixup(link->type, ACTXT_CAST pctxt);
17747 if (WXS_IS_UNION(link->type)) {
17748 subLink = xmlSchemaGetUnionSimpleTypeMemberTypes(link->type);
17750 link->type = subLink->type;
17759 xmlSchemaPErrMemory(pctxt, "allocating a type link",
17763 newLink->type = subLink->type;
17779 xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type)
17783 has = (type->baseType->flags & XML_SCHEMAS_TYPE_HAS_FACETS) ? 1 : 0;
17785 needVal = (type->baseType->flags &
17787 normVal = (type->baseType->flags &
17790 if (type->facets != NULL) {
17793 for (fac = type->facets; fac != NULL; fac = fac->next) {
17794 switch (fac->type) {
17813 type->flags |= XML_SCHEMAS_TYPE_NORMVALUENEEDED;
17815 type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE;
17817 type->flags |= XML_SCHEMAS_TYPE_HAS_FACETS;
17819 if (has && (! needVal) && WXS_IS_ATOMIC(type)) {
17820 xmlSchemaTypePtr prim = xmlSchemaGetPrimitiveType(type);
17826 type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE;
17832 xmlSchemaTypeFixupWhitespace(xmlSchemaTypePtr type)
17839 if (WXS_IS_LIST(type)) {
17840 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE;
17842 } else if (WXS_IS_UNION(type))
17845 if (type->facetSet != NULL) {
17848 for (lin = type->facetSet; lin != NULL; lin = lin->next) {
17849 if (lin->facet->type == XML_SCHEMA_FACET_WHITESPACE) {
17852 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE;
17855 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_REPLACE;
17858 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE;
17875 for (anc = type->baseType; anc != NULL &&
17879 if (anc->type == XML_SCHEMA_TYPE_BASIC) {
17881 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_REPLACE;
17885 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE;
17888 type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE;
17898 xmlSchemaTypePtr type)
17900 if (type->type != XML_SCHEMA_TYPE_SIMPLE)
17902 if (! WXS_IS_TYPE_NOT_FIXED_1(type))
17904 type->flags |= XML_SCHEMAS_TYPE_FIXUP_1;
17906 if (WXS_IS_LIST(type)) {
17910 if (type->subtypes == NULL) {
17915 "list type has no item-type assigned");
17918 } else if (WXS_IS_UNION(type)) {
17922 if (type->memberTypes == NULL) {
17927 "union type has no member-types assigned");
17934 if (type->baseType == NULL) {
17936 "type has no base-type assigned");
17939 if (WXS_IS_TYPE_NOT_FIXED_1(type->baseType))
17940 if (xmlSchemaFixupSimpleTypeStageOne(pctxt, type->baseType) == -1)
17945 * {variety} of the {base type definition}.
17947 if (WXS_IS_ATOMIC(type->baseType))
17948 type->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
17949 else if (WXS_IS_LIST(type->baseType)) {
17950 type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
17954 type->subtypes = type->baseType->subtypes;
17955 } else if (WXS_IS_UNION(type->baseType)) {
17956 type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION;
17970 xmlSchemaTypePtr type)
17972 if (type->node != NULL) {
17975 type->node->doc->URL,
17976 xmlGetLineNo(type->node));
17980 if ((WXS_IS_SIMPLE(type)) || (WXS_IS_COMPLEX(type))) {
17981 switch (type->contentType) {
17996 type->subtypes))
18025 xmlSchemaTypePtr type)
18029 if (type->type != XML_SCHEMA_TYPE_SIMPLE)
18032 if (! WXS_IS_TYPE_NOT_FIXED(type))
18035 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
18036 type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
18038 if (type->baseType == NULL) {
18043 if (WXS_IS_TYPE_NOT_FIXED(type->baseType))
18044 xmlSchemaTypeFixup(type->baseType, ACTXT_CAST pctxt);
18046 * If a member type of a union is a union itself, we need to substitute
18047 * that member type for its member types.
18051 if ((type->memberTypes != NULL) &&
18052 (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1))
18055 * SPEC src-simple-type 1
18056 * "The corresponding simple type definition, if any, must satisfy
18064 res = xmlSchemaCheckSTPropsCorrect(pctxt, type);
18070 res = xmlSchemaCheckCOSSTRestricts(pctxt, type);
18077 * xmlSchemaPErr(ctxt, type->node,
18079 * "Simple type '%s' does not satisfy the constraints "
18080 * "on simple type definitions.\n",
18081 * type->name, NULL);
18087 res = xmlSchemaCheckFacetValues(type, pctxt);
18089 if ((type->facetSet != NULL) ||
18090 (type->baseType->facetSet != NULL)) {
18091 res = xmlSchemaDeriveAndValidateFacets(pctxt, type);
18097 res = xmlSchemaTypeFixupWhitespace(type);
18099 xmlSchemaTypeFixupOptimFacets(type);
18103 xmlSchemaDebugFixedType(pctxt, type);
18111 xmlSchemaDebugFixedType(pctxt, type);
18118 xmlSchemaTypePtr type)
18121 xmlSchemaTypePtr baseType = type->baseType;
18123 if (! WXS_IS_TYPE_NOT_FIXED(type))
18125 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
18132 * Fixup the base type.
18138 * Skip fixup if the base type is invalid.
18144 * This basically checks if the base type can be derived.
18146 res = xmlSchemaCheckSRCCT(pctxt, type);
18149 * Fixup the content type.
18151 if (type->contentType == XML_SCHEMA_CONTENT_SIMPLE) {
18157 (WXS_IS_RESTRICTION(type))) {
18164 * SPEC (1) If <restriction> + base type is <complexType>,
18165 * "whose own {content type} is a simple type..."
18167 if (type->contentTypeDef != NULL) {
18169 * SPEC (1.1) "the simple type definition corresponding to the
18175 contentBase = type->contentTypeDef;
18176 type->contentTypeDef = NULL;
18180 * among its [children]), the simple type definition which
18181 * is the {content type} of the ... base type."
18187 * "... a simple type definition which restricts the simple
18188 * type definition identified in clause 1.1 or clause 1.2
18191 * Create the anonymous simple type, which will be the content
18192 * type of the complex type.
18198 XML_SCHEMA_TYPE_SIMPLE, tmpname, type->targetNamespace,
18199 type->node, 0);
18202 XML_SCHEMA_TYPE_SIMPLE, NULL, type->targetNamespace,
18203 type->node, 0);
18211 content->type = XML_SCHEMA_TYPE_SIMPLE;
18217 content->facets = type->facets;
18218 type->facets = NULL;
18219 content->facetSet = type->facetSet;
18220 type->facetSet = NULL;
18222 type->contentTypeDef = content;
18226 * Fixup the newly created type. We don't need to check
18236 (WXS_IS_RESTRICTION(type))) {
18239 * an emptiable particle, then a simple type definition which
18242 if ((type->contentTypeDef == NULL) ||
18243 (type->contentTypeDef->baseType == NULL)) {
18249 WXS_BASIC_CAST type, NULL,
18251 "complex type '%s': the <simpleContent><restriction> "
18253 "by xmlSchemaCheckSRCCT()", type->name);
18256 } else if ((WXS_IS_COMPLEX(baseType)) && WXS_IS_EXTENSION(type)) {
18259 * <simpleType> content, "...then the {content type} of that
18260 * complex type definition"
18269 WXS_BASIC_CAST type, NULL,
18271 "complex type '%s': the <extension>ed base type is "
18272 "a complex type with no simple content type",
18273 type->name);
18276 type->contentTypeDef = baseType->contentTypeDef;
18277 } else if ((WXS_IS_SIMPLE(baseType)) && WXS_IS_EXTENSION(type)) {
18280 * "... then that simple type definition"
18282 type->contentTypeDef = baseType;
18289 WXS_BASIC_CAST type, NULL,
18291 "complex type '%s' with <simpleContent>: unhandled "
18292 "derivation case", type->name);
18298 (xmlSchemaParticlePtr) type->subtypes;
18310 ((particle->type == XML_SCHEMA_TYPE_PARTICLE) &&
18311 ((particle->children->type == XML_SCHEMA_TYPE_ALL) ||
18312 (particle->children->type == XML_SCHEMA_TYPE_SEQUENCE) ||
18313 ((particle->children->type == XML_SCHEMA_TYPE_CHOICE) &&
18316 if (type->flags & XML_SCHEMAS_TYPE_MIXED) {
18327 (particle->children->type != XML_SCHEMA_TYPE_SEQUENCE)) {
18332 type->node, 1, 1);
18340 XML_SCHEMA_TYPE_SEQUENCE, type->node);
18344 type->subtypes = (xmlSchemaTypePtr) particle;
18347 type->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
18352 type->contentType = XML_SCHEMA_CONTENT_EMPTY;
18360 type->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
18363 * Compute the "content type".
18365 if (WXS_IS_RESTRICTION(type)) {
18369 if (type->contentType != XML_SCHEMA_CONTENT_EMPTY) {
18370 if (type->flags & XML_SCHEMAS_TYPE_MIXED)
18371 type->contentType = XML_SCHEMA_CONTENT_MIXED;
18377 if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) {
18381 * {content type} of the [...] base ..."
18383 type->contentType = baseType->contentType;
18384 type->subtypes = baseType->subtypes;
18387 * This is the case when the base type has a simple
18388 * type definition as content.
18390 type->contentTypeDef = baseType->contentTypeDef;
18398 if (type->flags & XML_SCHEMAS_TYPE_MIXED)
18399 type->contentType = XML_SCHEMA_CONTENT_MIXED;
18404 if (type->flags & XML_SCHEMAS_TYPE_MIXED)
18405 type->contentType = XML_SCHEMA_CONTENT_MIXED;
18410 if ((WXS_TYPE_PARTICLE(type) != NULL) &&
18411 (WXS_TYPE_PARTICLE_TERM(type) != NULL) &&
18412 ((WXS_TYPE_PARTICLE_TERM(type))->type ==
18421 WXS_ITEM_NODE(type), NULL,
18422 "The type has an 'all' model group in its "
18423 "{content type} and thus cannot be derived from "
18424 "a non-empty type, since this would produce a "
18432 ((WXS_TYPE_PARTICLE_TERM(baseType))->type ==
18441 WXS_ITEM_NODE(type), NULL,
18442 "A type cannot be derived by extension from a type "
18444 "{content type}, since this would produce a "
18452 (xmlSchemaTreeItemPtr) type->subtypes;
18457 type->node, 1, 1);
18465 XML_SCHEMA_TYPE_SEQUENCE, type->node);
18468 WXS_TYPE_CONTENTTYPE(type) = (xmlSchemaTypePtr) particle;
18470 * SPEC "the particle of the {content type} of
18472 * Create a duplicate of the base type's particle
18477 type->node,
18478 ((xmlSchemaParticlePtr) type->subtypes)->minOccurs,
18479 ((xmlSchemaParticlePtr) type->subtypes)->maxOccurs);
18504 * Just add the base types's content type.
18508 * nor to the complex type contraints.
18520 * - inherit attribute uses of the base type
18524 res = xmlSchemaFixupTypeAttributeUses(pctxt, type);
18527 * Apply the complex type component constraints; this will not
18531 res = xmlSchemaCheckCTComponent(pctxt, type);
18535 xmlSchemaDebugFixedType(pctxt, type);
18543 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_INVALID;
18545 xmlSchemaDebugFixedType(pctxt, type);
18550 type->flags |= XML_SCHEMAS_TYPE_INTERNAL_INVALID;
18552 xmlSchemaDebugFixedType(pctxt, type);
18560 * @typeDecl: the schema type definition
18563 * Fixes the content model of the type.
18567 xmlSchemaTypeFixup(xmlSchemaTypePtr type,
18570 if (type == NULL)
18572 if (actxt->type != XML_SCHEMA_CTXT_PARSER) {
18577 if (! WXS_IS_TYPE_NOT_FIXED(type))
18579 if (type->type == XML_SCHEMA_TYPE_COMPLEX)
18580 return(xmlSchemaFixupComplexType(PCTXT_CAST actxt, type));
18581 else if (type->type == XML_SCHEMA_TYPE_SIMPLE)
18582 return(xmlSchemaFixupSimpleTypeStageTwo(PCTXT_CAST actxt, type));
18589 * @typeDecl: the schema type definition
18591 * @name: the optional name of the type
18617 switch (facet->type) {
18632 * ���value space��� of {base type definition}.
18636 * ���value space��� of the ���base type���.
18641 * type holding a facet, won't be a built-in type.
18643 * calls (relaxng) do work, if the given type is a built-in
18644 * type, we will assume that the given built-in type *is
18645 * already* the base type.
18647 if (typeDecl->type != XML_SCHEMA_TYPE_BASIC) {
18651 "a type user derived type has no base type");
18683 "facet '%s' against the base type",
18684 facet->value, xmlSchemaFacetTypeToString(facet->type));
18696 "against the base type '%s'",
18732 if (facet->type == XML_SCHEMA_FACET_TOTALDIGITS) {
18758 xmlSchemaFacetTypeToString(facet->type),
18759 (facet->type != XML_SCHEMA_FACET_TOTALDIGITS) ?
18801 * @typeDecl: the schema type definition
18866 switch (term->type) {
18919 (item->type != XML_SCHEMA_TYPE_GROUP) ||
18974 ((WXS_PARTICLE_TERM(particle))->type !=
19021 if ((ref->type == XML_SCHEMA_EXTRA_QNAMEREF) &&
19145 if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
19167 if ((use->type == XML_SCHEMA_EXTRA_QNAMEREF) &&
19266 "exists already in the type definition",
19378 * {attribute declaration}s both of whose {type definition}s are or
19393 "declaration of type 'xs:ID' "
19453 * NOTE that this needs the simle type definitions to be already
19477 * "If the {type definition} is or is derived from ID then there
19486 "Value constraints are not allowed if the type definition "
19495 * to the {type definition} as defined in String Valid (���3.14.4)."
19611 * the {type definition}
19612 * of the element declaration must be validly derived from the {type
19616 * (if the {type definition} is complex) or as defined in
19617 * Type Derivation OK (Simple) (���3.14.6) (if the {type definition} is
19640 "The type definition '%s' was "
19642 "affiliation '%s', or not validly derived from its type "
19654 * SPEC (5) "If the {type definition} or {type definition}'s
19655 * {content type}
19657 * Note: The use of ID as a type definition for elements goes beyond
19672 "The type definition (or type definition's content type) is or "
19674 "conjunction with such a type definition", NULL);
19682 * {type definition} as defined in Element Default Valid (Immediate)
19689 "type is missing... skipping validation of "
19731 * 2. the declaration's type to be derived from the head's type
19746 xmlSchemaTypePtr headType, type;
19763 type = elemDecl->subtypes;
19764 if (headType == type)
19773 * derivation of D's {type definition} from C's {type definition}
19777 * empty set) of any intermediate {type definition}s in the
19778 * derivation of D's {type definition} from C's {type definition}."
19788 while ((type != NULL) && (type != headType)) {
19789 if ((WXS_IS_EXTENSION(type)) &&
19793 if (WXS_IS_RESTRICTION(type) &&
19797 type = type->baseType;
19801 * the head's type.
19803 type = elemDecl->subtypes->baseType;
19804 while (type != NULL) {
19805 if (WXS_IS_COMPLEX(type)) {
19806 if ((type->flags &
19810 if ((type->flags &
19816 if (type == headType)
19818 type = type->baseType;
19868 switch (WXS_PARTICLE_TERM(cur)->type) {
19887 * all their type definitions must be the same
19903 "type definitions",
19940 "found unexpected term of type '%s' in content model",
20000 ((WXS_PARTICLE_TERM(particle))->type !=
20021 if (refItem->type == XML_SCHEMA_TYPE_GROUP) {
20032 if ((WXS_MODELGROUPDEF_MODEL(refItem))->type ==
20042 * {content type} of a complex type definition."
20141 (ause->attrDecl->type != XML_SCHEMA_EXTRA_QNAMEREF))
20181 ((WXS_ATTRUSE_DECL(use))->type != XML_SCHEMA_TYPE_ATTRIBUTE))
20223 "Value constraints are not allowed if the type definition "
20281 * Resolves the referenced type definition component.
20288 * The simple type definition corresponding to the <simpleType> element
20290 * type definition ���resolved��� to by the ���actual value��� of the type
20291 * [attribute], if present, otherwise the ���simple ur-type definition���.
20299 xmlSchemaTypePtr type;
20301 type = xmlSchemaGetType(ctxt->schema, item->typeName,
20303 if ((type == NULL) || (! WXS_IS_SIMPLE(type))) {
20307 "type", item->typeName, item->typeNs,
20311 item->subtypes = type;
20315 * The type defaults to the xs:anySimpleType.
20328 * Resolve keyRef references to key/unique IDCs.
20336 if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF)
20354 } else if (idc->ref->item->type == XML_SCHEMA_TYPE_IDC_KEYREF) {
20376 * the {fields} of the {referenced key}.
20382 "cardinality of the referenced key/unique '%s'",
20447 redef->targetBucket, item->type,
20494 switch (item->type) {
20506 * Assign the redefined type to the
20507 * base type of the redefining type.
20564 "Unexpected redefined component type");
20612 switch (item->type) {
20617 * type to be 'absent', we'll NULL it.
20648 * (���3.4.6) (where references to the base type definition are
20682 if (WXS_IS_BUCKET_IMPMAIN((c)->type)) \
20708 switch (item->type) {
20748 "Unexpected global component type");
20846 * - the type definition
20849 * - the base type definition
20853 * - the type definition
20859 * 6. IDC key-references:
20860 * - the referenced IDC 'key' or 'unique' definition
20865 switch (item->type) {
20929 * 1. the base axis of type definitions
20939 switch (item->type) {
20978 switch (item->type) {
20995 switch (item->type) {
21018 switch (item->type) {
21038 switch (item->type) {
21054 * Do the complete type fixup for simple types.
21058 switch (item->type) {
21079 switch (item->type) {
21095 switch (item->type) {
21115 switch (item->type) {
21144 switch (item->type) {
21170 switch (item->type) {
21211 switch (item->type) {
21450 * @type: the facet type
21454 * Returns the char string representation of the facet type if the
21455 * type is a facet and an "Internal Error" string otherwise.
21458 xmlSchemaFacetTypeToString(xmlSchemaTypeType type)
21460 switch (type) {
21492 xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type)
21495 * The normalization type can be changed only for types which are derived
21498 if (type->type == XML_SCHEMA_TYPE_BASIC) {
21502 if ((type->builtInType == XML_SCHEMAS_STRING) ||
21503 (type->builtInType == XML_SCHEMAS_ANYSIMPLETYPE))
21505 else if (type->builtInType == XML_SCHEMAS_NORMSTRING)
21516 } else if (WXS_IS_LIST(type)) {
21521 } else if (WXS_IS_UNION(type)) {
21523 } else if (WXS_IS_ATOMIC(type)) {
21524 if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE)
21526 else if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_REPLACE)
21536 * Simple type validation *
21977 (idcDef->type == XML_SCHEMA_TYPE_IDC_KEYREF))
22066 * @item: the IDC key
22068 * The validation context is used to store an IDC key.
22074 xmlSchemaPSVIIDCKeyPtr key)
22084 "allocating the IDC key storage list", NULL);
22095 "re-allocating the IDC key storage list", NULL);
22099 vctxt->idcKeys[vctxt->nbIdcKeys++] = key;
22195 * @key: the IDC key
22197 * Frees an IDC key together with its compiled value.
22200 xmlSchemaIDCFreeKey(xmlSchemaPSVIIDCKeyPtr key)
22202 if (key->val != NULL)
22203 xmlSchemaFreeValue(key->val);
22204 xmlFree(key);
22347 * @type: "selector" or "field"
22359 int type)
22405 sto->type = type;
22444 "IDC: EVAL on %s, depth %d, type %d\n",
22457 if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR)
22513 if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) {
22530 } else if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) {
22532 * An IDC key node was found by the IDC field.
22536 "IDC: key found\n");
22575 xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type),
22627 * @type: the simple/complex type of the current node if any at all
22631 * IDC key-sequences are validated/created on IDC bindings.
22641 xmlSchemaPSVIIDCKeyPtr key = NULL;
22642 xmlSchemaTypePtr type = vctxt->inode->typeDef, simpleType = NULL;
22684 if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) {
22691 if (WXS_IS_COMPLEX(type)) {
22692 if (WXS_HAS_SIMPLE_CONTENT(type)) {
22696 simpleType = type->contentTypeDef;
22706 simpleType = type;
22712 * simple type.
22718 "non-simple type",
22726 if ((key == NULL) && (vctxt->inode->val == NULL)) {
22743 * The key will be anchored on the matcher's list of
22744 * key-sequences. The position in this list is determined
22764 * Create/grow the array of key-sequences.
22776 "allocating an array of key-sequences",
22793 "reallocating an array of key-sequences",
22806 * Get/create the key-sequence.
22819 * have a simple type.
22821 * The key was already set; report an error.
22838 * Create a key-sequence.
22845 "allocating an IDC key-sequence", NULL);
22853 * Create a key once per node only.
22855 if (key == NULL) {
22856 key = (xmlSchemaPSVIIDCKeyPtr) xmlMalloc(
22858 if (key == NULL) {
22860 "allocating a IDC key", NULL);
22868 key->type = simpleType;
22869 key->val = vctxt->inode->val;
22872 * Store the key in a global list.
22874 if (xmlSchemaIDCStoreKey(vctxt, key) == -1) {
22875 xmlSchemaIDCFreeKey(key);
22879 keySeq[idx] = key;
22881 } else if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) {
22895 * out for matching nodes to create a key-sequence for this
22897 * to put the key-sequence, together with the target node
22906 * Check if the matcher has any key-sequences at all, plus
22907 * if it has a key-sequence for the current target node.
22911 if (idc->type == XML_SCHEMA_TYPE_IDC_KEY)
22919 if (idc->type == XML_SCHEMA_TYPE_IDC_KEY)
22930 if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) {
22932 * All fields of a "key" IDC must resolve.
22944 * 4.1 If the {identity-constraint category} is unique(/key),
22946 * ���key-sequences��� whose members are pairwise equal, as
22950 * duplicate key-sequences.
22956 if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) &&
22963 * Compare the key-sequences, key by key.
22976 * One of the keys differs, so the key-sequence
22984 * Duplicate key-sequence found.
22993 * TODO: Try to report the key-sequence.
22998 "Duplicate key-sequence %s in %s",
23024 if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) {
23048 * consume the key-sequence.
23058 if (idc->type == XML_SCHEMA_TYPE_IDC_KEYREF) {
23088 * Free the key-sequence if not added to the IDC table.
23167 if (idc->type == XML_SCHEMA_TYPE_IDC_KEYREF) {
23172 * references a key/unique IDC, the keyrefDepth will
23241 matcher->type = IDC_MATCHER;
23244 matcher->idcType = aidc->def->type;
23275 if ((matcher->aidc->def->type == XML_SCHEMA_TYPE_IDC_KEYREF) ||
23324 * Compare the key-sequences and add to the IDC node-table.
23345 * Equal key-sequence.
23366 * Equal key-sequence found.
23384 * The key-sequence differs.
23474 * Remove duplicate key-sequences.
23481 * Check if the key/unique IDC table needs to be bubbled.
23512 * i.e. the key-sequence within, ...
23532 * ...with every key-sequence of the parent node, already
23533 * evaluated to be a duplicate key-sequence.
23571 * ... and with every key-sequence of the parent node.
23632 * Add the node-table entry (node and key-sequence) of
23773 * Find the IDC node-table for the referenced IDC key/unique.
23784 * Search for a matching key-sequences.
23834 "key-sequence %s of keyref '%s'",
23852 "No match found for key-sequence %s of keyref '%s'",
23958 } else if (xmlStrEqual(localName, BAD_CAST "type")) {
24123 xmlSchemaTypePtr type,
24141 if (type->type == XML_SCHEMA_TYPE_BASIC)
24145 * NOTE: Do not jump away, if the facetSet of the given type is
24149 if (type->facetSet == NULL)
24152 if (! WXS_IS_ATOMIC(type)) {
24153 if (WXS_IS_LIST(type))
24162 tmpType = xmlSchemaGetPrimitiveType(type);
24165 ws = xmlSchemaGetWhiteSpaceFacetValue(type);
24171 * type.
24179 for (facetLink = type->facetSet; facetLink != NULL;
24185 switch (facetLink->facet->type) {
24203 "validating against a atomic type facet");
24208 value, len, type, facetLink->facet, NULL, NULL, NULL);
24218 if (! WXS_IS_LIST(type))
24224 for (facetLink = type->facetSet; facetLink != NULL;
24227 switch (facetLink->facet->type) {
24239 "validating against a list type facet");
24244 value, length, type, facetLink->facet, NULL, NULL, NULL);
24258 * of the defining type's base type. This seems to be a bug in the
24259 * XML Schema 1.0 spec. Use the whitespace type of the base type.
24264 tmpType = type;
24267 if (facet->type != XML_SCHEMA_FACET_ENUMERATION)
24284 * of the current type are restricted by this set; thus
24291 (tmpType->type != XML_SCHEMA_TYPE_BASIC));
24296 value, 0, type, NULL, NULL, NULL, NULL);
24307 * Process patters. Pattern facets are ORed at type level
24308 * and ANDed if derived. Walk the base type axis.
24310 tmpType = type;
24316 if (facetLink->facet->type != XML_SCHEMA_FACET_PATTERN)
24341 value, 0, type, facet, NULL, NULL, NULL);
24349 } while ((tmpType != NULL) && (tmpType->type != XML_SCHEMA_TYPE_BASIC));
24356 xmlSchemaNormalizeValue(xmlSchemaTypePtr type,
24359 switch (xmlSchemaGetWhiteSpaceFacetValue(type)) {
24433 * cvc-simple-type
24438 xmlSchemaTypePtr type,
24452 (normalize || (type->flags & XML_SCHEMAS_TYPE_NORMVALUENEEDED))) { \
24485 if ((! valNeeded) && (type->flags & XML_SCHEMAS_TYPE_FACETSNEEDVALUE))
24489 if (WXS_IS_ANY_SIMPLE_TYPE(type) || WXS_IS_ATOMIC(type)) {
24490 xmlSchemaTypePtr biType; /* The built-in type. */
24493 * a literal in the ���lexical space��� of {base type definition}"
24498 NORMALIZE(type);
24499 if (type->type != XML_SCHEMA_TYPE_BASIC) {
24501 * Get the built-in type.
24503 biType = type->baseType;
24505 (biType->type != XML_SCHEMA_TYPE_BASIC))
24510 "could not get the built-in type");
24514 biType = type;
24519 if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
24532 /* ws = xmlSchemaGetWhiteSpaceFacetValue(type); */
24541 } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) {
24549 /* ws = xmlSchemaGetWhiteSpaceFacetValue(type); */
24568 "validating against a built-in type");
24571 if (WXS_IS_LIST(type))
24576 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) {
24580 ret = xmlSchemaValidateFacets(actxt, node, type,
24586 "validating facets of atomic simple type");
24589 if (WXS_IS_LIST(type))
24596 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1);
24597 } else if (WXS_IS_LIST(type)) {
24606 * in the ���lexical space��� of {item type definition}
24610 * the list type has an enum or pattern facet.
24612 NORMALIZE(type);
24617 itemType = WXS_LIST_ITEMTYPE(type);
24651 "validating an item of list simple type");
24660 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) {
24664 ret = xmlSchemaValidateFacets(actxt, node, type,
24670 "validating facets of list simple type");
24681 NORMALIZE(type);
24682 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1);
24684 } else if (WXS_IS_UNION(type)) {
24693 * member type, then the facets of the union type are applied. This
24700 * {member type definitions}
24702 memberLink = xmlSchemaGetUnionSimpleTypeMemberTypes(type);
24705 "union simple type has no member types");
24709 * Always normalize union type values, since we currently
24717 memberLink->type, value, &val, 0, 1, 0);
24720 memberLink->type, value, NULL, 0, 1, 0);
24728 "validating members of union simple type");
24736 if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) {
24742 NORMALIZE(memberLink->type);
24743 ret = xmlSchemaValidateFacets(actxt, node, type,
24749 "validating facets of union simple type");
24756 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1);
24848 * Handle 'xsi:type'.
24858 * TODO: We should report a *warning* that the type was overriden
24872 "attribute 'xsi:type'");
24888 "The QName value '%s' of the xsi:type attribute does not "
24889 "resolve to a type definition",
24900 * "The ���local type definition��� must be validly
24901 * derived from the {type definition} given the union of
24902 * the {disallowed substitutions} and the {type definition}'s
24905 * (if it is a complex type definition),
24907 * Derivation OK (Simple) (���3.14.6) (if it is a simple type
24911 * {prohibited substitutions}: the "block" on the type def.
24945 "The type definition '%s', specified by xsi:type, is "
24946 "blocked or not validly derived from the type definition "
24991 "The type definition is absent");
25048 * Handle 'xsi:type'.
25061 "process the attribute 'xsi:type'");
25079 * No actual type definition.
25083 "The type definition is absent");
25087 * Remember the actual type definition.
25101 * SPEC cvc-type (3.1.1)
25104 * whose local name is one of type, nil, schemaLocation or
25156 * Element Locally Valid (Complex Type) (cvc-complex-type)
25167 xmlSchemaTypePtr type = vctxt->inode->typeDef;
25181 * (2) "Its {type definition} must not be absent."
25186 * SPEC (cvc-complex-type)
25190 * [local name] is one of type, nil, schemaLocation or
25195 attrUseList = (xmlSchemaItemListPtr) type->attrUses;
25211 * SPEC (cvc-complex-type) (3)
25224 * SPEC (cvc-complex-type)
25256 * SPEC (cvc-complex-type)
25299 if (type->attributeWildcard != NULL) {
25301 * SPEC (cvc-complex-type)
25307 * SPEC (cvc-complex-type) (3)
25313 * SPEC (cvc-complex-type)
25322 if (xmlSchemaCheckCVCWildcardNamespace(type->attributeWildcard,
25333 if (type->attributeWildcard->processContents ==
25353 * SPEC (cvc-complex-type)
25361 * an attribute declaration whose {type definition} is
25380 * SPEC (cvc-complex-type)
25383 * whose {attribute declaration}'s {type definition}
25399 } else if (type->attributeWildcard->processContents ==
25440 * VAL TODO: What to do if the type definition is missing?
25592 * with respect to that {type definition} as per
25728 "The type definition is absent");
25749 if (type->attributeWildcard == NULL) {
25779 (wild->type != XML_SCHEMA_TYPE_ANY)) {
25816 * Use the xsi:type attribute for the type definition.
25862 * For a string to be a valid default with respect to a type
25867 * Complex type.
25869 * SPEC (2.1) "its {content type} must be a simple type definition
25871 * SPEC (2.2.2) "If the {content type} is mixed, then the {content
25872 * type}'s particle must be ���emptiable��� as defined by
25881 "For a string to be a valid default, the type definition "
25882 "must be a simple type or a complex type with simple content "
25888 * 1 If the type definition is a simple type definition, then the string
25894 * 2.2.1 If the {content type} is a simple type definition, then the
25895 * string must be ���valid��� with respect to that simple type definition
25926 if (item->type == XML_SCHEMA_TYPE_ELEMENT) {
25959 xmlSchemaTypePtr type,
25965 type, value, &(inode->val), 1, 1, 0));
25969 type, value, NULL, 1, 0, 0));
25997 * 1. the type definition might be missing if the element was
26120 * If the ���actual type definition��� is a ���local type definition���
26122 * value must be a valid default for the ���actual type definition��� as
26126 * NOTE: 'local' above means types acquired by xsi:type.
26154 * ���actual type definition��� as defined by Element Locally Valid (Type)
26203 * to the ���actual type definition��� as defined by Element Locally
26208 * SPEC (cvc-type) (3.1)
26209 * "If the type definition is a simple type definition, ..."
26212 * must be ���valid��� with respect to the type definition as defined
26219 * SPEC (cvc-type) (3.2) "If the type definition is a complex type
26221 * ���valid��� with respect to the type definition as per
26224 * SPEC (cvc-complex-type) (2.2)
26225 * "If the {content type} is a simple type definition, ...
26227 * ���valid��� with respect to that simple type definition as
26270 * 5.2.2.2.1 If the {content type} of the ���actual type
26295 * 5.2.2.2.2 If the {content type} of the ���actual type
26296 * definition��� is a simple type definition, then the
26405 * A 'keyrefDepth' of a key/unique IDC matches the current
26429 * Validation Rule: Element Locally Valid (Complex Type) (cvc-complex-type)
26477 * Process "xsi:type".
26502 * skip by ���validating��� with respect to the ���ur-type
26515 * SPEC (2.1) "If the {content type} is empty, then the
26523 "because the content type is empty");
26538 "type has elem content but no content model");
26572 * SPEC (2.4) "If the {content type} is element-only or mixed,
26575 * order, is ���valid��� with respect to the {content type}'s
26616 * SPEC (cvc-complex-type) (2.2)
26617 * "If the {content type} is a simple type definition, then
26623 "because the content type is a simple type definition");
26626 * SPEC (cvc-type) (3.1.2) "The element information item must
26631 "because the type definition is simple");
26665 * 1. content type is simple
26685 * SPEC (2.1) "If the {content type} is empty, then the
26693 "because the content type is empty");
26702 * SPEC cvc-complex-type (2.3)
26703 * "If the {content type} is element-only, then the
26711 "because the content type is 'element-only'");
26721 * NOTE that even if the content type is *mixed*, we need the
26835 "declaration nor the type was set");
26857 if (vctxt->inode->decl->type == XML_SCHEMA_TYPE_ANY) {
26879 if (vctxt->inode->decl->type != XML_SCHEMA_TYPE_ELEMENT) {
26900 * Validate against the type definition.
26908 "The type definition is absent");
26915 "The type definition is abstract");
27439 ret->type = XML_SCHEMA_CTXT_VALIDATOR;
27800 if (node->type == XML_ELEMENT_NODE) {
27864 } else if ((node->type == XML_TEXT_NODE) ||
27865 (node->type == XML_CDATA_SECTION_NODE)) {
27871 ret = xmlSchemaVPushText(vctxt, node->type, node->content,
27882 } else if ((node->type == XML_ENTITY_NODE) ||
27883 (node->type == XML_ENTITY_REF_NODE)) {
27907 if (node->type == XML_ELEMENT_NODE) {
28066 if ((ctxt == NULL) || (elem == NULL) || (elem->type != XML_ELEMENT_NODE))
28225 entityDeclSplit(void *ctx, const xmlChar *name, int type,
28231 ctxt->user_sax->entityDecl(ctxt->user_data, name, type, publicId,
28237 const xmlChar * name, int type, int def,
28243 ctxt->user_sax->attributeDecl(ctxt->user_data, elem, name, type,
28251 elementDeclSplit(void *ctx, const xmlChar *name, int type,
28257 ctxt->user_sax->elementDecl(ctxt->user_data, name, type, content);