Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Save work.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip
Files: files | file ages | folders
SHA3-256: b26625af9b9b54e43105787e71e0d453905186909726a5f14241845baf7339f3
User & Date: rolf 2019-10-06 23:40:51
Context
2019-10-07
09:33
Renamed the info method subcommand frontexpected of the validation commands to the hopefully better name nextexpected. check-in: d889feb189 user: rolf tags: wip
2019-10-06
23:40
Save work. check-in: b26625af9b user: rolf tags: wip
2019-10-05
00:16
More minor doc tweaking. check-in: 43e20be75b user: rolf tags: wip
Changes

Changes to generic/schema.c.

   119    119   #if defined(DEBUG) || defined(DDEBUG)
   120    120   static char *Schema_CP_Type2str[] = {
   121    121       "ANY",
   122    122       "NAME",
   123    123       "CHOICE",
   124    124       "INTERLEAVE",
   125    125       "PATTERN",
   126         -    "TEXT"
          126  +    "TEXT",
   127    127       "VIRTUAL",
   128    128       "KEYSPACE_START",
   129    129       "KEYSPACE_END"
   130    130   };
   131    131   static char *Schema_Quant_Type2str[] = {
   132    132       "ONE",
   133    133       "OPT",
   134    134       "REP",
   135    135       "PLUS",
   136         -    "NM"
          136  +    "NM",
          137  +    "ERROR"
   137    138   };
   138    139   #endif
   139    140   
   140    141   
   141    142   #ifndef TCL_THREADS
   142    143     static SchemaData *activeSchemaData = 0;
   143    144   # define GETASI activeSchemaData
................................................................................
  1065   1066                       if (!mayskip && mayMiss (candidate->quants[i]))
  1066   1067                           mayskip = 1;
  1067   1068                   }
  1068   1069                   break;
  1069   1070   
  1070   1071               case SCHEMA_CTYPE_VIRTUAL:
  1071   1072                   if (evalVirtual (interp, sdata, ac)) {
  1072         -                    /* Virtual contraints are always quant ONE, so
  1073         -                     * that the virtual constraints are called while
  1074         -                     * looking if an element can end. Therefor we use
  1075         -                     * here the already present mayskip mechanism to
  1076         -                     * try further, after calling the tcl script. */
  1077         -                    mayskip = 1;
         1073  +                    hm = 1;
  1078   1074                       break;
  1079   1075                   }
  1080   1076                   else return 0;
  1081   1077   
  1082   1078               case SCHEMA_CTYPE_INTERLEAVE:
  1083   1079               case SCHEMA_CTYPE_PATTERN:
  1084   1080                   pushToStack (sdata, candidate, ac);
  1085   1081                   rc = matchElementStart (interp, sdata, name, namespace);
  1086   1082                   if (rc == 1) {
  1087   1083                       updateStack (se, cp, ac);
  1088   1084                       return 1;
  1089   1085                   }
  1090   1086                   popStack (sdata);
         1087  +                if (rc == -1) mayskip = 1;
  1091   1088                   break;
  1092   1089   
  1093   1090               case SCHEMA_CTYPE_KEYSPACE_END:
  1094   1091                   candidate->keySpace->active--;
  1095   1092                   if (!candidate->keySpace->active) {
  1096   1093                       if (candidate->keySpace->unknownIDrefs) {
  1097   1094                           if (!recover (interp, sdata, S("UNKNOWN_KEYREF"),
................................................................................
  4202   4199        * cmd. */
  4203   4200       pattern->content = MALLOC (sizeof (Tcl_Obj*) * (objc));
  4204   4201       for (i = 1; i < objc; i++) {
  4205   4202           pattern->content[i-1] = (SchemaCP *) objv[i];
  4206   4203           Tcl_IncrRefCount (objv[i]);
  4207   4204       }
  4208   4205       pattern->nc = objc;
  4209         -    addToContent (sdata, pattern, SCHEMA_CQUANT_OPT, 0, 0);
         4206  +    addToContent (sdata, pattern, SCHEMA_CQUANT_ONE, 0, 0);
  4210   4207       return TCL_OK;
  4211   4208   }
  4212   4209   
  4213   4210   static int
  4214   4211   domuniquePatternObjCmd (
  4215   4212       ClientData clientData,
  4216   4213       Tcl_Interp *interp,

Changes to tests/schema.test.

  4690   4690           {<doc><items><b/><b/><c/></items><items><a/><c/></items><items><b/><a/><c/></items></doc>}
  4691   4691       } {
  4692   4692           lappend result [s validate $xml errMsg]
  4693   4693       }
  4694   4694       s delete
  4695   4695       set result
  4696   4696   } {1 1 0}
         4697  +
         4698  +test schema-16.17 {interleave with all content cp optional} {
         4699  +    tdom::schema s
         4700  +    s defelement doc {
         4701  +        interleave {
         4702  +            element a ?
         4703  +            element b ?
         4704  +            element c ?
         4705  +        }
         4706  +        element d
         4707  +    }
         4708  +    set result [list]
         4709  +    foreach xml {
         4710  +        <doc/>
         4711  +        <doc><a/><d/></doc>
         4712  +        <doc><b/><d/></doc>
         4713  +        <doc><c/><d/></doc>
         4714  +        <doc><a/><c/><d/></doc>
         4715  +        <doc><b/><c/><d/></doc>
         4716  +        <doc><c/><a/><d/></doc>
         4717  +        <doc><c/><a/><b/><d/></doc>
         4718  +        <doc><c/><a/><b/></doc>
         4719  +    } {
         4720  +        lappend result [s validate $xml]
         4721  +    }
         4722  +    s delete
         4723  +    set result
         4724  +} {0 1 1 1 1 1 1 1 0}
  4697   4725   
  4698   4726   test schema-17.1 {info} {
  4699   4727       tdom::schema s
  4700   4728       s define {
  4701   4729           foreach e {a b1 b11 b2 c} {
  4702   4730               defelement $e {}
  4703   4731           }
................................................................................
  4918   4946           tdom::schema s
  4919   4947           s defelement doc $def
  4920   4948           s event start doc
  4921   4949           lappend result {*}[s info frontexpected]
  4922   4950           s delete
  4923   4951       }
  4924   4952       set result
  4925         -} {a b c a b c a b c d}
         4953  +} {a b c a b c d a b c d}
  4926   4954   
  4927   4955   proc schema-18 {args} {
  4928   4956       lappend ::result {*}$args
  4929   4957   }
  4930   4958   test schema-18.1 {reportcmd} {
  4931   4959       tdom::schema s
  4932   4960       s define {