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

Previous Top Next


MiniRobotLanguage (MRL)

 

XML.Set XML Part

XML.sxp

Remove/Replace Text at a specified place of the XML-Data (and reparse if needed)

 

 

Intention

 

This command is used to change parts of the XML-Data.

You can replace XML-Parts with other parts.

 

If you just want to remove a part of the XML-Data, then leave P4 empty.

 

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 .

 

 

 

Syntax

 

 

XML.Set XML Part|P2|P3|P4

 

 

 

Parameter Explanation

 

P2 - numeric Start-position of the text that is going to be replaced with

        the new text in P4. If zero, XML-Root is taken.

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

 

P3 - numeric End-position of the text that is going to be replaced with

         the new text in P4. If zero, XML-Length is used.

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

         P3 must always be larger then P2.

 

P4 - Text that is inserted, replacing the text in the XML-Data that

         is between P2 and P3.

 

 

 

 

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:SURLS

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

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

PRT.This is the block before change:

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

XML.Print

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

PRT.Now we use Set-XML-Part to change the block

$$TXT=!!!!!!!! New Block-Text !!!!!!!!!!

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

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

XML.Print

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

PRT. In this case the Reparse was done internally.

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

PRT.Now we will make a character change in the XML-Data

XML.scr|$$BSA|>

XML.ReParse

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

XML.Print

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

PRT. We Dump Positions

XML.Dump|($$BSA-3)|($$BSA+3)

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

XML.Dump|($$BSB-3)|($$BSB+3)

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

  ixp - Insert XML-Part

  sdn - Search Down Tag Name

  gbl - Get Block