This method creates Tcl commands, which in turn create
tDOM nodes. Tcl commands created by this command are only
available inside a script given to the domNode methods
appendFromScript or insertBeforeFromScript. If
a command created with createNodeCmd is invoked in
any other context, it will return error. The created command
commandName replaces any existing command or
procedure with that name. If the commandName includes
any namespace qualifiers, it is created in the specified
namespace. The -tagName option is only allowed for
the elementNode type. The -jsonType option is only
allowed for elementNode and textNode types.
If such command is invoked inside a script given as argument to the
domNode method appendFromScript or
insertBeforeFromScript it creates a new node and appends this
node at the end of the child list of the invoking element node. If the
option -returnNodeCmd was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the createNodeCmd. The syntax of the created
command depends on the type of the node it creates.
If the command type to create is elementNode, the created
command will create an element node, if called. Without the
-tagName option the tag name of the created node is
commandName without namespace qualifiers. If the
-tagName option was given then the created command the created
elements will have this tag name. If the -jsonType option was
given then the created node elements will have the given JSON type. If
the -namespace option is given the created element node will be
XML namespaced and in the namespace given by the option. The element
name will be literal as given either by the command name or the
-tagname option, if that was given. An appropriate XML
namespace declaration will be automatically added, to bind the prefix
(if the element name has one) or the default namespace (if the element
name hasn't a prefix) to the namespace if such a binding isn't in
scope.
The syntax of the created command is:
elementNodeCmd ?attributeName attributeValue ...? ?script?
elementNodeCmd ?-attributeName attributeValue ...? ?script?
elementNodeCmd name_value_list script
The command syntax allows three different ways to specify the attributes of
the resulting element. These could be specified with attributeName
attributeValue argument pairs, in an "option style" way with
-attriubteName attributeValue argument pairs (the '-' character is only
syntactical sugar and will be stripped off) or as a Tcl list with elements
interpreted as attribute name and the corresponding attribute value.
The attribute name elements in the list may have a leading '-' character, which
will be stripped off.
Every elementNodeCmd accepts an optional Tcl script as last
argument. This script is evaluated as recursive appendFromScript script
with the node created by the elementNodeCmd as parent of all nodes
created by the script.
If the first argument of the method is textNode, the command
will create a text node. If the -jsonType option was given then
the created text node will have that JSON type. The syntax of the
created command is:
textNodeCmd ?-disableOutputEscaping? data
If the optional flag -disableOutputEscaping is given, the
escaping of the ampersand character (&) and the left angle bracket (<)
inside the data is disabled. You should use this flag carefully.
If the first argument of the method is commentNode or
cdataNode the command will create an comment node or CDATA section
node. The syntax of the created command is:
nodeCmd data
If the first argument of the method is piNode, the command will
create a processing instruction node. The syntax of the created
command is:
piNodeCmd target data