Home Search

DriveWorks Pro 22
SppConvertXmltoTable

Send Feedback

SppConvertXmltoTable

This function converts XML into a Table Array. (XML must follow a specific schema, see below.)

Syntax

SppConvertXmlToTable([XML])

Where:

XML is XML as text.(XML must follow a specific schema, see below.)

Example

RuleResult
SppConvertXmltoTable(DWVariableMyXml)Will convert the given XML into a Table array.
SppConvertXmltoTable("<Table> <Row> <Column>Item</Column> <Column>Price</Column> <Column>Quantity</Column> </Row> <Row> <Column>HB Pencil</Column> <Column>0.60</Column> <Column>3</Column> </Row> </Table>")Will convert the given XML into a Table array.

Escaping Characters

The following characters are required to be used in the XML when required to be written in the resulting Table Array:

Written in XMLCharacter in the constructed Table Array
&lt;<
&gt;>
&amp;&
"" (double quote)" (single quote)

Example XML

The variable MyXML contains the following data:

<Table>
  <Row>
    <Column>Item</Column>
    <Column>Price</Column>
    <Column>Quantity</Column>
  </Row>
  <Row>
    <Column>HB Pencil</Column>
    <Column>0.60</Column>
    <Column>3</Column>
  </Row>
  <Row>
    <Column>2B Pencil</Column>
    <Column>0.60</Column>
    <Column>2</Column>
  </Row>
  <Row>
    <Column>Black Biro</Column>
    <Column>0.80</Column>
    <Column>1</Column>
  </Row>
  <Row>
    <Column>Rubber</Column>
    <Column>1.50</Column>
    <Column>1</Column>
  </Row>
  <Row>
    <Column>HB Pencil</Column>
    <Column>0.60</Column>
    <Column>2</Column>
  </Row>
  <Row>
    <Column>Black Biro</Column>
    <Column>0.80</Column>
    <Column>1</Column>
  </Row>
</Table>

Example Table Array

The XML above will result in the following Table Array:

{"Item","Price","Quantity";"HB Pencil","0.60","3";"2B Pencil","0.60","2";"Black Biro","0.80","1";"Rubber","1.50","1";"HB Pencil","0.60","2";"Black Biro","0.80","1"}

Example as DriveWorks Table

The Table Array above will look as below when viewed as a Table:

ItemPriceQuantity
HB Pencil0.603
2B Pencil0.602
Black Biro0.801
Rubber1.501
HB Pencil0.602
Black Biro0.801