This procedure is defined in the server but not documented via ad_proc or proc_doc and may be intended as a private interface.
The procedure is defined as:
proc dom::element {method token args} {
variable elementOptionsRO
variable elementOptionsRW
GetHandle node $token node
set result {}
switch -- $method {
cget {
# Some read-only configuration options are computed
if {[llength $args] != 1} {
return -code error "too many arguments"
}
if {[regexp [format {^-(%s)$} $elementOptionsRO] [lindex $args 0] discard option]} {
switch -- $option {
tagName {
set result [lindex $node(node:nodeName) 0]
}
empty {
if {![info exists node(element:empty)]} {
return 0
} else {
return $node(element:empty)
}
}
default {
return $node(node:$option)
}
}
} elseif {[regexp [format {^-(%s)$} $elementOptionsRW] [lindex $args 0] discard option]} {
return $node(node:$option)
} else {
return -code error "unknown option \"[lindex $args 0]\""
}
}
configure {
if {[llength $args] == 1} {
return [document cget $token [lindex $args 0]]
} elseif {[llength $args] % 2} {
return -code error "no value specified for option \"[lindex $args end]\""
} else {
foreach {option value} $args {
if {[regexp [format {^-(%s)$} $elementOptionsRO] $option discard opt]} {
return -code error "attribute \"$option\" is read-only"
} elseif {[regexp [format {^-(%s)$} $elementOptionsRW] $option discard opt]} {
return -code error "not implemented"
} else {
return -code error "unknown option \"$option\""
}
}
}
}
getAttribute {
if {[llength $args] != 1} {
return -code error "wrong number of arguments"
}
upvar #0 $node(element:attributeList) attrList
catch {set result $attrList([lindex $args 0])}
}
setAttribute {
if {[llength $args] == 0 || [llength $args] > 2} {
return -code error "wrong number of arguments"
}
# TODO: Check that the attribute name is legal
upvar #0 $node(element:attributeList) attrList
set attrList([lindex $args 0]) [lindex $args 1]
}
removeAttribute {
if {[llength $args] != 1} {
return -code error "wrong number of arguments"
}
upvar #0 $node(element:attributeList) attrList
unset -nocomplain attrList([lindex $args 0])
}
getAttributeNode {
}
setAttributeNode {
}
removeAttributeNode {
}
getElementsByTagName {
if {[llength $args] != 1} {
return -code error "wrong number of arguments"
}
return [Element:GetByTagName $token [lindex $args 0]]
}
normalize {
if {[llength $args]} {
return -code error "wrong number of arguments"
}
Element:Normalize node [set $node(node:childNodes)]
}
default {
return -code error "unknown method \"$method\""
}
}
PutHandle $token node
return $result
}