XML-Parser * XML. (after Parse)

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > XML-Parser > XML. - after parse >

XML-Parser * XML. (after Parse)

XML.Get XML Part

Previous Top Next


MiniRobotLanguage (MRL)

 

XML.Get XML Part

XML.gxp

Get a part of the XML-Data into a variable

 

 

Intention

 

This command is used to retrieve a specified part or all of the XML-Data into a variable or onto TOS.

 

You can specify the start- and end-position of the XML-Data-Block that we want.

They will be placed in P2 and P3. 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

 

To get all of the XML-Data into a variable, just use P4, and leave P2 and P3 empty or fill them with a zero. Having all XML-Data in a variable, enables you to use all SPR String-Commands on the XML-Data, to search or replace things.

After that you can just "XML.Parse" that variable and work on the changed XML-Data.

 

 

 

Syntax

 

 

XML.Get XML Part|P2[|P3][|P4]

 

 

 

Parameter Explanation

 

 

P2 - (optional) Variable to specify the start-byte of the block.

           If omitted or zero, XML-Root will be used.

 

P3 - (optional) Variable to specify the end-byte of the block.

           If omitted or zero, XML-Length will be used.

 

P4 - (optional) Variable to return the result. The result is "" (empty) in case

         of parsing errors. Otherwise the result is the XML-Data-Part..

 

 

 

To get all of the XML-Data into a variable, just use P4, and leave P2 and P3 empty or fill them with a zero. Having all XML-Data in a variable, enables you to use all SPR String-Commands on the XML-Data, to search or replace things.

After that you can just "XML.Parse" that variable and work on the changed XML-Data.

 

 

 

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:

 

graphic

 

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

  ! SPR - XML-Parser Flags

  XML. - eXtended Markup Language

  par - parse from var

  sxp - Set XML Part

  sdn - Search Down Tag Name

  gbl - Get Block