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

Previous Top Next


MiniRobotLanguage (MRL)

 

XML.UnWrap

UnWrap a tag / remove the <>

 

 

Intention

 

This command is used to extract the inside from an XML-Tag.

In short this command will remove the < > from the tag.

 

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

UnWrap is intelligent, look what it really does.

 

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

 

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

It will not "just remove any <>.

It will first check

    does the text need to be trimmed?

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

 

graphic

 

 

 

Syntax

 

 

XML.UnWrap|P2[|P3]

 

 

 

Parameter Explanation

 

P2 - Variable with XML-Data that is to be UnWrapped from the <>.

         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 "UnClean" the Text, if needed use the "XML.UnClean" Command first.

 

 

 

Limitations:

 

-

 

 

See also:

 

  ! Smart Package Robot 's XML-Features

  ! SPR - XML-Parser Flags

  XML. - eXtended Markup Language

  Wrap

  clean - Clean Text

  UnClean - UnClean Text