Author |
Message
|
Anannya |
Posted: Wed Jul 11, 2012 1:11 pm Post subject: Embedding XML within an XML in WTX |
|
|
Newbie
Joined: 11 Jul 2012 Posts: 9
|
I have a situation in which I have to generate one xml, and embed that xml in another xml. I am trying to simplify my problem with an example -
Consider I have 2 xsd's - employee.xsd and salary.xsd.
salary.xsd generates an xml in which I have the split of my salary structure. So, a very basic salary.xml would look like -
<salary>
<basic>1000</basic>
<tax>50</tax>
<HRA>123</HRA>
</salary>
employee.xsd generates an xml in which we have all the details of an employee like name, age, DOB and a also tag called as salarystructure. I want to embed the salary xml (shown above) inside this salarystructure tag. So, a very basic employee.xml would look like:
<employee>
<name>Anannya</name>
<age>26</age>
<DOB>3rd Feb</DOB>
<salarystructure>
<salary>
<basic>1000</basic>
<tax>50</tax>
<HRA>123</HRA>
</salary>
</salarystructure>
</employee>
Can anyone please let me know how to do this in WTX? I tried using 2 output cards with the "Onsuccess -> append" option applied for the 2nd one, but the salary xml gets appended to the employee xml at the very end i.e. at after the </employee> tag. This is not what I want. I want to EMBED it in between. Any inputs? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jul 11, 2012 1:16 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
Anannya |
Posted: Wed Jul 11, 2012 1:19 pm Post subject: |
|
|
Newbie
Joined: 11 Jul 2012 Posts: 9
|
lancelotlinc wrote: |
Please use [c o d e ] tags. |
I am sorry, I did not get you.... |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jul 11, 2012 1:21 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Anannya wrote: |
lancelotlinc wrote: |
Please use [c o d e ] tags. |
I am sorry, I did not get you.... |
Edit your original post, and put the code you pasted in the original post inside [c od e] tags.
Like this...
_________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Anannya |
Posted: Wed Jul 11, 2012 1:24 pm Post subject: |
|
|
Newbie
Joined: 11 Jul 2012 Posts: 9
|
I have a situation in which I have to generate one xml, and embed that xml in another xml. I am trying to simplify my problem with an example -
Consider I have 2 xsd's - employee.xsd and salary.xsd.
salary.xsd generates an xml in which I have the split of my salary structure. So, a very basic salary.xml would look like -
Code: |
<salary>
<basic>1000</basic>
<tax>50</tax>
<HRA>123</HRA>
</salary>
|
employee.xsd generates an xml in which we have all the details of an employee like name, age, DOB and a also tag called as salarystructure. I want to embed the salary xml (shown above) inside this salarystructure tag. So, a very basic employee.xml would look like:
Code: |
<employee>
<name>Anannya</name>
<age>26</age>
<DOB>3rd Feb</DOB>
<salarystructure>
<salary>
<basic>1000</basic>
<tax>50</tax>
<HRA>123</HRA>
</salary>
</salarystructure>
</employee>
|
Can anyone please let me know how to do this in WTX? I tried using 2 output cards with the "Onsuccess -> append" option applied for the 2nd one, but the salary xml gets appended to the employee xml at the very end i.e. at after the employee tag. This is not what I want. I want to EMBED it in between. Any inputs? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jul 11, 2012 1:28 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
ESQL would be much more efficient here. What is your motivation for using WTX? Why unnecessarily complicate the operation? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Anannya |
Posted: Wed Jul 11, 2012 1:29 pm Post subject: |
|
|
Newbie
Joined: 11 Jul 2012 Posts: 9
|
Using WTX is a mandate and I am not an ESQL guy. Is there any way in which we can do this in WTX? |
|
Back to top |
|
 |
inMo |
Posted: Thu Jul 12, 2012 6:26 am Post subject: |
|
|
 Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
Quote: |
I want to embed the salary xml (shown above) inside this salarystructure tag |
Are you looking to dynamically embed something like salary xml, or are you always looking to produce the same final fixed structure? |
|
Back to top |
|
 |
Anannya |
Posted: Thu Jul 12, 2012 6:31 am Post subject: |
|
|
Newbie
Joined: 11 Jul 2012 Posts: 9
|
Yes, I want it dynamically. My requirement is that the ENTIRE output generated by out1 card (in this example its is salary) should be included in the output generated by the 2nd output card.
If not clear, let me know. i will try to explain again. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Jul 12, 2012 7:01 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Anannya wrote: |
Using WTX is a mandate and I am not an ESQL guy. Is there any way in which we can do this in WTX? |
Whose mandate? The current implementation of WTX is a legacy implementation and new code should not be written using it. DFDL is the current generation technology. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 12, 2012 12:46 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Just so that we're all clear in our minds...
- DFDL is a parser, like XMLNSC or JSON or MRM. It's true that DFDL is the best option for parsing and writing non-XML data formats. You would not, however, use DFDL to combine two XML documents into a single document.
- WMB does have native facilities that can do that trick. It would be very simple in ESQL or Java. I'm pretty sure it would be very easy using the new mapping node and its associated mapping editor.
If you explain a little more about where the two XML documents come from and how they are presented to the WMB flow then we may be able to suggest a very straightforward solution. Worth a try? |
|
Back to top |
|
 |
shanson |
Posted: Mon Jul 16, 2012 1:09 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Sounds like you need a WTX map with two input cards and one output card. the single output is built from the two inputs. If you do go down the WTX route, then you should build the maps using the xsds (do not import the xsds to create type trees). But to echo the earlier sentiments, you don't need WTX to do this. |
|
Back to top |
|
 |
|