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

Overview
Comment:Fix for [011e259c69].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 090cdefdab8b98f5c6dfac4d6c46d46629ebe5c9025ec3f2b27a4fea08162522
User & Date: rolf 2019-08-12 21:12:59
References
2019-08-12
21:22 Closed ticket [011e259c69]: The getAttributeNS method doesn't accept the documented defaultValue argument. plus 5 other changes artifact: ba588ce798 user: rolf
Context
2019-08-16
13:04
Corrected speeling and better wording. check-in: 7ec866b33f user: rolf tags: trunk
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-06
23:35
Removed cruft for versions not supported anymore. check-in: 0117b3be8d user: rolf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tcldom.c.

4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751




4752

4753
4754
4755
4756
4757
4758
4759
                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;







|











>
>
>
>
|
>







4733
4734
4735
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
                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
}