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 Asc

Previous Top Next


MiniRobotLanguage (MRL)

 

XML.Set Asc

XML.ssc

Change a Byte in the XML-Data to a specified ASCII-value

 

 

Intention

 

This command is used to change a Single Character inside the XML-Data to a specified other character. Unlike with

 

you can specify the character here, using the ASCII-value.

 

' These lines are doing the same thing:

' as 62=ASCII of ">"

XML.scr|$$BSA|>

XML.ssc|$$BSA|62

 

You may need a Reparse, if this change will influence the XML-Structure.

Reparse is done using: rpa - Reparse

 

 

Hints:

To specify an Character instead of an ASCII Value, use:

scr - Set Chr

 

To replace whole words or Data-Blocks, use

sxp - Set XML Part

 

 

 

Syntax

 

 

XML.Set Asc|P2|P3

 

 

 

Parameter Explanation

 

P2 - numeric parameter that contains a valid position inside the XML-Data.

          If omitted or zero, the actual position is used.

          If the given number is larger then XML-Length, the number is set to XML-Length.

You can specify a negative position, in this case, the bytes are counted reverse, starting at the end of the XML-Data, that is XML-Length.

 

-1 = Byte "XML-Lenght",

-2 = "XML-Lenght"-1

-3 = "XML-Lenght"-2

           etc.

 

P3 - Single Character (can be in a variable also) that is been placed inside the XML-Data

           at the specified position.

 

 

 

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

' This line is doing the same again! (62=ASCII of ">" )

XML.ssc|$$BSA|62

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.

 

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

  rpa - Reparse

    ssc - Set Asc

    scr - Set Chr

  sxp - Set XML Part