This function converts XML into a Table Array. (XML must follow a specific schema, see below.)
SppConvertXmlToTable([XML])
Where:
XML is XML as text.(XML must follow a specific schema, see below.)
Rule | Result |
---|---|
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. |
The following characters are required to be used in the XML when required to be written in the resulting Table Array:
Written in XML | Character in the constructed Table Array |
---|---|
< | < |
> | > |
& | & |
"" (double quote) | " (single quote) |
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>
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"}
The Table Array above will look as below when viewed as a Table:
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 |