retainedElements Element - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

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. The shredding processor must retain this element throughout the processing of the document. To use the minimum amount of memory, the mapping must 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>