<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > XML. - after parse > XML-Parser * XML. (after Parse) |
MiniRobotLanguage (MRL)
XML.Search Pattern Down
XML.spdn
Search a textual pattern in downward direction
Intention
This command is a textual search that will search "brute force" through the tags for any matching textual pattern.
As usual, you can use 3.2 Standard-Search Pattern that are perfect for these cases.
Technically this command will start at the next "Start Tag" in downward direction, and then scan inside of "Open Bracket" to "Close Bracket" for the wanted Textual Pattern..
This way you can search any combination of attribute and values or other Tag combinations, like multiple attributes or values.
You can use spup - Search Pattern Up for the same type of search in reverse direction.
In case the search was successful, the actual position will be changed to the Start-Tag (Open Bracket) of the Tag that contains the textual pattern.
Syntax
XML.spdn|P2[|P3][|P4]
Parameter Explanation
P2 - Pattern to search for. Use 3.2 Standard-Search Pattern or a part of the wanted text.
P3 - (optional) Result, numeric position
P4 - (optional) Count, in case there are multiple fitting matches per Tag.
Example
'***********************************
'
'***********************************
'
$$XMF=?pfad\SQ_XML.txt
NEF.$$XMF
MBX.File $$XMF was not found!
GTO.enx
EIF.
' Now we are going to parse it
XML.Load File|$$XMF
' We check if there are errors
JIT.Lab_Err
' We get the "actual position" - after parsing.
XML.get pos|$$POS
PRT.Actual Position after Parsing is: $$POS
' Here we search ...
PRT.------------------------
XML.spdn|Sqnumbe
XML.get pos|$$POA
PRT.Actual Position after sdn is: $$POA
GSB.dump
PRT.------------------------
XML.spup|likna
XML.get pos|$$POA
PRT.Actual Position after sdn is: $$POA
GSB.dump
MBX.!
:enx
ENR.
'-----------------------------------------------------------
:dump
PRT.------------------------
XML.Dump|($$POA-3)|($$POA+14)
RET.
' Error Handler
:Lab_Err
XML.get error|$$ERT
DBP.$$ERT
ENR.
This is the result of the sample script:
Remarks
-
Limitations:
-
See also:
• ! Smart Package Robot 's XML-Features
• XML. - eXtended Markup Language
•