<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > XML. - after parse > XML-Parser * XML. (after Parse) |
MiniRobotLanguage (MRL)
XML.Get Position
XML.gpo
Get or range check actual Position in XML-Data
Intention
This command is used to retrieve the actual position inside the XML-Data.
The actual position is automatically set to XML_Root (see gro - Get Root ) after Parsing.
It is changed by any successful search command to the search result position.
You can directly set the actual position using spo - Set Position.
The XML Position or "actual position" is a number between 1 and XML-Lenght (see gle - Get Len ). Its simply a Byte Number in the XML-Data.
If P3 is specified, the command will correct the numeric parameter in P3 and make sure that it is in a valid positional range for the actual XML-Data.
The only difference between
XML.gpo|$$RE|$$POS
and
XML.gpr|$$RE|$$POS
is, that if P3< XML-Root then "gpr" will return XML-Length as P2, while "gpo" will return XML_Root as P2.
Syntax
XML.Get Position[|P2][|P3]
Parameter Explanation
P2 - (optional) Variable for the numeric result of the actual XML-Position, or
(if P3 is specified), for the corrected value that was in P3..
If omitted, the result is been placed on TOS
P3 - (optional) numeric Byte address of the XML-Data Byte that
should be taken as position.
If P3 is given, the number in P3 and the value is been verified against the
real size of the actual XML-Data. If P3 is within the actual XML-Data size,
it is returned unchanged. If P3 is not a valid XML-Address because its lower then
XML-Root or higher then XML-Length then its changed to the highest or lowest
allowed value. The result is always in P2. If P3 is given, the result is the "corrected"
value in P3 and not necessarily the actual XML-Position.
.
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.gpr
PRT.Position for Previous is: $$000
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