Author |
Message
|
Fayaz |
Posted: Wed Aug 17, 2011 8:46 am Post subject: Anonymous mixed content xml mapping |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
Hi,
I have a DB select output which I am trying to map to a complex xml structure. Problem is I do have a couple of anonymous mixed content fields and it seems to be repeating in the XML structure for multiple rows. My DB output looks as below:
Col1 Col2 Col3 Col4 Col5
1 English Title - en 7 Blue - en
1 French Title -fr 7 Blue - fr
1 German Title -de 7 Blue - de
1 English Title -gb 21 Black - en
1 French Title -fr 21 Black - fr
1 German Title -de 21 Black - de
and I am trying to map to an xml like:
Code: |
<ContentMaster>
<Entry>
<Col1>1</Col1>
<Col3 Col2="English">Title - en</Col3>
<Col3 Col2="French">Title - fr</Col3>
<Col3 Col2="German">Title - de</Col3>
<Entry1>
<Color Col4="7">
<Col5 Col2="English">Blue - en</Col5>
<Col5 Col2="French">Blue - fr</Col5>
<Col5 Col2="German">Blue - de</Col5>
</Color>
<Color Col4="21">
<Col5 Col2="English">Black - en</Col5>
<Col5 Col2="French">Black - fr</Col5>
<Col5 Col2="German">Black - de</Col5>
</Color>
</Entry1>
</Entry>
</ContentMaster> |
I have created a schema but it is giving me duplicate results for all the anomymous mixed content values, how can I eliminate this?
Thanks,
Fayaz
Last edited by Fayaz on Wed Aug 17, 2011 11:10 am; edited 1 time in total |
|
Back to top |
|
 |
kotagiriaashish |
Posted: Wed Aug 17, 2011 9:16 am Post subject: |
|
|
 Disciple
Joined: 06 Aug 2011 Posts: 165
|
|
Back to top |
|
 |
Fayaz |
Posted: Wed Aug 17, 2011 9:17 am Post subject: |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
By using the message mapping node.. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Aug 17, 2011 9:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you haven't configured your map to produce the output you desire.
Perhaps you should review how the map is built and see what you can do to adjust it. |
|
Back to top |
|
 |
Fayaz |
Posted: Wed Aug 17, 2011 9:27 am Post subject: |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
I can't use the occurence feature because that would choose only one value...what other message map functions can I use here to eliminate this? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Aug 17, 2011 9:34 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The relevant mapping functions or mapping configuration that produces your desired output.
What is your desired output? |
|
Back to top |
|
 |
Fayaz |
Posted: Wed Aug 17, 2011 9:36 am Post subject: |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
It is this:
Code: |
<ContentMaster>
<Entry>
<Col1>1</Col1>
<Col3 Col2="English">Title - en</Col3>
<Col3 Col2="French">Title - fr</Col3>
<Col3 Col2="German">Title - de</Col3>
<Entry1>
<Color Col4="7">
<Col5 Col2="English">Blue - en</Col5>
<Col5 Col2="French">Blue - fr</Col5>
<Col5 Col2="German">Blue - de</Col5>
</Color>
<Color Col4="21">
<Col5 Col2="English">Black - en</Col5>
<Col5 Col2="French">Black - fr</Col5>
<Col5 Col2="German">Black - de</Col5>
</Color>
</Entry1>
</Entry>
</ContentMaster> |
Right now I am getting:
Code: |
<ContentMaster>
<Entry>
<Col1>1</Col1>
<Col3 Col2="English">Title - en</Col3>
<Col3 Col2="French">Title - fr</Col3>
<Col3 Col2="German">Title - de</Col3>
<Col3 Col2="English">Title - en</Col3>
<Col3 Col2="French">Title - fr</Col3>
<Col3 Col2="German">Title - de</Col3>
<Entry1>
<Color Col4="7">
<Col5 Col2="English">Blue - en</Col5>
<Col5 Col2="French">Blue - fr</Col5>
<Col5 Col2="German">Blue - de</Col5>
</Color>
<Color Col4="21">
<Col5 Col2="English">Black - en</Col5>
<Col5 Col2="French">Black - fr</Col5>
<Col5 Col2="German">Black - de</Col5>
</Color>
<Color Col4="7">
<Col5 Col2="English">Blue - en</Col5>
<Col5 Col2="French">Blue - fr</Col5>
<Col5 Col2="German">Blue - de</Col5>
</Color>
<Color Col4="21">
<Col5 Col2="English">Black - en</Col5>
<Col5 Col2="French">Black - fr</Col5>
<Col5 Col2="German">Black - de</Col5>
</Color>
</Entry1>
</Entry>
</ContentMaster> |
Last edited by Fayaz on Wed Aug 17, 2011 11:09 am; edited 3 times in total |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Aug 17, 2011 9:51 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
Fayaz |
Posted: Wed Aug 17, 2011 10:01 am Post subject: |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Aug 17, 2011 11:03 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Code Tags.
Makes listing and code samples much more HUMAN readable.
When you add an entry there are a number of options presented above the box where you tyoe your text.
B i U Quote Code List List= Img URL
B = Bold
i = italic
U = Underscore
Quote = Obvious
Code = {see Above}
Etc. etc.
As the Meerkats say, Simples.
So why not go back and edit your posts and then you will see the difference. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Fayaz |
Posted: Wed Aug 17, 2011 11:11 am Post subject: |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
Thanks SM...I have edited my posts....hope it's easier to read now... |
|
Back to top |
|
 |
Fayaz |
Posted: Thu Aug 18, 2011 6:41 am Post subject: |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
hey guys...any updates on this? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 18, 2011 6:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's a direct consequence of how your map is written.
There doesn't appear to actually be any anonymous mixed content in your output message. Or if there actually is, you've not shown it properly.
You just appear to have mapped things more than once. |
|
Back to top |
|
 |
Fayaz |
Posted: Wed Aug 24, 2011 7:07 am Post subject: |
|
|
Novice
Joined: 21 Jul 2011 Posts: 18
|
How do I control the mapping, can't seem to find anything which would help me to get the required resultset.. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Aug 24, 2011 7:18 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If you can't figure out how to do it in Mapping, perhaps you should consider using ESQL, Java, or PHP.
On the other hand, nobody here knows how you've tried to do it via mapping, since you haven't posted any information about your map itself - just what you have as input and what you're trying to get as output.
So maybe if you showed what you have tried, rather than essentially asking us to write the map for you, you might get more information. |
|
Back to top |
|
 |
|