Simple XMLExtract -- Help for a noob

Hey Guys,

I’ve been playing around with clover today going through the user manual. So far what I have done is built a very simple graph – it takes contact data in from several pipe-delimited files, merges them, sorts them, dedupes and the creates two outputs. The data itself is nothing more than firstname and last name. Now I am trying to add an XMLExtract to the mix.

I’ve creates a file that has the following –


<People>
   <Person>
      <Firstname>John</Firstname>
      <Lastname>Doe</Lastname>
   <Person>
   <Person>
      <Firstname>Jane</Firstname>
      <Lastname>Doe</Lastname>
   <Person>
</People>

I added the XMLExtract node to my graph, used the same metadata as I have for the other (pipe-delimeted text) nodes. For the mapping I have the following –


<Mappings>
	<Mapping element="person" outPort="0">
		<Mapping element="firstname" />
		<Mapping element="lastname" />
	</Mapping>
</Mappings>]

The result does correctly find the 2 nodes but the firstname and lastname fields are not extracted. No doubt I am missing something super easy. I know that I could run it through a transform to create a single node with first/last name in it, but I am wondering if I have to? or can I somehow map these two child nodes directly to the firstname and lastname metadata?

Thanks in advance – I have many questions for anyone who has time.

A.

Hello,
following is proper mapping (with assumption, that you have lastname and firstname fields in your output metadata):

<Mappings>
	<Mapping element="People">
		<Mapping element="Person" outPort="0" xmlFields="Firstname;Lastname" cloverFields="firstname;lastname"/>
	</Mapping>
</Mappings>