retainedElements Element - Analytics Database - Teradata Vantage

Teradata Vantageā„¢ - XML Data Type - 17.20

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-01-27
dita:mapPath
tkc1628112506748.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
dgs1472251600184
Product Category
Teradata Vantage

XML shredding is performed in a streamed fashion in which the XML document is processed in one pass as a stream of characters. One consequence of this is that no state is maintained. For example, element values are discarded as the parser moves on to the next element. However, in some cases, some values occurring in a subtree early in the document might be of use throughout the document.

Consider an XML document that represents purchase orders for an entire day of sales for a store:

<purchaseorders>
   <meta>
      <store no="12345"/>
      <date>09/11/2011</date>
   <meta>
   <purchaseorder>
      <!-- content of the purchase order -->
   </purchaseorder>
   <purchaseorder>
      <!--content of the purchase order -->
   </purchaseorder>
   <!--  more purchaseorders -->
</purchaseorders>

The /purchaseorders/meta/date element identifies the date that applies to all the purchase orders in the document. In this case, the shredding processor must retain this element throughout the processing of the document. To use the minimum amount of memory, the mapping should indicate which elements need to be retained. For this purpose, use the retainedElements instruction as follows:

<retainedElements>
   <element ref="_meta_item" path="purchaseorders/meta"/>
   <!-- more retained element can be appended -->
</retainedElements>