ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » message set with repeating fields

Post new topic  Reply to topic Goto page 1, 2  Next
 message set with repeating fields « View previous topic :: View next topic » 
Author Message
vasanthi
PostPosted: Wed Aug 03, 2005 12:08 pm    Post subject: message set with repeating fields Reply with quote

Apprentice

Joined: 23 Apr 2005
Posts: 42

hi
here i need some idea on creating a message set with repeating fields.my input is xml.ineed to create a message set for this.the problem is it is having multiple occurences of a tag called <field>

example:

<field abc='aaa'>45</field>
<field abc='bbb'>vas</field>
<field abc='ccc'>789</field>
<field abc='ddd'>def</field>
<field abc='eee'>45</field>
................................
................................
.................................

<field abc='xxx'>ten</field>
so i have some hundred tags like this.for each and every field tag there is a ' abc' attribute which has some value.when i try to generate a schema file for this with WSAD it just gives me tag <field> with number of occurences=unbounded.so when i import this XSD into my message set it creates an element 'field 'with max occurs=unbounded. but no attribute values are generated. so can anybody suggest me where i am doing wrong.
so i will be thankful if anybody can give me some idea about creating such message set with repeating elements and different attribute values.

regards
vasanthi
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 03, 2005 2:19 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I guess the first thing is to be sure that you need to create a message set...

Do you need to validate the structure and content of the document? If not, then you don't need a message set.

It sounds like you aren't creating the schema correctly to indicate the attributes. Can you post a sample of the definition for the field element?

Also, field is a really bad name. Try something more descriptive.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vasanthi
PostPosted: Thu Aug 04, 2005 9:54 am    Post subject: repeating elements Reply with quote

Apprentice

Joined: 23 Apr 2005
Posts: 42

Thanks jeff
here i am attaching the schema that is generated for the field tag.

<xsd:element name="field">
<xsd:complexType mixed="true">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="reference"/>
</xsd:choice>
<xsd:attribute name="NAME" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>

yes i need to validate the incoming message. same like the field tag i also have some other tags in the message which are also repeating like the field tag.once i create the message set i can validate and also use mapping node for mapping the input to output.

regards
vasanthi
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Aug 09, 2005 1:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Do you really need
Code:
mixed="true"
in your definition? If not, you should remove it, because it will inhibit validation of the members of that complex type.
Back to top
View user's profile Send private message
vasanthi
PostPosted: Tue Aug 09, 2005 6:28 am    Post subject: Reply with quote

Apprentice

Joined: 23 Apr 2005
Posts: 42

thanks kimbert

i have removed the mixed="true". but i still cannot understand how to create these repeating fields with different attribute names in the message set.

regards
vasanthi
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Aug 09, 2005 6:38 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
i still cannot understand how to create these repeating fields with different attribute names
Your example did not use different attribute names - all the attributes were called 'abc'. Now I'm not sure what you're trying to do. Can you post another example of your message.
Back to top
View user's profile Send private message
vasanthi
PostPosted: Tue Aug 09, 2005 7:34 am    Post subject: Reply with quote

Apprentice

Joined: 23 Apr 2005
Posts: 42

thanks kimbert

sorry for my mistake. here i am posting the example once again

<field abc='aaa'>45</field>
<field abc='bbb'>vas</field>
<field abc='ccc'>789</field>
<field abc='ddd'>def</field>
<field abc='eee'>45</field>
................................
................................
.................................

sorry my attribute names are same.but the values i am assigning to those attribute names are different.my main aim is to use the mapping node.so i am getting an input xml message which i need to map to the above example.

i was able to do this in ESQl.but i want to see that if this can be done using the mapping node so that the burden of writing ESQL code can be reduced.

regards
vasanthi
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Aug 09, 2005 7:37 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

So, you want to use a different map for

<field abc='aaa'>45</field>

versus

<field abc='bbb'>vas</field>


based on the value of the abc attribute?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
vasanthi
PostPosted: Tue Aug 09, 2005 8:00 am    Post subject: Reply with quote

Apprentice

Joined: 23 Apr 2005
Posts: 42

thanks kimbert

i need not map based upon the attribute value. here is an example of my input xml.

<id>5555</id>
<key>66</key>
<name>abcd</name>
<desc>str</desc>
---------
------
--------

so my input will be coming like this.

so for example i need to map the

<id> ----> <field abc=id > </field>
<name> ----> <field abc=custname><field>
<desc> -----><field abc=description><field>
<key>----><field abc=keyvalue><field>

so my final output should look like

<field abc=id > 5555</field>
<field abc=custname>abcd<field>
<field abc=description>str<field>
<field abc=keyvalue>str<field>

regards
vasanthi
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Aug 09, 2005 8:13 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If the input field names are dynamic or not fully predefined, you can't do this with the Mapping node.

It's probably pretty straightfoward to write an XSLT to do this - but I'm not an XSLT developer so I don't know.

It was relatively straightforward to write ESQL to do this transformation, but I don't think I still have the code I wrote to do it.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vasanthi
PostPosted: Tue Aug 09, 2005 9:08 am    Post subject: Reply with quote

Apprentice

Joined: 23 Apr 2005
Posts: 42

thanks jeff

i want to create the output message set like this

<field abc=id >
<field abc=custname>
<field abc=description>
<field abc=keyvalue>

so later i can map the input xml message i have given above to this output message set.here the values for the attribute abc are constant.

regards
krishnam
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Aug 10, 2005 1:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Do you really need to have all your elements called 'field'. This style of XML document is hard to validation against an XML Schema.

However, if you really want to do this, I have some good news for you.
You can get the MRM to do this automatically, and you will not need to do any mapping. The XML Render property on an element allows you to render it with a fixed name ( 'field' in your case ) and an attribute which gives the real identity ('abc').

Here's how:

Create a message set with two XML physical formats (inputXML and outputXML)
Create a message 'inputMessage' with child elements id, name, desc and key

Go to the outputXML properties of id
Set 'XML Render' to 'XMLElementAttrId'
Set 'ID Attribute Name' to 'abc'
Set 'ID Attribute Value' to 'id'

Go to the outputXML properties of name
Set 'XML Render' to 'XMLElementAttrId'
Set 'ID Attribute Name' to 'abc'
Set 'ID Attribute Value' to 'custname'

Go to the outputXML properties of desc
Set 'XML Render' to 'XMLElementAttrId'
Set 'ID Attribute Name' to 'abc'
Set 'ID Attribute Value' to 'Description'

Go to the outputXML properties of key
Set 'XML Render' to 'XMLElementAttrId'
Set 'ID Attribute Name' to 'abc'
Set 'ID Attribute Value' to 'keyvalue'

If you parse your example message using physical format 'inputXML' and then write it using physical format 'outputXML', you will automatically get the mapping which you described above.
Back to top
View user's profile Send private message
vasanthi
PostPosted: Wed Aug 10, 2005 11:04 am    Post subject: Reply with quote

Apprentice

Joined: 23 Apr 2005
Posts: 42

Thanks Kimbert

i tried and it worked. i was able to get the output as mentioned above.but for example i need to add some other tags in between

<field abc=id > 5555</field>
<field abc=custname>abcd<field>
<ref type='dat'>
<key NAME=abc>55</key>
<key NAME=def>50</key>
</ref >

<field abc=description>str<field>
<field abc=keyvalue>str<field>

how can this <ref> tag can be added which is having an attribute name and value and under it contains two <key> tags.sorry if i am asking too much. i am eager to know how these kind of problems can be handled without writing ESQl.

regards
vasanthi
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 10, 2005 11:06 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

vasanthi wrote:
i am eager to know how these kind of problems can be handled without writing ESQl.


You will have to do some things with ESQL.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Aug 11, 2005 12:40 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Jeff is correct - you will need to write some ESQL to insert the extra element into the tree. You will also need to declare the element 'ref' and its child attribute 'name' in your message model. You can either make it a global element, and leave the message definition unchanged, or alternatively you could add it as an optional (minOccurs=0) member of the message definition.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » message set with repeating fields
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.