Model Railroad System
2.2.2
|
A simple DOM element coded in Tcl using SNIT. More...
Public Member Functions | |
SimpleDOMElement (name,...) | |
The constructor. More... | |
children () | |
Method to return the elements children. More... | |
addchild (childnode) | |
Method to add a child node. More... | |
length () | |
Method to return the number of children. More... | |
data () | |
Method to return the element's data. More... | |
setdata (d) | |
Method to set the element's data. More... | |
display (fp="stdout", indent="") | |
Method to display a node, along with its children, and a proper XML document. More... | |
attribute (attrname) | |
Method to return a selected attribute's value. More... | |
setAttribute (attrname, value="") | |
Method to set a selected attribute's value. More... | |
getElementsByTagName (thetag,...) | |
Method to return all of the elements under this element with the specified tag name. More... | |
getElementsById (theid) | |
Method to return all of the elements under this element with the specified value of their id attribute. More... | |
isChild (item) | |
Method to check if the item is a child of this node. More... | |
getParent (item) | |
Method to get the parent of the item. More... | |
removeChild (item) | |
Method to remove item from the children of this node. More... | |
Static Public Member Functions | |
static | _formattrlist (attrs) |
@provatesection Format a attribute list for inclusion in displayed XML. More... | |
static | _quoteXML (text) |
Escape text for inclusion in displayed XML. More... | |
static | validate (object) |
Validation typemethod. More... | |
Private Attributes | |
_data | |
The element's data. More... | |
_children | |
The element's children. More... | |
A simple DOM element coded in Tcl using SNIT.
This class implements a simplified DOM element, that implements the getElementsByTagName and getElementsById methods, along with accessors to get data, attributes, and children of XML elements.
name | Element name. Generally %%AUTO%% is passed. |
_ | Options:
|
SimpleDOMElement::SimpleDOMElement | ( | name | , |
... | |||
) |
The constructor.
Just sets the options.
|
static |
@provatesection Format a attribute list for inclusion in displayed XML.
attrs | The attribute list as a alterning list of names and values. |
|
static |
Escape text for inclusion in displayed XML.
text | Unescaped string. |
SimpleDOMElement::addchild | ( | childnode | ) |
Method to add a child node.
childnode | The child node to add. |
SimpleDOMElement::attribute | ( | attrname | ) |
Method to return a selected attribute's value.
attrname | The name of the attribute. |
SimpleDOMElement::children | ( | ) |
Method to return the elements children.
SimpleDOMElement::data | ( | ) |
Method to return the element's data.
SimpleDOMElement::display | ( | fp | = "stdout" , |
indent | = "" |
||
) |
Method to display a node, along with its children, and a proper XML document.
fp | Channel to write the display to. |
indent | The indentation to use. |
SimpleDOMElement::getElementsById | ( | theid | ) |
Method to return all of the elements under this element with the specified value of their id attribute.
theid | The id value match. |
SimpleDOMElement::getElementsByTagName | ( | thetag | , |
... | |||
) |
Method to return all of the elements under this element with the specified tag name.
thetag | The tag to match. |
SimpleDOMElement::getParent | ( | item | ) |
Method to get the parent of the item.
item | The item to get the parent of. |
SimpleDOMElement::isChild | ( | item | ) |
Method to check if the item is a child of this node.
item | The possible child. |
SimpleDOMElement::length | ( | ) |
Method to return the number of children.
SimpleDOMElement::removeChild | ( | item | ) |
Method to remove item from the children of this node.
item | The item to remove. |
SimpleDOMElement::setAttribute | ( | attrname | , |
value | = "" |
||
) |
Method to set a selected attribute's value.
attrname | The name of the attribute. |
value | The value to set. Default is the empty string. |
SimpleDOMElement::setdata | ( | d | ) |
Method to set the element's data.
d | The new data. |
|
static |
Validation typemethod.
Raises an error if its argument is not a SimpleDOMElement object.
object | The object to typecheck. |
|
private |
The element's children.
|
private |
The element's data.