on 12-16-2013 2:34 PM
Hi Experts,
Below is my source structure.
<record>
<first>
<second>
<third>
<fourth>
.
.
.
.
<record>
It has around 100 fields. I want to write a udf by having these 100 fields as arguments (Also i don't want to give the filed names one by one in the arguments). Is there any other way to get all these values without adding all of them in the arguments?
Is it possible to get them via <record>?
Thanks in advance!
Regards,
Senthil J
Hello Senthil,
In your message mapping editor, right-click on the record and then select ReturnAsXML and then pass this to your UDF (make sure to parse the XML input though).
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil,
You could also to use a simply XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="./child::*">
<xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instead you can do coding in a java mapping and get values from xml tags using DOM or SAX parsers.
It would be difficult to have 100 inputs in UDF and also difficult while passing (mapping) inputs, testing it.
Regards,
Pranav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil,
It is possible to get all fields from parent node <record>, but then you need a java mapping instead of UDF. Check out this example using DOM parser http://www.drdobbs.com/jvm/easy-dom-parsing-in-java/231002580
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Such a complex conversion
Sorry but i don't think there is an alternative.
May be you can go with Java mapping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.