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

Function xmlSchemaParseSimpleType

ThirdParty/libxml2/vtklibxml2/xmlschemas.c:9107–9308  ·  view source on GitHub ↗

* xmlSchemaParseSimpleType: * @ctxt: a schema validation context * @schema: the schema being built * @node: a subtree containing XML Schema information * * parse a XML schema Simple Type definition * *WARNING* this interface is highly subject to change * * Returns -1 in case of error, 0 if the declaration is improper and * 1 in case of success. */

Source from the content-addressed store, hash-verified

9105 * 1 in case of success.
9106 */
9107static xmlSchemaTypePtr
9108xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
9109 xmlNodePtr node, int topLevel)
9110{
9111 xmlSchemaTypePtr type, oldCtxtType;
9112 xmlNodePtr child = NULL;
9113 const xmlChar *attrValue = NULL;
9114 xmlAttrPtr attr;
9115 int hasRestriction = 0;
9116
9117 if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
9118 return (NULL);
9119
9120 if (topLevel) {
9121 attr = xmlSchemaGetPropNode(node, "name");
9122 if (attr == NULL) {
9123 xmlSchemaPMissingAttrErr(ctxt,
9124 XML_SCHEMAP_S4S_ATTR_MISSING,
9125 NULL, node,
9126 "name", NULL);
9127 return (NULL);
9128 } else {
9129 if (xmlSchemaPValAttrNode(ctxt,
9130 NULL, attr,
9131 xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &attrValue) != 0)
9132 return (NULL);
9133 /*
9134 * Skip built-in types.
9135 */
9136 if (ctxt->isS4S) {
9137 xmlSchemaTypePtr biType;
9138
9139 if (ctxt->isRedefine) {
9140 /*
9141 * REDEFINE: Disallow redefinition of built-in-types.
9142 * TODO: It seems that the spec does not say anything
9143 * about this case.
9144 */
9145 xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE,
9146 NULL, node,
9147 "Redefinition of built-in simple types is not "
9148 "supported", NULL);
9149 return(NULL);
9150 }
9151 biType = xmlSchemaGetPredefinedType(attrValue, xmlSchemaNs);
9152 if (biType != NULL)
9153 return (biType);
9154 }
9155 }
9156 }
9157 /*
9158 * TargetNamespace:
9159 * SPEC "The `actual value` of the targetNamespace [attribute]
9160 * of the <schema> ancestor element information item if present,
9161 * otherwise `absent`.
9162 */
9163 if (topLevel == 0) {
9164#ifdef ENABLE_NAMED_LOCALS

Callers 8

xmlSchemaParseElementFunction · 0.85
xmlSchemaParseUnionFunction · 0.85
xmlSchemaParseListFunction · 0.85

Calls 15

xmlSchemaGetPropNodeFunction · 0.85
xmlSchemaPMissingAttrErrFunction · 0.85
xmlSchemaPValAttrNodeFunction · 0.85
xmlSchemaGetBuiltInTypeFunction · 0.85
xmlSchemaAddTypeFunction · 0.85
xmlDictLookupFunction · 0.85
xmlStrEqualFunction · 0.85
xmlSchemaPIllegalAttrErrFunction · 0.85
xmlSchemaGetPropFunction · 0.85
xmlSchemaPValAttrIDFunction · 0.85

Tested by

no test coverage detected