|
||||||
SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC |
::xotcl::Object | +--::xox::XmlNodeWriter
SimpleXmlNodeWriter writes a simpler form of XML than does XmlNodeWriter
Variables | |||
Name | Default Value | Class | Comment |
dom |
::xox::XmlNodeWriter | The DOM object that is currently being created by generateXml |
|
externalRootNodes |
::xox::XmlNodeWriter | Other root nodes that may be found during root node check when writing XML. |
|
rootNode |
::xox::XmlNodeWriter | The root ::xox::Node that is being written to XML |
Methods | |
Name | Comment |
buildVariable {parentDomNode node variable}
| Creates the DOM nodes needed to represent the variable and values of a variable on a ::xox:Node |
buildVariableXml {parentDomNode variable value {valueType ""}}
| Creates a new DOM node as a child of parentDomNode that represents the variable and value of a variable on a ::xox::Node |
buildXml {parentDomNode node}
| Recursive call that builds the XML from a subtree of ::xox::Nodes |
isTemp {x}
|
Methods from ::xotcl::Object |
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, garbageCollect, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
|
Instproc Detail |
Creates the DOM nodes needed to represent the variable and values of a variable on a ::xox:Node. Arguments: parentDomNode - The parent DOM node to create the new DOM nodes under. node - A reference to the ::xox::Node that has the variable, variable. variable - The variable name.
parentDomNode
node
variable
::xox::SimpleXmlNodeWriter instproc buildVariable {parentDomNode node variable} { my instvar dom set value [ $node set $variable ] regsub -all {&} $value { } value if { "" == "$value" } { return } if [ my isTemp $value ] { return } my buildVariableXml $parentDomNode ${variable} $value }
Creates a new DOM node as a child of parentDomNode that represents the variable and value of a variable on a ::xox::Node. Creates a new DOM node with the name of the name of the variable. The text value of the DOM node is the value of the variable. Optionally the variable DOM node may have a valueType. This may be the value: path or paths. Path and paths valueTypes are used to denote that the value is a path to an object in the ::xox::Node tree. Arguments: parentDomNode - the DOM node to create the new DOM nodes under. variable - The name of the variable to convert to XML DOM. value - The value of the variable. valueType - The type of value in the value node.
parentDomNode
variable
value
valueType
- optional, default value: ""
::xox::SimpleXmlNodeWriter instproc buildVariableXml {parentDomNode variable value {valueType ""}} { my instvar dom set variableNode [ $dom createElement $variable ] if [ catch { set valueText [ $dom createTextNode $value ] } ] { if [ catch { set valueText [ $dom createCDATASection $value ] } ] { return } } if { "$valueType" != "" } { $variableNode setAttribute type $valueType } $variableNode appendChild $valueText $parentDomNode appendChild $variableNode }
Recursive call that builds the XML from a subtree of ::xox::Nodes. buildXml creates DOM nodes that represent all the variables, array variables, mixins, and child nodes for this subtree starting with node.
parentDomNode
node
::xox::SimpleXmlNodeWriter instproc buildXml {parentDomNode node} { my instvar dom foreach var [ lsort [ $node info vars ] ] { if { "$var" == "nodeName" } { continue } if { "$var" == "__autonames" } { continue } if [ $node array exists $var ] { my buildArrayVariable $parentDomNode $node $var } else { my buildVariable $parentDomNode $node $var } } foreach subElement [ $node nodes ] { if [ $subElement hasclass ::xox::Node ] { my buildNodeXml $parentDomNode $subElement } } }
x
::xox::SimpleXmlNodeWriter instproc isTemp {x} { return [ string match ::xotcl::__* $x ] }