XML-Parser * XML. (no Parse needed)

<< Click to Display Table of Contents >>

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

XML-Parser * XML. (no Parse needed)

XML. Wrap

Previous Top Next


MiniRobotLanguage (MRL)

 

XML.Wrap

Wrap a text into <>

 

 

Intention

 

This command is used to generate an XML-Tag.

 

As Input you give it any Text, as the result you will get an XML-Tag.

Wrap is intelligent, look what it really does.

 

' We do a simple Wrap

$$XMF=Hallo

XML.Wrap|$$XMF

PRT.1. Wrapped: $$XMF

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

' We do a more complex WRAP

$$XMF=<Hallo

XML.Wrap|$$XMF

PRT.2. Wrapped: $$XMF

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

' We do a even more complex WRAP (Notice the space left of the <)

$$XMF= <Hallo

XML.Wrap|$$XMF

PRT.3. Wrapped: $$XMF

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

' We do a even more complex WRAP (Notice the spaces left of the <)

$$XMF=   <<Hallo

XML.Wrap|$$XMF

PRT.4. Wrapped: $$XMF

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

' We do a even more complex WRAP (Notice the space right of the >)

VAR.$$XMF=$sp$<Hallo>$sp$

XML.Wrap|$$XMF

PRT.5. Wrapped: $$XMF

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

' We do a maximum complex WRAP (Notice the space right of the >)

VAR.$$XMF=$sp$   <<<Hallo>>>    $sp$

XML.Wrap|$$XMF

PRT.6. Wrapped: $$XMF

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

 

As you can see in the Output below, the Wrap command is intelligent in what its doing.

It will not "just place <> around".

It will first check

    does the text need to be trimmed?

    are there already brackets around?

    Whitespaces inside the Tag are preserved

    Whitespaces before the < or

    after the > are trimmed

    it will trim all XML Whitespaces and Tabs, these are ASCII: &H20,&H9,&HD,&HA

 

Internally it will call the UnWrap command first and then Wrap the text.

graphic

 

 

Syntax

 

 

XML.Wrap|P2[|P3]

 

 

 

Parameter Explanation

 

P2 - Variable with XML-Data that is to be Wrapped into <>.

         If P3 is omitted, the result it stored into this variable.

P3 - (Optional) Variable to return the result.

 

 

 

Example

 

'***********************************

' XML.Warp/Unwrap Sample

'***********************************

' We do a simple Wrap

$$XMF=Hallo

XML.Wrap|$$XMF

PRT.1. Wrapped: $$XMF

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

' We do a more complex WRAP

$$XMF=<Hallo

XML.Wrap|$$XMF

PRT.2. Wrapped: $$XMF

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

' We do a even more complex WRAP (Notice the space left of the <)

$$XMF= <Hallo

XML.Wrap|$$XMF

PRT.3. Wrapped: $$XMF

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

' We do a even more complex WRAP (Notice the spaces left of the <)

$$XMF=   <<Hallo

XML.Wrap|$$XMF

PRT.4. Wrapped: $$XMF

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

' We do a even more complex WRAP (Notice the space right of the >)

VAR.$$XMF=$sp$<Hallo>$sp$

XML.Wrap|$$XMF

PRT.5. Wrapped: $$XMF

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

' We do a maximum complex WRAP (Notice the space right of the >)

VAR.$$XMF=$sp$   <<<Hallo>>>    $sp$

XML.Wrap|$$XMF

PRT.6. Wrapped: $$XMF

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

' We do a simple UnWrap

$$XMF=Hallo>

XML.UnWrap|$$XMF

PRT.7.UnWrapped: $$XMF

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

' We do a more complex UnWRAP

$$XMF=<Hallo>>

XML.UnWrap|$$XMF

PRT.8.UnWrapped: $$XMF

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

' We do a even more complex UnWRAP (Notice the space left of the <)

$$XMF= <Hallo

XML.UnWrap|$$XMF

PRT.9. UnWrapped: $$XMF

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

' We do a even more complex UnWRAP (Notice the spaces left of the <)

$$XMF=   <<Hallo>

XML.UnWrap|$$XMF

PRT.10. UnWrapped: $$XMF

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

' We do a even more complex UnWRAP (Notice the space right of the >)

VAR.$$XMF=$sp$<Hallo>$sp$

XML.UnWrap|$$XMF

PRT.11. UnWrapped: $$XMF

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

' We do a maximum complex UnWRAP (Notice the space right of the >)

VAR.$$XMF=$sp$   <<<Hallo>>>    $sp$

XML.UnWrap|$$XMF

PRT.12. UnWrapped: $$XMF

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

MBX.!

ENR.

 

 

below is the result of the sample script:

 

You can see that the Wrap and the UnWrap commands are smart and deliver you exactly what you need.

 

graphic

 

 

 

 

 

Remarks

 

Wrap does not automatically "Clean" the Text, if needed use the "XML.Clean" Command first.

 

 

 

Limitations:

 

-

 

 

See also:

 

  ! Smart Package Robot 's XML-Features

  ! SPR - XML-Parser Flags

  XML. - eXtended Markup Language

  unw - UnWrap

  clean - Clean Text

  UnClean - UnClean Text