mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
added the boolean base type. Daniel
* xmlschemastypes.c: added the boolean base type. Daniel
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Fri Feb 7 01:43:38 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlschemastypes.c: added the boolean base type.
|
||||||
|
|
||||||
Thu Feb 6 10:23:52 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Thu Feb 6 10:23:52 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* xmlschemastypes.c: started implementing some of the missing
|
* xmlschemastypes.c: started implementing some of the missing
|
||||||
|
@ -55,6 +55,7 @@ typedef enum {
|
|||||||
XML_SCHEMAS_DURATION,
|
XML_SCHEMAS_DURATION,
|
||||||
XML_SCHEMAS_FLOAT,
|
XML_SCHEMAS_FLOAT,
|
||||||
XML_SCHEMAS_DOUBLE,
|
XML_SCHEMAS_DOUBLE,
|
||||||
|
XML_SCHEMAS_BOOLEAN,
|
||||||
XML_SCHEMAS_INT,
|
XML_SCHEMAS_INT,
|
||||||
XML_SCHEMAS_,
|
XML_SCHEMAS_,
|
||||||
XML_SCHEMAS_XXX
|
XML_SCHEMAS_XXX
|
||||||
@ -107,6 +108,7 @@ struct _xmlSchemaVal {
|
|||||||
xmlSchemaValDuration dur;
|
xmlSchemaValDuration dur;
|
||||||
float f;
|
float f;
|
||||||
double d;
|
double d;
|
||||||
|
int b;
|
||||||
} value;
|
} value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -131,6 +133,7 @@ static xmlSchemaTypePtr xmlSchemaTypeGMonthDef = NULL;
|
|||||||
static xmlSchemaTypePtr xmlSchemaTypeDurationDef = NULL;
|
static xmlSchemaTypePtr xmlSchemaTypeDurationDef = NULL;
|
||||||
static xmlSchemaTypePtr xmlSchemaTypeNmtoken = NULL;
|
static xmlSchemaTypePtr xmlSchemaTypeNmtoken = NULL;
|
||||||
static xmlSchemaTypePtr xmlSchemaTypeFloatDef = NULL;
|
static xmlSchemaTypePtr xmlSchemaTypeFloatDef = NULL;
|
||||||
|
static xmlSchemaTypePtr xmlSchemaTypeBooleanDef = NULL;
|
||||||
static xmlSchemaTypePtr xmlSchemaTypeDoubleDef = NULL;
|
static xmlSchemaTypePtr xmlSchemaTypeDoubleDef = NULL;
|
||||||
static xmlSchemaTypePtr xmlSchemaTypeNameDef = NULL;
|
static xmlSchemaTypePtr xmlSchemaTypeNameDef = NULL;
|
||||||
static xmlSchemaTypePtr xmlSchemaTypeQNameDef = NULL;
|
static xmlSchemaTypePtr xmlSchemaTypeQNameDef = NULL;
|
||||||
@ -209,6 +212,7 @@ xmlSchemaInitTypes(void) {
|
|||||||
xmlSchemaTypeNmtoken = xmlSchemaInitBasicType("NMTOKEN");
|
xmlSchemaTypeNmtoken = xmlSchemaInitBasicType("NMTOKEN");
|
||||||
xmlSchemaTypeFloatDef = xmlSchemaInitBasicType("float");
|
xmlSchemaTypeFloatDef = xmlSchemaInitBasicType("float");
|
||||||
xmlSchemaTypeDoubleDef = xmlSchemaInitBasicType("double");
|
xmlSchemaTypeDoubleDef = xmlSchemaInitBasicType("double");
|
||||||
|
xmlSchemaTypeBooleanDef = xmlSchemaInitBasicType("boolean");
|
||||||
xmlSchemaTypeNameDef = xmlSchemaInitBasicType("Name");
|
xmlSchemaTypeNameDef = xmlSchemaInitBasicType("Name");
|
||||||
xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName");
|
xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName");
|
||||||
xmlSchemaTypeAnyURIDef = xmlSchemaInitBasicType("anyURI");
|
xmlSchemaTypeAnyURIDef = xmlSchemaInitBasicType("anyURI");
|
||||||
@ -1429,6 +1433,31 @@ xmlSchemaValidatePredefinedType(xmlSchemaTypePtr type, const xmlChar *value,
|
|||||||
}
|
}
|
||||||
xmlFreeURI(uri);
|
xmlFreeURI(uri);
|
||||||
return(0);
|
return(0);
|
||||||
|
} else if (type == xmlSchemaTypeBooleanDef) {
|
||||||
|
const xmlChar *cur = value;
|
||||||
|
|
||||||
|
if ((cur[0] == '0') && (cur[1] == 0))
|
||||||
|
ret = 0;
|
||||||
|
else if ((cur[0] == '1') && (cur[1] == 0))
|
||||||
|
ret = 1;
|
||||||
|
else if ((cur[0] == 't') && (cur[1] == 'r') && (cur[2] == 'u') &&
|
||||||
|
(cur[3] == 'e') && (cur[4] == 0))
|
||||||
|
ret = 1;
|
||||||
|
else if ((cur[0] == 'f') && (cur[1] == 'a') && (cur[2] == 'l') &&
|
||||||
|
(cur[3] == 's') && (cur[4] == 'e') && (cur[5] == 0))
|
||||||
|
ret = 0;
|
||||||
|
else
|
||||||
|
return(1);
|
||||||
|
if (val != NULL) {
|
||||||
|
v = xmlSchemaNewValue(XML_SCHEMAS_BOOLEAN);
|
||||||
|
if (v != NULL) {
|
||||||
|
v->value.b = ret;
|
||||||
|
*val = v;
|
||||||
|
} else {
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
} else {
|
} else {
|
||||||
TODO
|
TODO
|
||||||
return(0);
|
return(0);
|
||||||
|
Reference in New Issue
Block a user