<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > XML. - after parse > XML-Parser * XML. (after Parse) |
MiniRobotLanguage (MRL)
XML.Search Down Tag Name
XML.sdn
Get XML-Data from a file
Intention
This command is used to search a XML-Tag with a specified Tag-Name in downward direction.
It is important that you understand that you can use "Parts of a Name" to specify the name of the Tag you search for.
This may have unwanted side effects that you have to be aware of.
Take this example.
<PName>
<Name>
Nametext
</Name>
</PName>
Searching like this:
XML.sdn|Name
will bring up the next such Tag, that can be the Tag
</PName>
because the name contains the ward "Name".
To specify exactly what you are looking for, you have to use the
In this case you would write
XML.sdn|&EXACT:Name
to really get what you want.
In the same way you could specify multiple valid words and connect them with &OR:
XML.sdn|{&EXACT:Name}&OR:{&EXACTnombre}
and use this feature to build international scripts.
Syntax
XML.Search Down Tag Name|P2[|P3]
Parameter Explanation
P2 - Variable with Tag-Name to search for, use: 3.2 Standard-Search Pattern
P3 - Variable to return the result. The result is 0 in case nothing was found.
Otherwise the result is >0 and contains the position of the found Open-Tag "<"..
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
' Hier gehts los
PRT.------------------------
XML.sdn|Affec&ANDTHEN:Prod
XML.get pos|$$POA
PRT.Actual Position after sdn is: $$POA
PRT.------------------------
XML.set pos|-1
XML.get pos|$$POB
PRT.Actual Position at XML-Length is: $$POB
PRT.------------------------
XML.sun|Affec&ANDTHEN:Prod
XML.get pos|$$POC
PRT.Actual Position after sun is: $$POC
PRT.------------------------
XML.Dump|($$POA-3)|($$POA+3)
PRT.------------------------
XML.Dump|($$POB-3)|($$POB+3)
PRT.------------------------
XML.Dump|($$POC-3)|($$POC+3)
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