tDOM

Check-in [cafa5160c0]
Login

Check-in [cafa5160c0]

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

Overview
Comment:Fix for [011e259c69].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: cafa5160c033e7945e7b534b9a11ff6c0a5792fd33e062f53bd27b6e137f8ddc
User & Date: rolf 2019-08-12 21:11:05.308
Context
2019-08-16
15:20
Merged from trunk. check-in: 5cf43bf74a user: rolf tags: schema
2019-08-12
21:12
Fix for [011e259c69]. check-in: 090cdefdab user: rolf tags: trunk
21:11
Fix for [011e259c69]. check-in: cafa5160c0 user: rolf tags: schema
2019-08-11
01:35
Added xsd like boolean text constraint. check-in: c24f4e9aeb user: rolf tags: schema
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tcldom.c.
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754




4755

4756
4757
4758
4759
4760
4761
4762
                Tcl_AppendResult(interp, "Attribute \"", attr_name,
                                 "\" not found!", NULL);
                return TCL_ERROR;
            }
            break;

        case m_getAttributeNS:
            CheckArgs(4,4,2,"uri localName");
            if (node->nodeType != ELEMENT_NODE) {
                SetResult("NOT_AN_ELEMENT : there are no attributes");
                return TCL_ERROR;
            }
            uri = Tcl_GetString(objv[2]);
            localName = Tcl_GetString(objv[3]);
            attrs = domGetAttributeNodeNS(node, uri, localName);
            if (attrs) {
                SetResult(attrs->nodeValue);
                return TCL_OK;
            } 




            sprintf(tmp,"attribute with localName %80.80s not found!",localName);

            SetResult(tmp);
            return TCL_ERROR;

        case m_setAttribute:
            if (node->nodeType != ELEMENT_NODE) {
                SetResult("NOT_AN_ELEMENT : there are no attributes");
                return TCL_ERROR;







|











>
>
>
>
|
>







4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
                Tcl_AppendResult(interp, "Attribute \"", attr_name,
                                 "\" not found!", NULL);
                return TCL_ERROR;
            }
            break;

        case m_getAttributeNS:
            CheckArgs(4,5,2,"uri localName");
            if (node->nodeType != ELEMENT_NODE) {
                SetResult("NOT_AN_ELEMENT : there are no attributes");
                return TCL_ERROR;
            }
            uri = Tcl_GetString(objv[2]);
            localName = Tcl_GetString(objv[3]);
            attrs = domGetAttributeNodeNS(node, uri, localName);
            if (attrs) {
                SetResult(attrs->nodeValue);
                return TCL_OK;
            } 
            if (objc == 5) {
                SetResult(Tcl_GetString(objv[4]));
                return TCL_OK;
            } 
            sprintf(tmp,"attribute with localName %80.80s not found!",
                    localName);
            SetResult(tmp);
            return TCL_ERROR;

        case m_setAttribute:
            if (node->nodeType != ELEMENT_NODE) {
                SetResult("NOT_AN_ELEMENT : there are no attributes");
                return TCL_ERROR;
Changes to tests/domNode.test.
2382
2383
2384
2385
2386
2387
2388




































2389
2390
2391
2392
2393
2394
2395
      p:attr1="p:attr1Value"
      xmlns:p="ns1"/>}]
    set root [$doc documentElement]
    set result [$root getAttributeNS "ns1" attr1]
    $doc delete
    set result
} {p:attr1Value}





































proc domAppendChild {parent name} {
    $parent ownerDocument doc
    $doc createElement $name node
    $parent appendChild $node
}








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







2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
      p:attr1="p:attr1Value"
      xmlns:p="ns1"/>}]
    set root [$doc documentElement]
    set result [$root getAttributeNS "ns1" attr1]
    $doc delete
    set result
} {p:attr1Value}

test domNode-28.2 {getAttributeNS - default value} {
    set doc [dom parse {
<root attr1="attr1Value"
      attr2="attr2Value"
      p:attr1="p:attr1Value"
      xmlns:p="ns1"/>}]
    set root [$doc documentElement]
    set result [$root getAttributeNS "not" attr1 "default"]
    $doc delete
    set result
} {default}

test domNode-28.3 {getAttributeNS - default value} {
    set doc [dom parse {
<root attr1="attr1Value"
      attr2="attr2Value"
      p:attr1="p:attr1Value"
      xmlns:p="ns1"/>}]
    set root [$doc documentElement]
    set result [$root getAttributeNS "not" notexisting "some default"]
    $doc delete
    set result
} {some default}

test domNode-28.4 {getAttributeNS - default value} {
    set doc [dom parse {
<root attr1="attr1Value"
      attr2="attr2Value"
      p:attr1="p:attr1Value"
      xmlns:p="ns1"/>}]
    set root [$doc documentElement]
    set result [$root getAttributeNS "ns1" notexisting "some other default"]
    $doc delete
    set result
} {some other default}

proc domAppendChild {parent name} {
    $parent ownerDocument doc
    $doc createElement $name node
    $parent appendChild $node
}