我正在尝试打印节点值,但它什么也没打印。这是代码:
package require dom;
set XML "
<top number='1'>
<a>Name</a>
<b>589</b>
<email>name@example.com</email>
<website/>
<parts>
<widget sku='XYZ123' />
<widget sku='ABC789' />
</parts>
</top>
"
set doc [::dom::parse $XML]
set root [$doc cget -documentElement]
set node [$root cget -firstChild]
set node [$root cget -nextSibling]
set node [$root cget -firstChild]
puts "[$node cget -nodeValue]"