domDoc -
Manipulates an instance of a DOM document object
domDocObjCmd method ?arg arg ...?
This command manipulates one particular instance of a document
object. method indicates a specific method of the document class. These
methods should closely conform to the W3C recommendation "Document Object Model
(Core) Level 1" (http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html). Look
at these documents for a deeper understanding of the functionality.
The valid methods are:
-
documentElement ?objVar?
- Returns the top most element in the document (the root
element).
-
getElementsByTagName name
- Returns a list of all elements in the document matching
(glob style) name.
-
getElementsByTagNameNS uri localname
- Returns a list of all elements in the subtree
matching (glob style) localname and having the given namespace
uri.
-
createElement tagName ?objVar?
- Creates (allocates) a new element node with node name
tagName, append it to the hidden fragment list in the document
object and returns the node object. If objVar is given the new
node object store in this variable.
-
createElementNS url tagName ?objVar?
- Creates (allocates) a new element node within a namespace
having uri as the URI and node name tagName, which
could include the namespace prefix, append it to the hidden fragment list in
the document object and returns the node object. If objVar is
given the new node object store in this variable.
-
createTextNode text ?objVar?
- Creates (allocates) a new text node with node value
text, appends it to the hidden fragment list in the document
object and returns the node object. If objVar is given, the new
node object is stored in this variable.
-
createComment text ?objVar?
- Creates (allocates) a new comment node with value
text, appends it to the hidden fragment list in the document
object and returns the node object. If objVar is given, the new
comment node object is stored in this variable.
-
createCDATASection data ?objVar?
- Creates (allocates) a new CDATA node with node value
data, appends it to the hidden fragment list in the document
object and returns the node object. If objVar is given, the new
node object is stored in this variable.
-
createProcessingInstruction target data ?objVar?
- Creates a process instruction, appends it to the hidden
fragment list in the document object and returns the node object. If
objVar is given, the new node object is stored in this variable.
- delete
- Explicitly deletes the document, including the associated
Tcl object commands (for nodes, fragment/new nodes, the document object itself)
and the underlying DOM tree.
- getDefaultOutputMethod
- Returns the default output method of the document. This is
usually a result of a XSLT transformation.
-
asXML ?-indent none/1..8?
?-channel channelId? ?-escapeNonASCII?
- Returns the DOM tree as an (optional indented) XML string or
sends the output directly to the given channelId. If the option
-escapeNonASCII is given, every non 7 bit ASCII character in attribute
values or element PCDATA content will be escaped as character reference in
decimal representation.
-
asHTML ?-channel
channelId? ?-escapeNonASCII? ?-htmlEntities?
- Returns the DOM tree serialized acording to HTML rules (HTML
elements are recognized regardless of case, without end tags for emtpy HTML
elements etc.), as string or sends the output directly to the given
channelId. If the option -escapeNonASCII is given, every non 7 bit ASCII
character in attribute values or element PCDATA content will be escaped as
character reference in decimal representation. If the option
-htmlEntities is given, a character is outputed using a HTML 4.01
character entity reference, if one is defined for it.
-
xslt ?-parameters
parameterList? stylesheet ?outputVar?
- Applies an XSLT transformation on the whole document of the node
object using the XSLT stylesheet (given as domDoc). Returns a document
object containing the result document of that transformation and stores it in
optional outputVar. The optional -parameters option sets top
level <xsl:param> to string values. The parameterList has to be a
tcl list consisting of parameter name and value pairs.
Otherwise, if an unknown method name is given, the command with the
same name as the given metho within the namespace ::dom::domDoc is
tried to be executed. This allows quick method additions on Tcl level.
Newly created nodes are appended to a hidden fragment list. If there
are not moved into the tree they are automaticaly deleted, when the whole
document gets deleted.
dom, domNode
DOM node creation, document element