Index: generic/schema.c ================================================================== --- generic/schema.c +++ generic/schema.c @@ -121,21 +121,22 @@ "ANY", "NAME", "CHOICE", "INTERLEAVE", "PATTERN", - "TEXT" + "TEXT", "VIRTUAL", "KEYSPACE_START", "KEYSPACE_END" }; static char *Schema_Quant_Type2str[] = { "ONE", "OPT", "REP", "PLUS", - "NM" + "NM", + "ERROR" }; #endif #ifndef TCL_THREADS @@ -1067,16 +1068,11 @@ } break; case SCHEMA_CTYPE_VIRTUAL: if (evalVirtual (interp, sdata, ac)) { - /* Virtual contraints are always quant ONE, so - * that the virtual constraints are called while - * looking if an element can end. Therefor we use - * here the already present mayskip mechanism to - * try further, after calling the tcl script. */ - mayskip = 1; + hm = 1; break; } else return 0; case SCHEMA_CTYPE_INTERLEAVE: @@ -1086,10 +1082,11 @@ if (rc == 1) { updateStack (se, cp, ac); return 1; } popStack (sdata); + if (rc == -1) mayskip = 1; break; case SCHEMA_CTYPE_KEYSPACE_END: candidate->keySpace->active--; if (!candidate->keySpace->active) { @@ -4204,11 +4201,11 @@ for (i = 1; i < objc; i++) { pattern->content[i-1] = (SchemaCP *) objv[i]; Tcl_IncrRefCount (objv[i]); } pattern->nc = objc; - addToContent (sdata, pattern, SCHEMA_CQUANT_OPT, 0, 0); + addToContent (sdata, pattern, SCHEMA_CQUANT_ONE, 0, 0); return TCL_OK; } static int domuniquePatternObjCmd ( Index: tests/schema.test ================================================================== --- tests/schema.test +++ tests/schema.test @@ -4692,10 +4692,38 @@ lappend result [s validate $xml errMsg] } s delete set result } {1 1 0} + +test schema-16.17 {interleave with all content cp optional} { + tdom::schema s + s defelement doc { + interleave { + element a ? + element b ? + element c ? + } + element d + } + set result [list] + foreach xml { + + + + + + + + + + } { + lappend result [s validate $xml] + } + s delete + set result +} {0 1 1 1 1 1 1 1 0} test schema-17.1 {info} { tdom::schema s s define { foreach e {a b1 b11 b2 c} { @@ -4920,11 +4948,11 @@ s event start doc lappend result {*}[s info frontexpected] s delete } set result -} {a b c a b c a b c d} +} {a b c a b c d a b c d} proc schema-18 {args} { lappend ::result {*}$args } test schema-18.1 {reportcmd} {