XML Sink

XML Sink () is used to write processed data into an XML-formatted text file .
This assembly is typically used when another system requires output in XML format , for example: XML Sink will convert each record in the data stream into an XML element with a specific structure.

Parameters of XML Sink

  1. Root Tag
    Root Tag is the main tag (topmost tag) in an XML document.
    All record data will be in this tag.
    Example:
        <transactions>
            ...
        </transactions>
    
    In the example:
        Root Tag = transactions    
    
  2. Group Tag
    Group Tag is the tag name for each data record .
    Each row of data will be wrapped with this tag.
    Example:
        <transactions>
            <transaction>
                ...
            </transaction>
    
            <transaction>
                ...
            </transaction>
        </transactions>
    
    In this example:
        Group Tag = transaction
    
  3. Data Tags
    Data Tags are the tag names for each data field or column .
    Each field will be written as an XML element.
    Example fields:
        id,name,amount,status
    
    Output XML:
        <transaction>
            <id>1001</id>
            <name>John</name>
            <amount>5000</amount>
            <status>SUCCESS</status>
        </transaction>
    
  4. Output Path
    Output Path is the storage location for the processed XML file.
    • If omitted, the input path must be supplied as a command-line argument when running the job.
    • For dynamic parameters, FROM_ARGUMENT(arg_name) can be used to pass the input path at runtime.
  5. Default File System
    Specifies the default file system used for the output path.
    Examples:
    • hdfs://
    • file://
    • s3a://
    • s3n://
  6. Sink Mode
    Defines the behavior when the output directory already exists.
    Options:
    • KEEP
      Keeps the existing file
    • REPLACE
      Replaces existing files
      Old output files will be overwritten

Supported Engines

Map
Reduce
Spark 1.x
RDD
Spark 2.x
RDD
Spark 2.x
Dataset
Apache Beam
2.29.0 Batch
Apache Beam
2.29.0 Streaming
Apache Flink
1.12.0 Batch
Apache Flink
1.12.0 Streaming
Apache Tez
0.9.1
PySpark