SET xmlfile FIND *|tag [cexpr [loper …]] [/In|Out /First|Next] [/Element|Processinginstruction|Doctype] [/Y]
Search for a node of the selected type (/E = default, /P, /D, see SET file GOTO) with the tag *|tag on the level of the selected element. For nodes of type 'element' the arguments cexpr (conditional expression for attribute values) and loper (logical operator) are formatted and processed similarly to the SET table FIND function (e.g. attributename:<=:1000 or attributename:=I:a*.0* and so on). Use the option /First (default) to begin search at the first element in the section and /Next to start with the element following the selected element. If the node is found, it is selected, otherwise the selection remains unaffected. If the option /Y is specified, then tag is treated as a DOCTYPE class name, rather than an XML element tag (this means derived types are also recognised).
The shell variable RC is set to the integer 7 if the command was syntactically correct, but no element was found. The shell variable RC is set to the integer value 0 if an element corresponding to the search criteria was found.
format of cexpr |
description |
|||||||||||||||||||||
attrname:cond |
Check if a value is or is not assigned to an attribute. attrname (the name of the attribute (case sensitive!)) |
|||||||||||||||||||||
attrname:cond:value |
Check the value of an attribute attrname name of the attribute (case sensitive!) |
|||||||||||||||||||||
attributename:cond:mask |
Match the value of an element's attribute
|
|||||||||||||||||||||
Find and delete the first element on the current level with the attribute ID with a value of 3.
$#f find * 'ID:==:3' /First
if '$rc' == '0' $#f deleteelement
SET xmlfile FIND postable posfield tag [cexpr [loper cexpr ...] ...] [/Recursive /Y]
Like the above FIND commands, except that the command does not return when it finds the first match, rather it saves the position of all matching elements in one field (posfield) of the specified table (postable). If the option /R is specified, the whole sub-tree is searched. If the option /Y is specified, the tag string is treated as a DOCTYPE class name rather than an element tag, and all derived classes are searched.
posTable
The extended table in which to store element positions.
posField
The extended table field in which to store element positions.
For all other parameters, please see the previous command.
// find all elements with a specific numerical attribute value
$#f find $#t $#tField $#elem '$#elemAttr:==:$#elemattrvalue' /Recursive