<< Click to Display Table of Contents >> Navigation: 3. Script Language > XML-Parser > XML. - after parse > XML-Parser * XML. (after Parse) |
MiniRobotLanguage (MRL)
XML.Get Block
XML.gbl
Get a complete XML-Data Block
Intention
This command is used to retrieve the start- and end-position of the XML-Data-Block that we are in. They will be placed in P2 and P3.
You can extract the block using the XML.gxp-command.
Here is an example:
XML.gbl|$$BSA|$$BSE
PRT.Current Block starts at: $$BSA
PRT.Current Block ends at: $$BSE
' Now we get the data from the block into $$BLO
XML.gxp|$$BSA|$$BSE|$$BLO
PRT.------------------------
PRT. This is the Block:
PRT.$$BLO
Syntax
XML.Get Block[|P2][|P3]
Parameter Explanation
P2 - (optional) Variable to return the start-byte of the block.
P3 - (optional) Variable to return the end-byte of the block.
The results are 0 in case of parsing errors. Otherwise the results of both parameters are
>0 and contain the start- and end-byte number, of that block where we are currently in.
If omitted any of the values are being placed on TOS (Top of Stack).
Example
'***********************************
'
'***********************************
'Prototype für IML.
$$PRO=Open Bracket
$$TXT=a real Open Bracket
$$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.------------------------
' We search fo a Tag with the Name "Patch"
XML.sdn|&EXACT:Patch
XML.get pos|$$POS
PRT.Actual Position is: $$POS
XML.gbl|$$BSA|$$BSE
PRT.Current Block starts at: $$BSA
PRT.Current Block ends at: $$BSE
XML.gxp|$$BSA|$$BSE|$$BLO
PRT.------------------------
PRT. This is the Block:
PRT.$$BLO
PRT.------------------------
MBX.!
:enx
ENR.
'-----------------------------------------------------------
' Error Handler
:Lab_Err
XML.get error|$$ERT
DBP.$$ERT
ENR.
This is the result of the sample script:
Here is the important part of the used XML-Data:
</Product>
<Patch PatchName="SQLServer2008-KB2716433-x86.exe" SQNumber="Q2716433">
<DL SFN="SQLServer2008-KB2716433-x86.exe" FS="188008400">
<SURLS>
<SURL LGROUP="ENSTD" LURL="http://download.microsoft.com/download/9/2/7/927A4802-FC1C-4A71-9A2D-2DCEAC11B266/KB2716433/SQLServer2008-KB2716433-x86.exe"/>
<SURL LGROUP="FRSTD" LURL="http://download.microsoft.com/download/9/2/7/927A4802-FC1C-4A71-9A2D-2DCEAC11B266/KB2716433/SQLServer2008-KB2716433-x86.exe"/>
<SURL LGROUP="DESTD" LURL="http://download.microsoft.com/download/9/2/7/927A4802-FC1C-4A71-9A2D-2DCEAC11B266/KB2716433/SQLServer2008-KB2716433-x86.exe"/>
<SURL LGROUP="CHHKSTD" LURL="http://download.microsoft.com/download/9/2/7/927A4802-FC1C-4A71-9A2D-2DCEAC11B266/KB2716433/SQLServer2008-KB2716433-x86.exe"/>
</SURLS>
<AffectedProductSPs>
<AffectedProductSP ShavlikName="SQL2K8AS" SPName="SP2" BulletinID="MS12-070"/>
<AffectedProductSP ShavlikName="SQL2008" SPName="SP2" BulletinID="MS12-070"/>
<AffectedProductSP ShavlikName="SQL2008STD" SPName="SP2" BulletinID="MS12-070"/>
<AffectedProductSP ShavlikName="SQL2008EXPRESSAS" SPName="SP2" BulletinID="MS12-070"/>
</AffectedProductSPs>
</DL>
</Patch>
</Products>
Remarks
-
Limitations:
-
See also:
• ! Smart Package Robot 's XML-Features
• XML. - eXtended Markup Language