1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

added Datatype ID and IDREF, usable from RelaxNG now need to add a new

* relaxng.c valid.c xmlschemastypes.c: added Datatype ID
  and IDREF, usable from RelaxNG now
* include/libxml/xmlschemastypes.h: need to add a new interface
  because the validation modifies the infoset
* test/relaxng/testsuite.xml: extended the testsuite
Daniel
This commit is contained in:
Daniel Veillard
2003-03-18 00:31:04 +00:00
parent 952379b780
commit c3da18a148
7 changed files with 226 additions and 30 deletions

View File

@ -1057,10 +1057,11 @@ error:
/**
* xmlSchemaValidatePredefinedType:
* xmlSchemaValPredefTypeNode:
* @type: the predefined type
* @value: the value to check
* @val: the return computed value
* @node: the node containing the value
*
* Check that a value conforms to the lexical space of the predefined type.
* if true a value is computed and returned in @val.
@ -1069,8 +1070,8 @@ error:
* and -1 in case of internal or API error.
*/
int
xmlSchemaValidatePredefinedType(xmlSchemaTypePtr type, const xmlChar *value,
xmlSchemaValPtr *val) {
xmlSchemaValPredefTypeNode(xmlSchemaTypePtr type, const xmlChar *value,
xmlSchemaValPtr *val, xmlNodePtr node) {
xmlSchemaValPtr v;
int ret;
@ -1411,6 +1412,37 @@ xmlSchemaValidatePredefinedType(xmlSchemaTypePtr type, const xmlChar *value,
}
}
return(0);
} else if (type == xmlSchemaTypeIdrefDef) {
ret = xmlValidateNCName(value, 1);
if ((ret == 0) && (val != NULL)) {
TODO;
}
if ((ret == 0) && (node != NULL) &&
(node->type == XML_ATTRIBUTE_NODE)) {
xmlAttrPtr attr = (xmlAttrPtr) node;
xmlAddRef(NULL, node->doc, value, attr);
attr->atype = XML_ATTRIBUTE_IDREF;
}
return(ret);
} else if (type == xmlSchemaTypeIdDef) {
ret = xmlValidateNCName(value, 1);
if ((ret == 0) && (val != NULL)) {
TODO;
}
if ((ret == 0) && (node != NULL) &&
(node->type == XML_ATTRIBUTE_NODE)) {
xmlAttrPtr attr = (xmlAttrPtr) node;
xmlIDPtr res;
res = xmlAddID(NULL, node->doc, value, attr);
if (res == NULL) {
ret = 2;
} else {
attr->atype = XML_ATTRIBUTE_ID;
}
}
return(ret);
} else {
TODO
return(0);
@ -1418,6 +1450,24 @@ xmlSchemaValidatePredefinedType(xmlSchemaTypePtr type, const xmlChar *value,
return(-1);
}
/**
* xmlSchemaValidatePredefinedType:
* @type: the predefined type
* @value: the value to check
* @val: the return computed value
*
* Check that a value conforms to the lexical space of the predefined type.
* if true a value is computed and returned in @val.
*
* Returns 0 if this validates, a positive error code number otherwise
* and -1 in case of internal or API error.
*/
int
xmlSchemaValidatePredefinedType(xmlSchemaTypePtr type, const xmlChar *value,
xmlSchemaValPtr *val) {
return(xmlSchemaValPredefTypeNode(type, value, val, NULL));
}
/**
* xmlSchemaCompareDecimals:
* @x: a first decimal value