util::tdomNodes2dict (private)
util::tdomNodes2dict nodes parentType
Defined in packages/acs-tcl/tcl/json-procs.tcl
Helper proc for util::json2dict, which returns the tDOM structure in the form of a Tcl dict. Use this proc only on dom structures created with "porse -json", since it depends on the internal node structure of tDOM. It would be certainly better to have this function built-in in tDOM (call like "asDict", similar to "asXML")
- Parameters:
- nodes (required)
- parentType (required)
- Returns:
- dict
- Author:
- Gustaf Neumann
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set result "" foreach n $nodes { set children [$n childNodes] set jsonType [$n jsonType] set childrendValue [util::tdomNodes2dict $children $jsonType] switch $jsonType { OBJECT { if {[$n nodeName] ne "objectcontainer" || $parentType eq "OBJECT"} { lappend result [$n nodeName] } lappend result $childrendValue } NONE { lappend result [$n nodeName] $childrendValue } ARRAY { if {[$n nodeName] ne "arraycontainer" || $parentType eq "OBJECT"} { lappend result [$n nodeName] } lappend result $childrendValue } default { set op [expr {[llength $nodes] > 1 ? "lappend" : "set"} ] $op result [$n nodeValue] } } } return $resultXQL Not present: Generic, PostgreSQL, Oracle