XML-Parser * IML. / NML. (after Parse)

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > XML-Parser > IML./NML. - after parse >

XML-Parser * IML. / NML. (after Parse)

IML./NML.Any Flags Set

Previous Top Next


MiniRobotLanguage (MRL)

 

IML.Any Flags Set

IML.afs

Find out if the specified XML-Flag is set or Not 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 set at that target byte.

 

For example:

' This will search for a combination of the two flags

' starting at byte 1 until byte 500

IML.afs|Close Bracket+self terminate|1|500

 $$ERG=$$000

 PRT. Pos. $$ERG is "$$TXT".

EIF.

 

' Instead of the + you can also use the ,

IML.afs|Close Bracket,self terminate|1|500

 

' You can use the numbers directly

IML.afs|2+1024|1|500

 

or

 

IML.afs|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.afs|1026|1|500

 

 

To understand this better, see the XML-Sample-Data  and XML-Flags-Dump here:

! Sample-XML Data

 

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.afs|8,2,2048

 PRT. Pos. 30 is flagged.

EIF.

 

' With 0ne parameter IML. will check just the given Byte

IML.afs|(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 set, and if one is found, place that

' Bytes Number on the TOS (Top of Stack).

IML.afs|Close Bracket+self terminate|20|40

 PRT. Pos. $$000 is after an Equal Sign.

EIF.

 

As always NML. is the negative Form of IML.

 

 

 

Syntax

 

 

IML.Any Flags Set|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=afs

$$TXT=Das Ende des System Tags

$$XMF=?pfad\Small_XML.txt

$$FLG=Close Bracket+self terminate

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|$$FLG|1|500

 $$ERG=$$000

 PRT. Pos. $$ERG is "$$TXT".

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.

 

This is the result of the sample script:

 

graphic

 

 

 

 

 

Remarks

 

This command needs the XML-Data to be parsed first, using the

par - parse from var

or the

lf - load file

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:

! Sample-XML Data

 

 

 

Limitations:

 

-

 

 

See also:

 

  ! Smart Package Robot 's XML-Features

  ! SPR - XML-Parser Flags

  XML. - eXtended Markup Language

  par - parse from var

  lf - load file

  stt - System Tag

  stn - Start Name

  stm - Self Terminate

  stg - Start Tag

  sta - Start Attribute

  osd - Outside SDQ

  obt - Open Bracket

  isq - Is SQ

  idq - Is DQ

  etg - End Tag

  edn - End Name

  eat - End Attribute

  cmt - Comment

  cbt - Close Bracket

  btw - Between

  bsq - Between SQ

  beq - Before EQ

  bdq - Between DQ

  afz - Any Flags Zero

  afs - Any Flags Set

  aeq - After EQ