| 18088 | } |
| 18089 | |
| 18090 | static int |
| 18091 | xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, |
| 18092 | xmlSchemaTypePtr type) |
| 18093 | { |
| 18094 | int res = 0, olderrs = pctxt->nberrors; |
| 18095 | xmlSchemaTypePtr baseType = type->baseType; |
| 18096 | |
| 18097 | if (! WXS_IS_TYPE_NOT_FIXED(type)) |
| 18098 | return(0); |
| 18099 | type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED; |
| 18100 | if (baseType == NULL) { |
| 18101 | PERROR_INT("xmlSchemaFixupComplexType", |
| 18102 | "missing baseType"); |
| 18103 | goto exit_failure; |
| 18104 | } |
| 18105 | /* |
| 18106 | * Fixup the base type. |
| 18107 | */ |
| 18108 | if (WXS_IS_TYPE_NOT_FIXED(baseType)) |
| 18109 | xmlSchemaTypeFixup(baseType, ACTXT_CAST pctxt); |
| 18110 | if (baseType->flags & XML_SCHEMAS_TYPE_INTERNAL_INVALID) { |
| 18111 | /* |
| 18112 | * Skip fixup if the base type is invalid. |
| 18113 | * TODO: Generate a warning! |
| 18114 | */ |
| 18115 | return(0); |
| 18116 | } |
| 18117 | /* |
| 18118 | * This basically checks if the base type can be derived. |
| 18119 | */ |
| 18120 | res = xmlSchemaCheckSRCCT(pctxt, type); |
| 18121 | HFAILURE HERROR |
| 18122 | /* |
| 18123 | * Fixup the content type. |
| 18124 | */ |
| 18125 | if (type->contentType == XML_SCHEMA_CONTENT_SIMPLE) { |
| 18126 | /* |
| 18127 | * Corresponds to <complexType><simpleContent>... |
| 18128 | */ |
| 18129 | if ((WXS_IS_COMPLEX(baseType)) && |
| 18130 | (baseType->contentTypeDef != NULL) && |
| 18131 | (WXS_IS_RESTRICTION(type))) { |
| 18132 | xmlSchemaTypePtr contentBase, content; |
| 18133 | #ifdef ENABLE_NAMED_LOCALS |
| 18134 | char buf[30]; |
| 18135 | const xmlChar *tmpname; |
| 18136 | #endif |
| 18137 | /* |
| 18138 | * SPEC (1) If <restriction> + base type is <complexType>, |
| 18139 | * "whose own {content type} is a simple type..." |
| 18140 | */ |
| 18141 | if (type->contentTypeDef != NULL) { |
| 18142 | /* |
| 18143 | * SPEC (1.1) "the simple type definition corresponding to the |
| 18144 | * <simpleType> among the [children] of <restriction> if there |
| 18145 | * is one;" |
| 18146 | * Note that this "<simpleType> among the [children]" was put |
| 18147 | * into ->contentTypeDef during parsing. |
no test coverage detected