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

Function xmlSchemaCheckSTPropsCorrect

ThirdParty/libxml2/vtklibxml2/xmlschemas.c:15154–15243  ·  view source on GitHub ↗

* xmlSchemaCheckSTPropsCorrect: * @ctxt: the schema parser context * @type: the simple type definition * * Checks st-props-correct. * * Returns 0 if the properties are correct, * if not, a positive error code and -1 on internal * errors. */

Source from the content-addressed store, hash-verified

15152 * errors.
15153 */
15154static int
15155xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt,
15156 xmlSchemaTypePtr type)
15157{
15158 xmlSchemaTypePtr baseType = type->baseType;
15159 xmlChar *str = NULL;
15160
15161 /* STATE: error funcs converted. */
15162 /*
15163 * Schema Component Constraint: Simple Type Definition Properties Correct
15164 *
15165 * NOTE: This is somehow redundant, since we actually built a simple type
15166 * to have all the needed information; this acts as an self test.
15167 */
15168 /* Base type: If the datatype has been `derived` by `restriction`
15169 * then the Simple Type Definition component from which it is `derived`,
15170 * otherwise the Simple Type Definition for anySimpleType ($4.1.6).
15171 */
15172 if (baseType == NULL) {
15173 /*
15174 * TODO: Think about: "modulo the impact of Missing
15175 * Sub-components ($5.3)."
15176 */
15177 xmlSchemaPCustomErr(ctxt,
15178 XML_SCHEMAP_ST_PROPS_CORRECT_1,
15179 WXS_BASIC_CAST type, NULL,
15180 "No base type existent", NULL);
15181 return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
15182
15183 }
15184 if (! WXS_IS_SIMPLE(baseType)) {
15185 xmlSchemaPCustomErr(ctxt,
15186 XML_SCHEMAP_ST_PROPS_CORRECT_1,
15187 WXS_BASIC_CAST type, NULL,
15188 "The base type '%s' is not a simple type",
15189 xmlSchemaGetComponentQName(&str, baseType));
15190 FREE_AND_NULL(str)
15191 return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
15192 }
15193 if ((WXS_IS_LIST(type) || WXS_IS_UNION(type)) &&
15194 (WXS_IS_RESTRICTION(type) == 0) &&
15195 ((! WXS_IS_ANY_SIMPLE_TYPE(baseType)) &&
15196 (baseType->type != XML_SCHEMA_TYPE_SIMPLE))) {
15197 xmlSchemaPCustomErr(ctxt,
15198 XML_SCHEMAP_ST_PROPS_CORRECT_1,
15199 WXS_BASIC_CAST type, NULL,
15200 "A type, derived by list or union, must have "
15201 "the simple ur-type definition as base type, not '%s'",
15202 xmlSchemaGetComponentQName(&str, baseType));
15203 FREE_AND_NULL(str)
15204 return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
15205 }
15206 /*
15207 * Variety: One of {atomic, list, union}.
15208 */
15209 if ((! WXS_IS_ATOMIC(type)) && (! WXS_IS_UNION(type)) &&
15210 (! WXS_IS_LIST(type))) {
15211 xmlSchemaPCustomErr(ctxt,

Callers 1

Calls 2

Tested by

no test coverage detected