<< 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.Any Flags Zero
IML.afz
Find out if the specified XML-Flag is set.
Intention
This command is used to analyze XML-Flags. Using this command, you can check more complex conditions by using multiple XML-Flags at once.
These XML-Flags will be AND'ed not OR'ed.
Any result will only be found, if ALL of the given XML-Flags are NOT set (are zero) at that target byte.
For example:
' This will search for a combination of the two flags
' starting at byte 1 until byte 500
IML.afz|Close Bracket+self terminate|1|500
$$ERG=$$000
PRT. Pos. $$ERG is "$$TXT".
EIF.
' Instead of the + you can also use the ,
IML.afz|Close Bracket,self terminate|1|500
' You can use the numbers directly
IML.afz|2+1024|1|500
or
IML.afz|2,1024|1|500
or
' This version is a few microseconds faster :-)
' if you are working on hundred thousands of tags in few seconds
' use this one
IML.afz|1026|1|500
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.afz|8,2,2048
PRT. Pos. 30 is flagged.
EIF.
' With 0ne parameter IML. will check just the given Byte
IML.afz|(1024+8+6+2)|30
PRT. Pos. 30 is flagged.
EIF.
' With three parameters, IML. will start searching for a Byte with
' the specified Flag NOT set, and if one is found, place that
' Bytes Number on the TOS (Top of Stack).
IML.afz|Close Bracket+self terminate+8|20|40
PRT. Pos. $$000 is after an Equal Sign.
EIF.
As always NML. is the negative Form of IML.
Syntax
IML.Any Flags Zero|P2[|P3][|P4]
Parameter Explanation
P2 - Variable with XML-Data. XML-Data Flags, see below..
P3 - (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.
P4 - (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.
XML-Data Flags, to be used as P2:
- You can combine as many of the following flags as you want
- You can use the numeric value of the flag, or the better readable description
1. This Flag is assigned to any real open bracket "<" from any used tag.
"Open Bracket" = 1
2. This Flag is assigned to any real close bracket ">" from any used tag.
"Close Bracket" = 2
4. This Flag is assigned to any character that is inside a tag. Inside a tag means, between a
open bracket ">" and a close bracket ">".
"Between" = 4
8. This Flag is assigned to any SQ (Single Quote) that encloses an attribute.
This flag is not assigned to other SQ's for example in an data-part or inside an
DQ-delimited value of an attribute.
"Is SQ" = 8
16.. This Flag is assigned to any character that is between SQ as an attribute value.
Between SQ" = 16
32. This Flag is assigned to any real DQ (Double Quote) that encloses an attribute.
This flag is not assigned to other DQ's for example in an data-part or inside an
SQ-delimited
"is dq" = 32
64.. This Flag is assigned to any character that is between DQ as an attribute value.
"Between DQ" = 64
128. This Flag is assigned to the last letter (non whitespace character) that is before an
EQ Sign that is interpreted to be part of an attribute.
"before eq" = 128
256. This Flag is assigned to the first SQ or DQ , that is after an
EQ Sign that is interpreted to be part of an attribute.
"after eq" = 256
512. This Flag is assigned to to characters inside tags only. If they are not between
SQ or DQ. This means that they are not part of the value of an attribute,
if this flag is set.
"outside sdq" = 512
1024. This Flag is assigned to the open- and to the close-bracket of a self terminated tag.
These are comments, system-tags or dedicated "self terminated" tags.
See example XML-Dump below.
"self terminate" = 1024
2048 This Flag is assigned to the open- and to the close-bracket of a system-tag.
See example XML-Dump below.
"system tag" = 2048
4096. This Flag is assigned to the first letter of the tag name.
See example XML-Dump below.
"start name"=4096
8192. This Flag is assigned to the last letter of the tag name.
"end name" = 8192
16384. This Flag is assigned to the first letter of any found attribute.
See example XML-Dump below.
"start attribute" = 16384
32768. This Flag is assigned to the last letter of any found attribute.
Regularly this is a SQ or a DQ-Sign.
See example XML-Dump below.
"end attribute" = 32768
65536. This Flag is assigned to the first "<" that starts a new Start-Tag. Its the opposite
of an End-Tag-Flag (below). See example XML-Dumps below.
"start tag" = 65536
131072. This Flag is assigned to the first "<" that starts a new End-Tag. Its the opposite
of an Start-Tag-Flag (above). See example XML-Dumps below.
"end tag" = 131072
262144. This Flag is assigned to any character that is inside a comment-tag.
There is an picture below that shows the Dump of an comment tag.
"comment" = 262144
Example
'***********************************
'
'***********************************
'Prototype für IML.
$$PRO=afz
$$TXT=Flag Combination not set.
$$XMF=?pfad\Small_XML.txt
$$FLG=Close Bracket+comment
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.cmt|1|500
$$STR=$$000
EIF.
IML.$$PRO|$$FLG|$$STR|500
$$ERG=$$000
PRT. Pos. $$ERG End of the Comment Tag.
EIF.
PRT.------------------------
IML.$$PRO|$$FLG|$$ERG
PRT. Pos. $$ERG is "$$TXT".
EIF.
IML.$$PRO|$$FLG|($$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|$$FLG|$$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)|$$PLU
PRT.------------------------
MBX.!
:enx
ENR.
'-----------------------------------------------------------
' Error Handler
:Lab_Err
XML.get error|$$ERT
DBP.$$ERT
ENR.
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