Primeur Online Docs
Data Shaper
Data Shaper
  • 🚀GETTING STARTED
    • What is Primeur Data Shaper
      • What is the Data Shaper Designer
      • What is the Data Shaper Server
      • What is the Data Shaper Cluster
    • How does the Data Shaper Designer work
      • Designer Views and Graphs
      • Data Shaper Graphs
      • Designer Projects and Sandboxes
      • Data Shaper Designer Reference
    • How do the Data Shaper Server and Cluster work
      • Data Shaper Server and Cluster
      • Data Shaper Server Reference
    • VFS Graph Components
      • DataOneFileDescriptor (DOFD) metadata
      • Passing parameters from Data One Contract to Data Shaper graph
      • Inheriting Data One context attributes in Data Shaper graph
  • DATA SHAPER DESIGNER
    • Configuration
      • Runtime configuration
        • Logging
        • Master Password
        • User Classpath
      • Data Shaper Server Integration
      • Execution monitoring
      • Java configuration
      • Engine configuration
      • Refresh Operation
    • Designer User Interface
      • Graph Editor with Palette of Components
      • Project Explorer Pane
      • Outline Pane
      • Tabs Pane
      • Execution Tab
      • Keyboard Shortcuts
    • Projects
      • Creating Data Shaper projects
      • Converting Data Shaper projects
      • Structure of Data Shaper projects
      • Versioning of server project content
      • Working with Data Shaper Server Projects
      • Project configuration
    • Graphs
      • Creating an empty graph
      • Creating a simple graph
        • Placing Components
        • Placing Components from Palette
        • Connecting Components with Edges
    • Execution
      • Successful Graph Execution
      • Run configuration
      • Connecting to a running job
      • Graph states
    • Common dialogs
      • URL file dialog
      • Edit Value dialog
      • Open Type dialog
    • Import
      • Import Data Shaper projects
      • Import from Data Shaper server sandbox
      • Import graphs
      • Import metadata
    • Export
      • Export graphs to HTML
      • Export to Data Shaper Server sandbox
      • Export image
      • Export Project as Library
    • Graph tracking
      • Changing record count font size
    • Search functionality
    • Working with Data Shaper server
      • Data Shaper server project basic principles
      • Connecting via HTTP
      • Connecting via HTTPS
      • Connecting via Proxy Server
    • Graph components
      • Adding components
      • Finding components
      • Edit component dialog box
      • Enable/disable component
      • Passing data through disabled component
      • Common properties of components
      • Specific attribute types
      • Metadata templates
    • Edges
      • Connecting Components with Edges
      • Types of Edges
      • Assigning Metadata to Edges
      • Colors of Edges
      • Debugging Edges
      • Edge Memory Allocation
    • Metadata
      • Records and Fields
        • Record Types
        • Data Types in Metadata
        • Data Formats
        • Locale and Locale Sensitivity
        • Time Zone
        • Autofilling Functions
      • Metadata Types
        • Internal Metadata
        • External (Shared) Metadata
        • SQL Query Metadata
        • Reading Metadata from Special Sources
      • Auto-propagated Metadata
        • Sources of Auto-Propagated Metadata
        • Explicitly Propagated Metadata
        • Priorities of Metadata
        • Propagation of SQL Query Metadata
      • Creating Metadata
        • Extracting Metadata from a Flat File
        • Extracting Metadata from an XLS(X) File
        • Extracting Metadata from a Database
        • Extracting Metadata from a DBase File
        • Extracting Metadata from Salesforce
        • SQL Query Metadata
        • User Defined Metadata
      • Merging Existing Metadata
      • Creating Database Table from Metadata and Database Connection
      • Metadata Editor
        • Opening Metadata Editor
        • Basics of Metadata Editor
        • Record Pane
        • Field Name vs. Label vs. Description
        • Details Pane
      • Changing and Defining Delimiters
      • Editing Metadata in the Source Code
      • Multi-value Fields
        • Lists and Maps Support in Components
        • Joining on multivalue fields (Comparison Rules)
    • Connections
      • Database Connections
        • Internal Database Connections
        • External (Shared) Database Connections
        • Database Connections Properties
        • Encryption of Access Password
        • Browsing Database and Extracting Metadata from Database Tables
        • Windows Authentication on Microsoft SQL Server
        • Snowflake Connection
        • Hive Connection
        • Troubleshooting
      • JMS Connections
      • QuickBase Connections
      • Hadoop Connections
      • Kafka Connections
      • OAuth2 Connections
      • MongoDB Connections
      • Salesforce Connections
    • Lookup Tables
      • Lookup Tables in Cluster Environment
      • Internal Lookup Tables
      • External (Shared) Lookup Tables
      • Types of Lookup Tables
    • Sequences
      • Persistent Sequences
      • Non Persistent Sequences
      • Internal Sequences
      • External (Shared) Sequences
      • Editing a Sequence
      • Sequences in Cluster Environment
    • Parameters
      • Internal Parameters
      • External (Shared) Parameters
      • Secure Graph Parameters
      • Graph Parameter Editor
      • Secure Graph Parameters
      • Parameters with CTL2 Expressions (Dynamic Parameters)
      • Environment Variables
      • Canonicalizing File Paths
      • Using Parameters
    • Internal/External Graph Elements
    • Dictionary
      • Creating a Dictionary
      • Using a Dictionary in Graphs
    • Execution Properties
    • Notes in Graphs
      • Placing Notes into Graph
      • Resizing Notes
      • Editing Notes
      • Formatted Text
      • Links from Notes
      • Folding Notes
      • Notes Properties
    • Transformations
      • Defining Transformations
      • Transform Editor
      • Common Java Interfaces
    • Data Partitioning (Parallel Running)
    • Data Partitioning in Cluster
      • High Availability
      • Scalability
      • Graph Allocation Examples
      • Example of Distributed Execution
      • Remote Edges
    • Readers
      • Common Properties of Readers
      • ComplexDataReader
      • DatabaseReader
      • DataGenerator
      • DataOneVFSReader
      • EDIFACTReader
      • FlatFileReader
      • JSONExtract
      • JSONReader
      • LDAPReader
      • MultiLevelReader
      • SpreadsheetDataReader
      • UniversalDataReader
      • X12Reader
      • XMLExtract
      • XMLReader
      • XMLXPathReader
    • Writers
      • Common Properties of Writers
      • DatabaseWriter
      • DataOneVFSWriter
      • EDIFACTWriter
      • FlatFileWriter
      • JSONWriter
      • LDAPWriter
      • SpreadsheetDataWriter
      • HIDDEN StructuredDataWriter
      • HIDDEN TableauWriter
      • Trash
      • UniversalDataWriter
      • X12Writer
      • XMLWriter
    • Transformers
      • Common Properties of Transformers
      • Aggregate
      • Concatenate
      • DataIntersection
      • DataSampler
      • Dedup
      • Denormalizer
      • ExtSort
      • FastSort
      • Filter
      • Map
      • Merge
      • MetaPivot
      • Normalizer
      • Partition
      • Pivot
      • Rollup
      • SimpleCopy
      • SimpleGather
      • SortWithinGroups
      • XSLTransformer
    • Joiners
      • Common Properties of Joiners
      • Combine
      • CrossJoin
      • DBJoin
      • ExtHashJoin
      • ExtMergeJoin
      • LookupJoin
      • RelationalJoin
    • Others
      • Common Properties of Others
      • CheckForeignKey
      • DBExecute
      • HTTPConnector
      • LookupTableReaderWriter
      • WebServiceClient
    • CTL2 - Data Shaper Transformation Language
    • Language Reference
      • Program Structure
      • Comments
      • Import
      • Data Types in CTL2
      • Literals
      • Variables
      • Dictionary in CTL2
      • Operators
      • Simple Statement and Block of Statements
      • Control Statements
      • Error Handling
      • Functions
      • Conditional Fail Expression
      • Accessing Data Records and Fields
      • Mapping
      • Parameters
      • Regular Expressions
    • CTL Debugging
      • Debug Perspective
      • Importing and Exporting Breakpoints
      • Inspecting Variables and Expressions
      • Examples
    • Functions Reference
      • Conversion Functions
      • Date Functions
      • Mathematical Functions
      • String Functions
      • Mapping Functions
      • Container Functions
      • Record Functions (Dynamic Field Access)
      • Miscellaneous Functions
      • Lookup Table Functions
      • Sequence Functions
      • Data Service HTTP Library Functions
      • Custom CTL Functions
      • CTL2 Appendix - List of National-specific Characters
      • HIDDEN Subgraph Functions
    • Tutorial
      • Creating a Transformation Graph
      • Filtering the records
      • Sorting the Records
      • Processing Speed-up with Parallelization
      • Debugging the Java Transformation
  • DATA SHAPER SERVER
    • Introduction
    • Administration
      • Monitoring
    • Using Graphs
      • Job Queue
      • Execution History
      • Job Inspector
    • Cluster
      • Sandboxes in Cluster
      • Troubleshooting
  • Install Data Shaper
    • Install Data Shaper
      • Introduction to Data Shaper installation process
      • Planning Data Shaper installation
      • Data Shaper System Requirements
      • Data Shaper Domain Master Configuration reference
      • Performing Data Shaper initial installation and master configuration
        • Creating database objects for PostgreSQL
        • Creating database objects for Oracle
        • Executing Data Shaper installer
        • Configuring additional firewall rules for Data Shaper
Powered by GitBook
On this page
  • Short Description
  • Ports
  • Metadata
  • XMLXPathReader Attributes
  • Details
  • XMLXPathReader Mapping Definition
  • Multivalue Fields
  • Best Practices
  • See also
  1. DATA SHAPER DESIGNER
  2. Readers

XMLXPathReader

PreviousXMLReaderNextWriters

Last updated 1 month ago

Short Description

XMLXPathReader reads data from XML files.

Which XML Component?

Generally, use . It is fast and has GUI to map elements to records. It is based on SAX. can use more complex XPath expressions than XMLExtract, e.g. it allows you to reference siblings. On the other hand, this XMLReader is slower and needs more memory than XMLExtract. XMLReader is based on DOM. XMLReader supersedes the original XMLXPathReader. XMLXPathReader can use more complex XPath expressions than XMLExtract. XMLXPathReader uses DOM.

COMPONENT
DATA SOURCE
INPUT PORTS
OUTPUT PORTS
EACH TO ALL INPUTS
DIFFERENT TO DIFFERENT OUTPUTS
TRANSFORMATION
TRANSF. REQ.
JAVA
CTL
AUTO-PROPAGATED METADATA

XMLXPathReader

XML file

0-1

1-n

x

✓

x

x

x

x

x

The component sends different data records to different output ports using return values of the transformation. For more information, see Return Values of Transformations. XMLExtract and XMLXPathReader send data to ports as defined in their Mapping or Mapping URL attribute.

Ports

PORT TYPE
NUMBER
REQUIRED
DESCRIPTION
METADATA

Input

0

x

One field (byte, cbyte, string).

Output

0

✓

For correct data records.

Any [1]

1-n

[2]

Error port

Any [1] (each port can have different metadata)

[1] Metadata on each output port does not need to be the same. Metadata can use . Note: source_timestamp and source_size functions work only when reading from a file directly (if the file is an archive or it is stored in a remote location, timestamp will be empty and size will be 0). [2] Other output ports are required if mapping requires that.

Metadata

Metadata on each output port does not need to be the same. Metadata can use Autofilling Functions. Note: source_timestamp and source_size functions work only when reading from a file directly (if the file is an archive or it is stored in a remote location, timestamp will be empty and size will be 0).

XMLXPathReader Attributes

ATTRIBUTE
REQ.
DESCRIPTION
POSSIBLE VALUES

Basic

File URL

Yes

Charset

Encoding of records that are read. The default encoding depends on DEFAULT_CHARSET_DECODER in defaultProperties.

UTF-8 |

Data Policy

Strict (default) | Controlled [1] | Lenient

Mapping

[2]

An external text file containing the mapping definition. For more information, see XMLXPathReader Mapping Definition below.

Mapping URL

[2]

Mapping the input XML structure to output ports. For more information, see XMLXPathReader Mapping Definition below.

Implicit mapping

If true, map element values to the fields having a same name in record. Example: An element (salary) is automatically mapped onto field of the same name (salary).

If true, map element values to the fields having a same name in record. Example: An element (salary) is automatically mapped onto field of the same name (salary).

Advanced

XML features

Number of skipped mappings

0-N

Max number of mappings

0-N

[1] Controlled data policy in XMLXPathReader does not send error records to edge. Records are written to the log. [2] One of these has to be specified. If both are specified, Mapping URL has higher priority.

Details

Example 23. Mapping in XMLXPathReader

<Context xpath="/employees/employee" outPort="0">
    <Mapping nodeName="salary" cloverField="basic_salary"/>
    <Mapping xpath="name/firstname" cloverField="firstname"/>
    <Mapping xpath="name/surname" cloverField="surname"/>
    <Context xpath="child" outPort="1" parentKey="empID" generatedKey="parentID"/>
    <Context xpath="benefits" outPort="2" parentKey="empID;jobID" generatedKey="empID;jobID"
                              sequenceField="seqKey" sequenceId="Sequence0">
        <Context xpath="financial" outPort="3" parentKey="seqKey" generatedKey="seqKey"/>
    </Context>
    <Context xpath="project" outPort="4" parentKey="empID;jobID" generatedKey="empID;jobID">
        <Context xpath="customer" outPort="5" parentKey="projName;projManager;inProjectID;Start"
                                  generatedKey="joinedKey"/>
    </Context>
</Context>

Note: The nested structure of <Context> tags is similar to the nested structure of XML elements in input XML files. However, the Mapping attribute does not need to copy all XML structure, it can start at the specified level inside the whole XML file.

XMLXPathReader Mapping Definition

  1. Every Mapping definition (both the contents of the file specified in the Mapping URL attribute and the Mapping attribute) consists of <Context> tags which contain also some attributes and allow mapping of element names to Data Shaper fields.

  2. Each <Context> tag can surround a series of nested <Mapping> tags. These allow to rename XML elements to Data Shaper fields.

  3. Each of these <Context> and <Mapping> tags contains some XMLXPathReader Context Tag Attributes and XMLXPathReader Mapping Tag Attributes, respectively.

Note: By default, mapping definition is implicit. Therefore elements (e.g. salary) are automatically mapped onto fields of the same name (salary) and you do not have to write: <Mapping xpath="salary" cloverField="salary"> Thus, use explicit mapping only to populate fields with data from distinct elements.

  1. XMLXPathReader Context Tags and Mapping Tags

  • Empty Context Tag (Without a Child) <Context xpath="xpathexpression"XMLXPathReader Context Tag Attributes />

  • Non-Empty Context Tag (Parent with a Child) <Context xpath="xpathexpression"XMLXPathReader Context Tag Attributes> (nested Context and Mapping elements (only children, parents with one or more children, etc.) </Context>

  • Empty Mapping Tag (Renaming Tag) - xpath is used: <Mapping xpath="xpathexpression"XMLXPathReader Mapping Tag Attributes/> - nodeName is used: <Mapping nodeName="elementname"XMLXPathReader Mapping Tag Attributes/>

  1. XMLXPathReader Context Tag and Mapping Tag Attributes a) XMLXPathReader Context Tag Attributes

  • xpath Required The xpath expression can be any XPath query. Example: xpath="/tagA/…​/tagJ"

  • outPort Optional The number of an output port to which data is sent. If not defined, no data from this level of Mapping is sent out using such level of Mapping. Example: outPort="2"

  • parentKey Both parentKey and generatedKey must be specified. The sequence of metadata fields on the next parent level separated by a semicolon, colon, or pipe. Number and data types of all these fields must be the same in the generatedKey attribute or all values are concatenated to create a unique string value. In such a case, the key has only one field. Example: parentKey="first_name;last_name" Equal values of these attributes assure that such records can be joined in the future.

  • generatedKey Both parentKey and generatedKey must be specified. The sequence of metadata fields on the specified level separated by a semicolon, colon, or pipe. Number and data types of all these fields must be the same in the parentKey attribute or all values are concatenated to create a unique string value. In such a case, the key has only one field. Example: generatedKey="f_name;l_name" Equal values of these attributes assure that such records can be joined in the future.

  • sequenceId When a pair of parentKey and generatedKey does not insure a unique identification of records, a sequence can be defined and used. Id of the sequence. Example: sequenceId="Sequence0"

  • sequenceField When a pair of parentKey and generatedKey does not insure a unique identification of records, a sequence can be defined and used. A metadata field on the specified level in which the sequence values are written. Can serve as parentKey for the next nested level. Example: sequenceField="sequenceKey"

  • b) XMLXPathReader Mapping Tag Attributes

  • xpath Either xpath or nodeName must be specified in the <Mapping> tag. XPath query. Example: xpath="tagA/…​/salary"

  • nodeName Either xpath or nodeName must be specified in the <Mapping> tag. Using nodeName is faster than using xpath. XML node that should be mapped to Clover field. Example: nodeName="salary"

  • cloverField Required A Clover field to which XML node should be mapped. The name of the field in the corresponding level. Example: cloverField="SALARY"

  • trim Optional Specifies whether leading and trailing white spaces should be removed. By default, it removes both leading and trailing white spaces. Example: trim="false" (white spaces will not be removed)

Multivalue Fields

Best Practices

We recommend users to explicitly specify Charset.

See also

For port reading. See Reading from Input Port in .

Specifies which data source(s) will be read (XML file, input port, dictionary). See .

Determines what should be done when an error occurs. For more information, see .

A sequence of individual true/false expressions related to XML features which should be validated. The expressions are separated from each other by a semicolon. For more information, see .

The number of mappings to be skipped continuously throughout all source files. See .

The maximum number of records to be read continuously throughout all source files. See .

XMLXPathReader reads data from XML files (using the DOM parser). It can also read data from compressed files, input port, and dictionary. This component is slower and needs more memory than , which can read XML files too. supersedes the XMLXPathReader.

namespacePaths Optional Default namespaces that should be used for the xpath attribute specified in the <Context> tag. Pattern: namespacePaths='prefix1="URI1";…​;prefixN="URIN"' Example: namespacePaths='n1="http://. Note: remember that if the input XML file contains a default namespace, this namespacePaths must be specified in the corresponding place of the Mapping attribute. In addition, namespacePaths is inherited from the <Context> element and used by the <Mapping> elements.

namespacePaths Optional Default namespaces that should be used for the xpath attribute specified in the <Mapping> tag. Pattern:¨namespacePaths='prefix1="URI1";…​;prefixN="URIN"' Example: namespacePaths='n1="http:// Note: remember that if the input XML file contains a default namespace, this namespacePaths must be specified in the corresponding place of the Mapping attribute. In addition, namespacePaths is inherited from the <Context> element and used by the <Mapping> elements.

The component XMLXPathReader does not support reading of multivalue fields. See see . If you need to read multivalue fields from XML, use or .

XMLExtract
XMLReader
Autofilling Functions
XMLExtract
XMLReader
www.w3.org/TR/html4/";n2="http:\//ops.com/"'
www.w3.org/TR/html4/";n2="http:\//ops.com/"'
XMLExtract
XMLReader
XMLWriter
Common Properties of Components
Specific Attribute Types
Common Properties of Readers
XMLExtract
XMLReader
Multivalue Fields
Supported File URL Formats for Readers
Supported File URL Formats for Readers
Data Policy
XML Features
Selecting Input Records
Selecting Input Records