Extract node using tXMLMap?

One Star

Extract node using tXMLMap?

Hi,
Is it possible to extract a node (as Document or as String) from an element (with sub-elements) in tXMLMap (like in extractXMLField)?
I am currently only able to extract the value of an element in tXMLMap.
If extracting the node is not an option, is it possible then to extract the unique path in the XML from the element in tXMLMap?
We need to process the information of this element (with sub elements) many times for many different nodes in large XML files. Instead of repeating over-and-over the same mappings to our database in tXMLMap we would prefer to extract this node and have a joblet take care of the generic mappings.
Many thanks,
Robin
Community Manager

Re: Extract node using tXMLMap?

Hi Robin
If I understand you well, create a new Document (with the same XML tree of node which you want to extract) in the output table of tXMLMap, and link the revelant elements from the source Document to target Document.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Extract node using tXMLMap?

Hi Shong,
Thank you for your suggestion! Currently we are mapping the XML as you explained.
But...
Since the XML documents (SEPA Pacs, Camt and Pain) use many, many, many times the same complex type and this same complex type is used in all SEPA document types I was wondering if I could "generalize" the mapping by extracting the node as a document (and not do mapping per element here for each occurrence of the complex type per document). The extracted document would then be input for a joblet for instance.
This would leave all the complex mapping to a single joblet (implemented once, only one instance to maintain).
Any ideas? it is not we cannot do the job, it is more of having a lot of overhead and maintenance doing it this way.
Community Manager

Re: Extract node using tXMLMap?

Hi
To extract a node from a XML file, you can use tFileInputXML component, set the Loop XPath query to the node which you want to extract, see my screenshots. Once you extract the node, link it to a tXMLMap for extract value from the node or link it to a tJavaRow and put it to a global variable for use later.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business