Description:
Parse a string/a table sequence in an XML format.
Syntax:
xml(x,s)
Note:
If parameter x is an XML string, the function parses it into a table sequence to return; if x is a table sequence, the function parses it into an XML string and return.
Parameters:
x |
An XML string/a table sequence |
s |
The to-be-retrieved level; use the slash / as the separator if there are multiple to-be-retrieved levels; retrieve data from the root if it is absent |
Options:
@s |
The options enables parsing an XML string in the format of K F=v F=v …>D</K> into records made up of fields K,F,… Three situations: If K’s value is D and D is multilevel XML data, the parsing result is a record sequence; if <K …./K>, D is parsed into null; if <K…></K>, D is parsed into an empty string. |
Return value:
A table sequence/XML string
Example:
|
A |
|
1 |
=demo.query("select EID,NAME,SURNAME from EMPLOYEE") |
|
2 |
=xml(A1) |
Return an XML string |
3 |
<xml> <row> <DEPTID>1</DEPTID> <DEPTNAME>sale</DEPTNAME> <FATHER>12</FATHER> </row> <row> <DEPTID>10</DEPTID> <DEPTNAME>create</DEPTNAME> <FATHER>12</FATHER> </row> </xml> |
|
4 |
=xml(A3) |
Return a table sequence: |
5 |
=xml@s(A3) |
Return a multilevel sequence: |
6 |
=xml(A3,"xml/row") |
Retrieve data under row level and return it as a table sequence: |