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

Overview
Comment:Added schema command subcommand method info typedefinition to query defelementtype definition details.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: 81cd49d4ec5240cbadae22247d660177f3e2dd2351db8161eeaab9f9f2d51689
User & Date: rolf 2020-01-05 00:15:17
Context
2020-01-05
01:14
Added subcommand definedElementtypes to the schema command method info, returning the list of all defined element types. check-in: f3cb326ad5 user: rolf tags: schema
00:15
Added schema command subcommand method info typedefinition to query defelementtype definition details. check-in: 81cd49d4ec user: rolf tags: schema
2020-01-03
00:52
Added documentation for the schema command method validatechannel. check-in: 1774aef03a user: rolf tags: schema
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/schema.c.

3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
....
3750
3751
3752
3753
3754
3755
3756



































3757
3758
3759
3760
3761
3762
3763
    SchemaValidationStack *se;
    void *ns;
    Tcl_Obj *rObj;
    
    static const char *schemaInstanceInfoMethods[] = {
        "validationstate", "vstate", "definedElements", "stack", "toplevel",
        "expected", "definition", "validationaction", "vaction", "line",
        "column", "domNode", "nrForwardDefinitions", NULL
    };
    enum schemaInstanceInfoMethod {
        m_validationstate, m_vstate, m_definedElements, m_stack, m_toplevel,
        m_expected, m_definition, m_validationaction, m_vaction, m_line,
        m_column, m_domNode, m_nrForwardDefinitions
    };

    static const char *schemaInstanceInfoStackMethods[] = {
        "top", "inside", NULL
    };
    enum schemaInstanceInfoStackMethod {
        m_top, m_inside
................................................................................
            || cp->flags & LOCAL_DEFINED_ELEMENT
            || cp->flags & PLACEHOLDER_PATTERN_DEF) {
            SetResult ("Unknown element definition");
            return TCL_ERROR;
        }
        Tcl_AppendElement (interp, "defelement");
        Tcl_AppendElement (interp, cp->name);



































        if (cp->namespace) {
            Tcl_AppendElement (interp, cp->namespace);
        }
        if (cp->defScript) {
            Tcl_AppendElement (interp, Tcl_GetString (cp->defScript));
        }
        break;







|




|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
....
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
    SchemaValidationStack *se;
    void *ns;
    Tcl_Obj *rObj;
    
    static const char *schemaInstanceInfoMethods[] = {
        "validationstate", "vstate", "definedElements", "stack", "toplevel",
        "expected", "definition", "validationaction", "vaction", "line",
        "column", "domNode", "nrForwardDefinitions", "typedefinition", NULL
    };
    enum schemaInstanceInfoMethod {
        m_validationstate, m_vstate, m_definedElements, m_stack, m_toplevel,
        m_expected, m_definition, m_validationaction, m_vaction, m_line,
        m_column, m_domNode, m_nrForwardDefinitions, m_typedefinition
    };

    static const char *schemaInstanceInfoStackMethods[] = {
        "top", "inside", NULL
    };
    enum schemaInstanceInfoStackMethod {
        m_top, m_inside
................................................................................
            || cp->flags & LOCAL_DEFINED_ELEMENT
            || cp->flags & PLACEHOLDER_PATTERN_DEF) {
            SetResult ("Unknown element definition");
            return TCL_ERROR;
        }
        Tcl_AppendElement (interp, "defelement");
        Tcl_AppendElement (interp, cp->name);
        if (cp->namespace) {
            Tcl_AppendElement (interp, cp->namespace);
        }
        if (cp->defScript) {
            Tcl_AppendElement (interp, Tcl_GetString (cp->defScript));
        }
        break;

    case m_typedefinition:
        if (objc < 3 && objc > 4) {
            Tcl_WrongNumArgs (interp, 1, objv, "name ?namespace?");
            return TCL_ERROR;
        }
        h = Tcl_FindHashEntry (&sdata->elementType, Tcl_GetString (objv[2]));
        if (!h) {
            SetResult ("Unknown elementtype definition");
            return TCL_ERROR;
        }
        cp = Tcl_GetHashValue (h);
        ns = NULL;
        if (objc == 4) {
            ns = getNamespacePtr (sdata, Tcl_GetString (objv[3]));
        }
        while (cp && cp->namespace != ns) {
            cp = cp->next;
        }
        if (!cp
            || cp->flags & LOCAL_DEFINED_ELEMENT
            || cp->flags & PLACEHOLDER_PATTERN_DEF) {
            SetResult ("Unknown elementtype definition");
            return TCL_ERROR;
        }
        Tcl_AppendElement (interp, "defelementtype");
        Tcl_AppendElement (interp, cp->typeName);
        Tcl_AppendElement (interp, cp->name);
        if (cp->namespace) {
            Tcl_AppendElement (interp, cp->namespace);
        }
        if (cp->defScript) {
            Tcl_AppendElement (interp, Tcl_GetString (cp->defScript));
        }
        break;

Changes to tests/schema.test.

6384
6385
6386
6387
6388
6389
6390















6391
6392
6393
6394
6395
6396
6397
        set fromReportCmd ""
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result
} {0 0 1 1 1 9 1 1 16 1}
















proc schema-18 {args} {
    lappend ::result {*}$args
}
test schema-18.1 {reportcmd} {
    tdom::schema s
    s define {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
        set fromReportCmd ""
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result
} {0 0 1 1 1 9 1 1 16 1}

test schema-17.18 {info typedefinition} {
    tdom::schema s
    s prefixns {ns http://my.foo}
    s defelementtype a b ns {
        elementtype a
        elementtype a2
    }
    set result [s info typedefinition a ns]
    s delete
    set result
} {defelementtype a b http://my.foo {
        elementtype a
        elementtype a2
    }}

proc schema-18 {args} {
    lappend ::result {*}$args
}
test schema-18.1 {reportcmd} {
    tdom::schema s
    s define {