* xmlSchemaCheckCOSCTExtends: * @ctxt: the schema parser context * @type: the complex type definition * * (3.4.6) Constraints on Complex Type Definition Schema Components * Schema Component Constraint: * Derivation Valid (Extension) (cos-ct-extends) * * STATUS: * missing: * (1.5) * (1.4.3.2.2.2) "Particle Valid (Extension)" * * Returns 0 if the constraints are satisfied, a
| 16131 | * error code if not and -1 if an internal error occurred. |
| 16132 | */ |
| 16133 | static int |
| 16134 | xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, |
| 16135 | xmlSchemaTypePtr type) |
| 16136 | { |
| 16137 | xmlSchemaTypePtr base = type->baseType; |
| 16138 | /* |
| 16139 | * TODO: Correct the error code; XML_SCHEMAP_COS_CT_EXTENDS_1_1 is used |
| 16140 | * temporarily only. |
| 16141 | */ |
| 16142 | /* |
| 16143 | * SPEC (1) "If the {base type definition} is a complex type definition, |
| 16144 | * then all of the following must be true:" |
| 16145 | */ |
| 16146 | if (WXS_IS_COMPLEX(base)) { |
| 16147 | /* |
| 16148 | * SPEC (1.1) "The {final} of the {base type definition} must not |
| 16149 | * contain extension." |
| 16150 | */ |
| 16151 | if (base->flags & XML_SCHEMAS_TYPE_FINAL_EXTENSION) { |
| 16152 | xmlSchemaPCustomErr(ctxt, |
| 16153 | XML_SCHEMAP_COS_CT_EXTENDS_1_1, |
| 16154 | WXS_BASIC_CAST type, NULL, |
| 16155 | "The 'final' of the base type definition " |
| 16156 | "contains 'extension'", NULL); |
| 16157 | return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); |
| 16158 | } |
| 16159 | |
| 16160 | /* |
| 16161 | * ATTENTION: The constrains (1.2) and (1.3) are not applied, |
| 16162 | * since they are automatically satisfied through the |
| 16163 | * inheriting mechanism. |
| 16164 | * Note that even if redefining components, the inheriting mechanism |
| 16165 | * is used. |
| 16166 | */ |
| 16167 | #if 0 |
| 16168 | /* |
| 16169 | * SPEC (1.2) "Its {attribute uses} must be a subset of the {attribute |
| 16170 | * uses} |
| 16171 | * of the complex type definition itself, that is, for every attribute |
| 16172 | * use in the {attribute uses} of the {base type definition}, there |
| 16173 | * must be an attribute use in the {attribute uses} of the complex |
| 16174 | * type definition itself whose {attribute declaration} has the same |
| 16175 | * {name}, {target namespace} and {type definition} as its attribute |
| 16176 | * declaration" |
| 16177 | */ |
| 16178 | if (base->attrUses != NULL) { |
| 16179 | int i, j, found; |
| 16180 | xmlSchemaAttributeUsePtr use, buse; |
| 16181 | |
| 16182 | for (i = 0; i < (WXS_LIST_CAST base->attrUses)->nbItems; i ++) { |
| 16183 | buse = (WXS_LIST_CAST base->attrUses)->items[i]; |
| 16184 | found = 0; |
| 16185 | if (type->attrUses != NULL) { |
| 16186 | use = (WXS_LIST_CAST type->attrUses)->items[j]; |
| 16187 | for (j = 0; j < (WXS_LIST_CAST type->attrUses)->nbItems; j ++) |
| 16188 | { |
| 16189 | if ((WXS_ATTRUSE_DECL_NAME(use) == |
| 16190 | WXS_ATTRUSE_DECL_NAME(buse)) && |
no test coverage detected