Skip to main content Skip to complementary content

Mapping an XML structure with dynamic elements

Use the XPath Name property to work with XML files containing different elements.

About this task

In this example, you have two XML files with the same structure, but with different element names. You want to create a structure in Talend Data Mapper that can handle all of these files.

Once the structure is configured, you want to create a map to get a JSON file containing the element names and values.

This example uses the following XML samples:
<root>
	<book>
		<title>Pride and Prejudice</title>
		<author>Jane Austen</author>
		<isbn>978-0141439518</isbn>
	</book>
	<book>
		<title>Jane Eyre</title>
		<author>Charlotte Bronte</author>
		<isbn>978-0553211405</isbn>
	</book>
</root>
<root>
	<dvd>
		<title>Selma</title>
		<director>Ava DuVernay</director>
		<released>2014</released>
	</dvd>
	<dvd>
		<title>The Hurt Locker</title>
		<director>Kathryn Bigelow</director>
		<released>2008</released>
	</dvd>
</root>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!