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.Attrib by Number

Previous Top Next


MiniRobotLanguage (MRL)

 

XML.Attrib by Number

XML.abm

Get complete attributes from an XML-Tag "by number"

 

 

Intention

 

This command is used to retrieve an attribute from an XML-Data Tag.

 

<Product ProductName="STATION 10" Name="Value">

 

This Tag has two attributes:

 

Number 1:

ProductName="STATION 10"

 

and Number 2:

 

Name="Value"

 

You could retrieve then using

 

XML.abm|1|$$RES

 

to get Attribute Nr.1 into $$RES

 

or

 

XML.abm|2|$$RES

 

to get Attribute Nr.2 into $$RES

 

To Split the attributes you can use the

 

XML.spl|$$ERG|$$NAM|$$VAL

PRT.It can be splitted into: $$NAM and $$VAL

 

command.

 

After this command, the actual position is on the attributes End.

To get back to the start of the attribute, use:

 

XML.siu|start attribute

 

This will set the actual position to the start of the attribute.

 

 

 

Syntax

 

 

XML.Attrib by Number|P2[|P3]

 

 

 

Parameter Explanation

 

P2 - Variable with the number of the attribute that you want.

 

P3 - (optional) Variable to return the result. The result is "" in case

          no such attribute was found. If P3 was omitted the result is placed on TOS.

 

 

Example

 

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

'

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

'Prototype für IML.

$$XMF=?pfad\Small_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

XML.get len|$$LEN

PRT.Actual Size of XML-Data is: $$LEN

' Hier gehts los

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

XML.abm|2|$$ERG

PRT. The second attribute is: $$ERG

XML.spl|$$ERG|$$NAM|$$VAL

PRT. It can be splitted into: $$NAM and $$VAL

XML.abm|1|$$ERG

PRT. The first attribute is: $$ERG

XML.spl|$$ERG|$$NAM|$$VAL

PRT. It can be splitted into: $$NAM and $$VAL

XML.sdn|{&EXACT:Product}

XML.get pos|$$POS

PRT.Actual Position after Search is: $$POS

XML.abm|2|$$ERG

PRT. The second attribute is: $$ERG

XML.spl|$$ERG|$$NAM|$$VAL

PRT. It can be splitted into: $$NAM and $$VAL

XML.abm|1|$$ERG

PRT. The first attribute is: $$ERG

XML.spl|$$ERG|$$NAM|$$VAL

PRT. It can be splitted into: $$NAM and $$VAL

MBX.!

:enx

ENR.

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

' Error Handler

:Lab_Err

XML.get error|$$ERT

DBP.$$ERT

ENR.

 

This is the result of the sample script:

 

graphic

 

Here is a XML-Dump of the used XML-Data:

 

! Sample-XML Data

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

 

See also:

 

  ! Smart Package Robot 's XML-Features

  ! SPR - XML-Parser Flags

  XML. - eXtended Markup Language

  par - parse from var

  abn - Attrib by Name

  abv - Get Attrib by Value