<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > XML. - after parse > XML-Parser * XML. (after Parse) |
MiniRobotLanguage (MRL)
XML.Split Attrib at
XML.spa
Split attribute at actual position into name and value
Intention
This command is used to split an attribute at the current position into name and value.
For this command you need to have the actual position inside of an attribute name.
For this you can use the
After these commands, the actual position is on the attributes End.
To get back to the start of the attribute, use:
XML.siu|start attribute
This will set the actual position to the start of the attribute.Then you can use
XML.spa
Unlike XML.spl you do not give a text string as parameter, but just two variables that will be filled with the name and value of the attribute at the actual position.
Technically the command will look for a "start attribute"-Flag upwards first.
If one is found, that attribute will be taken. If none is found, the command will search an attribute in downward direction. All of these must be inside the Tag at the actual position. This command will not search into other tags, outside of the Tag at the actual position.
Syntax
XML.Split Attrib at[|P2][|P3]
Parameter Explanation
P2 - (optional) Variable to return the name of the attribute. If omitted the
result is placed on TOS.
P3 - (optional) Variable to return the value of the attribute. If omitted this
value is placed on TOS (Top of Stack).
Example
'***********************************
'
'***********************************
'
$$XMF=?pfad\SQ_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
' We get the "actual position" - after parsing.
XML.get pos|$$POS
PRT.Actual Position after Parsing is: $$POS
' Here we search ...
PRT.------------------------
XML.sna|Patch|SQNum
XML.abn|SQNum
XML.siu|start attribute
XML.get pos|$$POA
PRT.Actual Position after sdn is: $$POA
XML.spa|$$NAM|$$VAL
PRT. The attributes Name is: $$NAM
PRT. The attributes Value is: $$VAL
PRT.------------------------
XML.Dump|($$POA-3)|($$POA+24)
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