[xml] [PATCH] normalizedString schema datatype



Hello,

This patch implements the normalizedString schema datatype which is currently a TODO. Since a derived type, token, was already implemented, I based the code on that.

-John Belmonte
--- xmlschemastypes.c.orig      2004-01-21 21:49:03.000000000 -0500
+++ xmlschemastypes.c   2004-01-21 21:49:17.000000000 -0500
@@ -1477,8 +1477,27 @@
             goto error;
         case XML_SCHEMAS_STRING:
             goto return0;
-        case XML_SCHEMAS_NORMSTRING:
-            TODO goto return0;
+        case XML_SCHEMAS_NORMSTRING:{
+                const xmlChar *cur = value;
+
+                while (*cur != 0) {
+                    if ((*cur == 0xd) || (*cur == 0xa) || (*cur == 0x9)) {
+                        goto return1;
+                    } else {
+                        cur++;
+                    }
+                }
+                if (val != NULL) {
+                    v = xmlSchemaNewValue(XML_SCHEMAS_NORMSTRING);
+                    if (v != NULL) {
+                        v->value.str = xmlStrdup(value);
+                        *val = v;
+                    } else {
+                        goto error;
+                    }
+                }
+                goto return0;
+            }
         case XML_SCHEMAS_DECIMAL:{
                 const xmlChar *cur = value, *tmp;
                 unsigned int frac = 0, len, neg = 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]