XMLParser Example: Ancestor | Teradata Vantage - XMLParser Example: Ancestor - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

SQL Call

SELECT * FROM XMLParser (
  ON xml_input1
  USING
  TextColumn ('xmldocument')
  Nodes ('temperature/read:type','storage/{used, total}')
  Sibling ('settopid:{type, length}','accountid')
  Ancestor ('setTopRpt')
  OutputColumnNodeID ('nid')
  MaxItemNum (1)
  Accumulate ('xid')
) AS dt;

Output

The output table has the node and sibling values of the specified ancestor, setTopRpt.

 xid nid out_parent_node settopid settopid_type settopid_length accountid read read_type  used total 
 --- --- --------------- -------- ------------- --------------- --------- ---- ---------- ---- ----- 
   2   1 temperature     ST789    string        5               8728      46   bigDecimal           
   2   2 storage         ST789    string        5               8728                      98   300

Download a zip file of all examples and a SQL script file that creates their input tables.