* xmlSchemaAttributeGroupExpandRefs: * @pctxt: the parser context * @attrGr: the attribute group definition * * Substitutes contained attribute group references * for their attribute uses. Wildcards are intersected. * * Schema Component Constraint: * Attribute Group Definition Properties Correct (ag-props-correct) */
| 19285 | * Attribute Group Definition Properties Correct (ag-props-correct) |
| 19286 | */ |
| 19287 | static int |
| 19288 | xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, |
| 19289 | xmlSchemaAttributeGroupPtr attrGr) |
| 19290 | { |
| 19291 | /* |
| 19292 | * SPEC ag-props-correct |
| 19293 | * (1) "The values of the properties of an attribute group definition |
| 19294 | * must be as described in the property tableau in The Attribute |
| 19295 | * Group Definition Schema Component ($3.6.1), modulo the impact of |
| 19296 | * Missing Sub-components ($5.3);" |
| 19297 | */ |
| 19298 | |
| 19299 | if ((attrGr->attrUses != NULL) && |
| 19300 | (WXS_LIST_CAST attrGr->attrUses)->nbItems > 1) |
| 19301 | { |
| 19302 | xmlSchemaItemListPtr uses = WXS_LIST_CAST attrGr->attrUses; |
| 19303 | xmlSchemaAttributeUsePtr use, tmp; |
| 19304 | int i, j, hasId = 0; |
| 19305 | |
| 19306 | for (i = uses->nbItems -1; i >= 0; i--) { |
| 19307 | use = uses->items[i]; |
| 19308 | /* |
| 19309 | * SPEC ag-props-correct |
| 19310 | * (2) "Two distinct members of the {attribute uses} must not have |
| 19311 | * {attribute declaration}s both of whose {name}s match and whose |
| 19312 | * {target namespace}s are identical." |
| 19313 | */ |
| 19314 | if (i > 0) { |
| 19315 | for (j = i -1; j >= 0; j--) { |
| 19316 | tmp = uses->items[j]; |
| 19317 | if ((WXS_ATTRUSE_DECL_NAME(use) == |
| 19318 | WXS_ATTRUSE_DECL_NAME(tmp)) && |
| 19319 | (WXS_ATTRUSE_DECL_TNS(use) == |
| 19320 | WXS_ATTRUSE_DECL_TNS(tmp))) |
| 19321 | { |
| 19322 | xmlChar *str = NULL; |
| 19323 | |
| 19324 | xmlSchemaCustomErr(ACTXT_CAST pctxt, |
| 19325 | XML_SCHEMAP_AG_PROPS_CORRECT, |
| 19326 | attrGr->node, WXS_BASIC_CAST attrGr, |
| 19327 | "Duplicate %s", |
| 19328 | xmlSchemaGetComponentDesignation(&str, use), |
| 19329 | NULL); |
| 19330 | FREE_AND_NULL(str); |
| 19331 | /* |
| 19332 | * Remove the duplicate. |
| 19333 | */ |
| 19334 | if (xmlSchemaItemListRemove(uses, i) == -1) |
| 19335 | return(-1); |
| 19336 | goto next_use; |
| 19337 | } |
| 19338 | } |
| 19339 | } |
| 19340 | /* |
| 19341 | * SPEC ag-props-correct |
| 19342 | * (3) "Two distinct members of the {attribute uses} must not have |
| 19343 | * {attribute declaration}s both of whose {type definition}s are or |
| 19344 | * are derived from ID." |
no test coverage detected