<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > XML. - after parse > XML-Parser * XML. (after Parse) |
MiniRobotLanguage (MRL)
XML.Set Position
XML.spo
Manually set the actual position (pointer to actual position)
Intention
This command is used to set the actual position to y byte-position in the XML-Data, that starts at (Byte Nr.) 1 and goes up to Byte Nr. "XML-Length".
You can specify a negative position, in this case, the bytes are counted reverse, starting at the end of the XML-Data, that is XML-Length.
-1 = Byte "XML-Lenght",
-2 = "XML-Lenght"-1
-3 = "XML-Lenght"-2
etc.
To find out where the actual position is, you can use:
Usage:
XML.Set Pos|357
' We get the "actual position" - after parsing.
XML.get pos|$$POS
PRT.Actual Position after Parsing is: $$POS
Syntax
XML.Set Position[|P2]
Parameter Explanation
P2 - (optional) numeric parameter that contains a valid position inside the XML-Data.
If omitted or zero, the actual position is used.
If the given number is larger then XML-Length, the number is set to XML-Length.
You can specify a negative position, in this case, the bytes are counted reverse, starting at the end of the XML-Data, that is XML-Length.
-1 = Byte "XML-Lenght",
-2 = "XML-Lenght"-1
-3 = "XML-Lenght"-2
etc.
Example
'***********************************
'
'***********************************
'
$$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
XML.Set Pos|357
' We get the "actual position" - after parsing.
XML.get pos|$$POS
PRT.Actual Position after Parsing is: $$POS
' Hier gehts los
PRT.------------------------
XML.gLev
$$TXT=$$000
PRT.Actual Level are: $$TXT
PRT.------------------------
XML.gLev|($$POS+1)|$$ERG
PRT.Actual Level: $$ERG
PRT.------------------------
XML.Dump|($$POS-3)|($$POS+3)
PRT.------------------------
MBX.!
:enx
ENR.
'-----------------------------------------------------------
' 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