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.Insert XML Part

Previous Top Next


MiniRobotLanguage (MRL)

 

XML.Insert XML Part

XML.ixp

Insert Text at a specified place into the XML-Data (and reparse if needed)

 

 

Intention

 

This command is used to  insert Text or Data parts into the XML-Data.

 

If you do change the total length of the XML-Data then the Parser will automatically re-parse the data and set all flags from new.

If you do not change the total length of the XML-Data then its up to you, if you want a Re-Parse or not.

See the command: rpa - Reparse .

 

If you want to remove or replace parts of the XML-Data, you can either use

 

    ssc - Set Asc

    scr - Set Chr

    sxp - Set XML Part

 

Or transfer the complete XML-Data into a Variable, then use the normal "String Commands, and then Parse the Variable again using the XML-Parse command.

 

To get all of the XML-Data into a variable, use

XML.gxp|||$$ALL

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.Insert XML Part|P2|P3|P4

 

 

 

Parameter Explanation

 

P2 - Text that is inserted at Place P3 - or if P3 is omitted, at the actual position into

          the XML-Data.

 

P3 - (optional) numeric position where the text shall be inserted into

         the XML-Data. If zero, the actual position is taken.

         If negative, it will count position from the end of the XML-Data backwards.

 

 

 

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|&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.------------------------

PRT.Now we are going to remove the entire Block

PRT.------------------------

XML.sxp|$$BSA|$$BSE|

XML.Print

PRT.------------------------

PRT.Now we are going to insert the entire Block again

PRT.------------------------

XML.ixp|$$BLO|$$BSA

XML.Print

PRT.------------------------

MBX.!

:enx

ENR.

'-----------------------------------------------------------

' Error Handler

:Lab_Err

XML.get error|$$ERT

DBP.$$ERT

ENR.

 

This is the result of the sample script:

 

graphic

 

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

 

See also:

 

  ! Smart Package Robot 's XML-Features

  ! SPR - XML-Parser Flags

  XML. - eXtended Markup Language

  par - parse from var

  gxp - Get XML Part

  rpa - Reparse

    ssc - Set Asc

    scr - Set Chr

  sxp - Set XML Part

  sdn - Search Down Tag Name

  gbl - Get Block