<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > XML. - after parse > XML-Parser * XML. (after Parse) |
MiniRobotLanguage (MRL)
XML.Get Root
XML.gro
Get Root Position in XML-Data
Intention
This command is used to retrieve the position of the first open bracket in the XML-Data, which is called "XML-Root".
If for example, your XML-Code starts like this:
3w<?xml version="1.0" encoding="UTF-8"?>
then XML-Root would be at Position 3. If your XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
Then XML-Root will be at position 1.
After Parsing, the actual Position will always be XML-Root.
This command will not change the "actual position". It will just return the value of XML-Root whether in P2 or on TOS.
Syntax
XML.Get Root[|P2]
Parameter Explanation
P2 - (optional) Variable to return the result. The result is 0 in case
of parsing errors. Otherwise the result is >0 and contains the
value XML_Root.
Example
'***********************************
'
'***********************************
'
$$XMF=3w<?xml version="1.0" encoding="UTF-8"?>
' Now we are going to parse it
XML.Parse|$$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
XML.Set Pos|5
PRT.Actual Position after Setpos is: $$POS
PRT.------------------------
XML.gro
PRT.XML-Root Position is: $$000
PRT.------------------------
XML.gro|$$POS
PRT.XML-Root Position is: $$POS
PRT.------------------------
XML.get pos|$$POS
PRT.Actual Position after Get Root is: $$POS
PRT.------------------------
XML.gtr
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
•