MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSchemaCheckCOSNSSubset

Function xmlSchemaCheckCOSNSSubset

ThirdParty/libxml2/vtklibxml2/xmlschemas.c:13926–13987  ·  view source on GitHub ↗

* xmlSchemaIsWildcardNsConstraintSubset: * @ctxt: the schema parser context * @sub: the first wildcard * @super: the second wildcard * * Schema Component Constraint: Wildcard Subset (cos-ns-subset) * * Returns 0 if the namespace constraint of @sub is an intensional * subset of @super, 1 otherwise. */

Source from the content-addressed store, hash-verified

13924 * subset of @super, 1 otherwise.
13925 */
13926static int
13927xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub,
13928 xmlSchemaWildcardPtr super)
13929{
13930 /*
13931 * 1 super must be any.
13932 */
13933 if (super->any)
13934 return (0);
13935 /*
13936 * 2.1 sub must be a pair of not and a namespace name or `absent`.
13937 * 2.2 super must be a pair of not and the same value.
13938 */
13939 if ((sub->negNsSet != NULL) &&
13940 (super->negNsSet != NULL) &&
13941 (sub->negNsSet->value == super->negNsSet->value))
13942 return (0);
13943 /*
13944 * 3.1 sub must be a set whose members are either namespace names or `absent`.
13945 */
13946 if (sub->nsSet != NULL) {
13947 /*
13948 * 3.2.1 super must be the same set or a superset thereof.
13949 */
13950 if (super->nsSet != NULL) {
13951 xmlSchemaWildcardNsPtr cur, curB;
13952 int found = 0;
13953
13954 cur = sub->nsSet;
13955 while (cur != NULL) {
13956 found = 0;
13957 curB = super->nsSet;
13958 while (curB != NULL) {
13959 if (cur->value == curB->value) {
13960 found = 1;
13961 break;
13962 }
13963 curB = curB->next;
13964 }
13965 if (!found)
13966 return (1);
13967 cur = cur->next;
13968 }
13969 if (found)
13970 return (0);
13971 } else if (super->negNsSet != NULL) {
13972 xmlSchemaWildcardNsPtr cur;
13973 /*
13974 * 3.2.2 super must be a pair of not and a namespace name or
13975 * `absent` and that value must not be in sub's set.
13976 */
13977 cur = sub->nsSet;
13978 while (cur != NULL) {
13979 if (cur->value == super->negNsSet->value)
13980 return (1);
13981 cur = cur->next;
13982 }
13983 return (0);

Calls

no outgoing calls

Tested by

no test coverage detected