<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > IML./NML. - after parse > XML-Parser * IML. / NML. (after Parse) |
MiniRobotLanguage (MRL)
IML.Start Tag
IML.stg
IML.Start TagZ
IML.stgz
Find out if the specified XML-Flag is set.
Intention
This command is used to analyze XML-Flags. Using this command, you can find out if the actual XML-Data-Byte is the start of a real Start-Tag or not.
Example:
<Hallo> is a Start-Tag then
</Hallo> is the End-Tag of this.
To understand this better, see the XML-Sample-Data and XML-Flags-Dump here:
There are 6 ways of using this command, depending on the number of Parameters.
' With no Parameter, IML. will use the current position
XML.Set Pos|30
IML.stg
PRT. Pos. 30 is flagged.
EIF.
' With 0ne parameter IML. will check just the given Byte
IML.stg|30
PRT. Pos. 30 is flagged.
EIF.
' With two parameters, IML: will start searching for a Bate with
' the specified Flag set, and if one is found, place that
' Bytes Number on the TOS (Top of Stack).
IML.stg|20|40
PRT. Pos. $$000 is flagged.
EIF.
Additionally you can suffixe in all three cases above the subcommand with a "z".
This will change the internal search to "Bit not set" (Z= Bit=Zero).
' Now we are scanning for "Bit not set"
IML.stgz|30|40
PRT. Pos. $$000 is the first byte after that Flag is set.
EIF.
As always NML. is the negative Form of IML.
Syntax
IML.Start Tag[|P2][|P3]
IML.stg[|P2][|P3]
Parameter Explanation
P2 - (optional) Variable with the Position, where to test the XML-Flag.
If P3 is specified, then this is the Start-Byte to scan at.
If the value in P3<P2 then the Scan is done in reverse order.
P3 - (optional) Variable with the ending position for the scan.
If P3 is specified, then P3 is the End-Byte to scan.
If the value in P3<P2 then the Scan is done in reverse order.
Example
'***********************************
'
'***********************************
'Prototype für IML.
$$PRO=Start Tag
$$TXT=Start of an Tag
$$XMF=?pfad\Small_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
' Hier gehts los
PRT.------------------------
IML.$$PRO|1|500
$$ERG=$$000
PRT. Pos. $$ERG is "$$TXT".
EIF.
PRT.------------------------
IML.$$PRO|$$ERG
PRT. Pos. $$ERG is "$$TXT".
EIF.
IML.$$PRO|($$ERG+1)
CAL.$$PLU=$$ERG+1
PRT. Pos. $$PLU is "$$TXT".
ELS.
CAL.$$PLU=$$ERG+1
PRT. Pos. $$PLU is NOT "$$TXT".
EIF.
PRT.------------------------
' Now we are scanning for "Bit not set"
IML.$$PROz|$$ERG|($$ERG+50)
$$RES=$$000
PRT. Pos. $$RES is the first byte after "$$TXT".
EIF.
PRT.------------------------
PRT. We are going to Dump 4 Bytes
XML.Dump|($$ERG-1)|($$RES+1)
PRT.------------------------
MBX.!
:enx
ENR.
'-----------------------------------------------------------
' Error Handler
:Lab_Err
XML.get error|$$ERT
DBP.$$ERT
ENR.
This is the result of the sample script:
Remarks
This command needs the XML-Data to be parsed first, using the
or the
Command.
In this process the XML-Parser builds a Table with flags that is analyzed using this commands. You can see a XML-Dump of such XML-Data Flags here:
Limitations:
-
See also:
• !! Smart Package Robot 's XML-Features
• XML. - eXtended Markup Language