Check-in [0b5d3f4ece]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Corrections toXML -> Dictionary conversion for new changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0b5d3f4ece31ab2d909aec8e3010f90df61cfb6f
User & Date: gerald 2013-04-10 02:14:44
Context
2013-04-10 02:34
Documentation for chagnes dealing with attributes. check-in: 1f1af1e51b user: gerald tags: trunk
2013-04-10 02:14
Corrections toXML -> Dictionary conversion for new changes. check-in: 0b5d3f4ece user: gerald tags: trunk
2013-04-09 20:24
Generalization of attributes defined in "http://www.w3.org/2001/XMLSchema-instance", aka "type" and "nil" in particular. Also added support for ::value instead of {} for value of tag. check-in: cfdc32b392 user: gerald tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Utilities.tcl.

1309
1310
1311
1312
1313
1314
1315

1316
1317
1318
1319
1320
1321
1322
....
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437




1438
1439
1440
1441
1442
1443
1444
....
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459




1460
1461
1462
1463
1464
1465
1466
....
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485




1486
1487
1488
1489
1490
1491
1492
....
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512




1513
1514
1515
1516
1517
1518
1519
    variable options

    if {$options(valueAttrCompatiblityMode)} {
        set valueAttr {}
    } else {
        set valueAttr {::value}
    }

    ::log::log debug [list ::WS::Utils::convertTypeToDict $mode $serviceName $node $type $root $isArray]
    if {[dict exists $typeInfo $mode $serviceName $type]} {
        set typeName $type
    } else {
        set typeName $serviceName:$type
    }
    set typeDefInfo [dict get $typeInfo $mode $serviceName $typeName]
................................................................................
        }
        switch -exact -- $typeInfoList {
            {0 0} {
                ##
                ## Simple non-array
                ##
                if {$options(parseInAttr)} {
                    foreach attr [$item attributes] {
                        if {[llength $attr] == 1} {
                            set attrValue [$item getAttribute $attr]
                            if {[string match $xsiNsPattern $attr]} {
                                set attr [string range $attr [string length $xsiNsPattern] end]
                            }




                            dict set results $partName $attr $attrValue
                        }
                    }
                    dict set results $partName $valueAttr [$item asText]
                } else {
                    dict set results $partName [$item asText]
                }
................................................................................
                ##
                ## Simple array
                ##
                set tmp {}
                foreach row $item {
                    if {$options(parseInAttr)} {
                        set rowList {}
                        foreach attr [$row attributes] {
                            set attrValue [$row getAttribute $attr]
                            if {[llength $attr] == 1} {
                                if {[string match $xsiNsPattern $attr]} {
                                    set attr [string range $attr [string length $xsiNsPattern] end]
                                }




                                lappend rowList $attr $attrValue
                            }
                        }
                        lappend rowList $valueAttr [$row asText]
                        lappend tmp $rowList
                    } else {
                        lappend tmp [$row asText]
................................................................................
                ## Non-simple non-array
                ##
                if {$options(parseInAttr)} {
                    if {$isAbstract && [$item hasAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]} {
                        set partType [$item getAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]
                        $item removeAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type
                    }
                    foreach attr [$item attributes] {
                        if {[llength $attr] == 1} {
                            set attrValue [$item getAttribute $attr]
                            if {[string match $xsiNsPattern $attr]} {
                                set attr [string range $attr [string length $xsiNsPattern] end]
                            }




                            dict set results $partName $attr $attrValue
                        }
                    }
                    dict set results $partName $valueAttr [convertTypeToDict $mode $serviceName $item $partType $root]
                } else {
                    dict set results $partName [convertTypeToDict $mode $serviceName $item $partType $root]
                }
................................................................................
                foreach row $item {
                    if {$options(parseInAttr)} {
                        set rowList {}
                        if {$isAbstract && [$row hasAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]} {
                            set partType [$row getAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]
                            $row removeAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type
                        }
                        foreach attr [$row attributes] {
                            if {[llength $attr] == 1} {
                                set attrValue [$row getAttribute $attr]
                                if {[string match $xsiNsPattern $attr]} {
                                    set attr [string range $attr [string length $xsiNsPattern] end]
                                }




                                lappend rowList $attr $attrValue
                            }
                        }
                        lappend rowList $valueAttr [convertTypeToDict $mode $serviceName $row $partType $root 1]
                        lappend tmp $rowList
                    } else {
                        lappend tmp [convertTypeToDict $mode $serviceName $row $partType $root 1]






>







 







|
|
|
|
|
|
>
>
>
>







 







|
|
|
|
|
|
>
>
>
>







 







|
|
|
|
|
|
>
>
>
>







 







|
|
|
|
|
|
>
>
>
>







1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
....
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
....
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
....
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
....
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
    variable options

    if {$options(valueAttrCompatiblityMode)} {
        set valueAttr {}
    } else {
        set valueAttr {::value}
    }
    set xsiNsUrl {http://www.w3.org/2001/XMLSchema-instance}
    ::log::log debug [list ::WS::Utils::convertTypeToDict $mode $serviceName $node $type $root $isArray]
    if {[dict exists $typeInfo $mode $serviceName $type]} {
        set typeName $type
    } else {
        set typeName $serviceName:$type
    }
    set typeDefInfo [dict get $typeInfo $mode $serviceName $typeName]
................................................................................
        }
        switch -exact -- $typeInfoList {
            {0 0} {
                ##
                ## Simple non-array
                ##
                if {$options(parseInAttr)} {
                    foreach attrList [$item attributes] {
                        lassign $attrList attr nsAlias nsUrl
                        if {[string equal $nsUrl $xsiNsUrl]} {
                            set attrValue [$item getAttribute ${nsAlias}:$attr]
                            dict set results $partName ::$attr $attrValue
                        } elseif {![string equal $nsAlias {}]} {
                            set attrValue [$item getAttribute ${nsAlias}:$attr]
                            dict set results $partName $attr $attrValue
                        } else {
                            set attrValue [$item getAttribute $attr]
                            dict set results $partName $attr $attrValue
                        }
                    }
                    dict set results $partName $valueAttr [$item asText]
                } else {
                    dict set results $partName [$item asText]
                }
................................................................................
                ##
                ## Simple array
                ##
                set tmp {}
                foreach row $item {
                    if {$options(parseInAttr)} {
                        set rowList {}
                        foreach attrList [$row attributes] {
                            lassign $attrList attr nsAlias nsUrl
                            if {[string equal $nsUrl $xsiNsUrl]} {
                                set attrValue [$row getAttribute ${nsAlias}:$attr]
                                lappend rowList ::$attr $attrValue
                            } elseif {![string equal $nsAlias {}]} {
                                set attrValue [$row getAttribute ${nsAlias}:$attr]
                                lappend rowList $attr $attrValue
                            } else {
                                set attrValue [$row getAttribute $attr]
                                lappend rowList $attr $attrValue
                            }
                        }
                        lappend rowList $valueAttr [$row asText]
                        lappend tmp $rowList
                    } else {
                        lappend tmp [$row asText]
................................................................................
                ## Non-simple non-array
                ##
                if {$options(parseInAttr)} {
                    if {$isAbstract && [$item hasAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]} {
                        set partType [$item getAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]
                        $item removeAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type
                    }
                    foreach attrList [$item attributes] {
                        lassign $attrList attr nsAlias nsUrl
                        if {[string equal $nsUrl $xsiNsUrl]} {
                            set attrValue [$item getAttribute ${nsAlias}:$attr]
                            dict set results $partName ::$attr $attrValue
                        } elseif {![string equal $nsAlias {}]} {
                            set attrValue [$item getAttribute ${nsAlias}:$attr]
                            dict set results $partName $attr $attrValue
                        } else {
                            set attrValue [$item getAttribute $attr]
                            dict set results $partName $attr $attrValue
                        }
                    }
                    dict set results $partName $valueAttr [convertTypeToDict $mode $serviceName $item $partType $root]
                } else {
                    dict set results $partName [convertTypeToDict $mode $serviceName $item $partType $root]
                }
................................................................................
                foreach row $item {
                    if {$options(parseInAttr)} {
                        set rowList {}
                        if {$isAbstract && [$row hasAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]} {
                            set partType [$row getAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type]
                            $row removeAttributeNS {http://www.w3.org/2001/XMLSchema-instance} type
                        }
                        foreach attrList [$row attributes] {
                            lassign $attrList attr nsAlias nsUrl
                            if {[string equal $nsUrl $xsiNsUrl]} {
                                set attrValue [$row getAttribute ${nsAlias}:$attr]
                                lappend rowList ::$attr $attrValue
                            } elseif {![string equal $nsAlias {}]} {
                                set attrValue [$row getAttribute ${nsAlias}:$attr]
                                lappend rowList $attr $attrValue
                            } else {
                                set attrValue [$row getAttribute $attr]
                                lappend rowList $attr $attrValue
                            }
                        }
                        lappend rowList $valueAttr [convertTypeToDict $mode $serviceName $row $partType $root 1]
                        lappend tmp $rowList
                    } else {
                        lappend tmp [convertTypeToDict $mode $serviceName $row $partType $root 1]