diff options
author | Kasimier T. Buchcik <kbuchcik@src.gnome.org> | 2004-11-12 14:04:58 +0000 |
---|---|---|
committer | Kasimier T. Buchcik <kbuchcik@src.gnome.org> | 2004-11-12 14:04:58 +0000 |
commit | 91feaf847728bed1b1d2c3cee37e9b88fe1a8da3 (patch) | |
tree | 60cc2020a12a2e5b6f63e46127d0b50a76d7c57c /xmlschemastypes.c | |
parent | aba37dffd7235c5f7d283ca2174c84b7b1332c5e (diff) | |
download | android_external_libxml2-91feaf847728bed1b1d2c3cee37e9b88fe1a8da3.tar.gz android_external_libxml2-91feaf847728bed1b1d2c3cee37e9b88fe1a8da3.tar.bz2 android_external_libxml2-91feaf847728bed1b1d2c3cee37e9b88fe1a8da3.zip |
Correct symbol space for 'all' and 'choice'. Added 'replace' normalization
* xmlschemas.c: Correct symbol space for 'all' and 'choice'.
* xmlschemastypes.c include/xmlschemastypes.h: Added 'replace'
normalization for 'normalizedString'.
Added xmlSchemaWhiteSpaceReplace to the API.
Diffstat (limited to 'xmlschemastypes.c')
-rw-r--r-- | xmlschemastypes.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 32463624..84556b75 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -1545,6 +1545,39 @@ xmlSchemaStrip(const xmlChar *value) { } /** + * xmlSchemaWhiteSpaceReplace: + * @value: a value + * + * Replaces 0xd, 0x9 and 0xa with a space. + * + * Returns the new string or NULL if no change was required. + */ +xmlChar * +xmlSchemaWhiteSpaceReplace(const xmlChar *value) { + const xmlChar *cur = value; + xmlChar *ret = NULL, *mcur; + + if (value == NULL) + return(NULL); + + while ((*cur != 0) && + (((*cur) != 0xd) && ((*cur) != 0x9) && ((*cur) != 0xa))) { + cur++; + } + if (*cur == 0) + return (NULL); + ret = xmlStrdup(value); + /* TODO FIXME: I guess gcc will bark at this. */ + mcur = (xmlChar *) (ret + (cur - value)); + do { + if ( ((*mcur) == 0xd) || ((*mcur) == 0x9) || ((*mcur) == 0xa) ) + *mcur = ' '; + mcur++; + } while (*mcur != 0); + return(ret); +} + +/** * xmlSchemaCollapseString: * @value: a value * @@ -1753,9 +1786,14 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, if (val != NULL) *val = NULL; if ((flags == 0) && (value != NULL)) { + if ((type->builtInType != XML_SCHEMAS_STRING) && - (type->builtInType != XML_SCHEMAS_NORMSTRING)) { - norm = xmlSchemaCollapseString(value); + (type->builtInType != XML_SCHEMAS_ANYTYPE) && + (type->builtInType != XML_SCHEMAS_ANYSIMPLETYPE)) { + if (type->builtInType == XML_SCHEMAS_NORMSTRING) + norm = xmlSchemaWhiteSpaceReplace(value); + else + norm = xmlSchemaCollapseString(value); if (norm != NULL) value = norm; } |