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 » MRM to XMLNSC migration

Post new topic  Reply to topic
 MRM to XMLNSC migration « View previous topic :: View next topic » 
Author Message
pawel_janowski
PostPosted: Tue Feb 07, 2012 6:59 am    Post subject: MRM to XMLNSC migration Reply with quote

Apprentice

Joined: 13 Dec 2006
Posts: 38

Hi!
We are trying to migrate from MRM to XMLNCS. In the MRM domain, the name of the root element of the input message isn't stated explicitly so I can refer to the content of the XML message (its elements) directly
Code:
InputRoot.MRM.header.field1
regardless of the name of the root element.

Is the simple way in XMLNSC domain to do the same? I mean to obtain a general way to rewrite from InputRoot to OutputRoot elements of the message which are of the same form, as was previously coded:
Code:
OutputRoot.MRM.header.field1 = InputRoot.MRM.header.field1


Regards,

Pawel

WMB 6.1 on AIX
Code:

_________________
Pawel Janowski
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Feb 07, 2012 7:03 am    Post subject: Re: MRM to XMLNSC migration Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

pawel_janowski wrote:
Is the simple way in XMLNSC domain to do the same? I mean to obtain a general way to rewrite from InputRoot to OutputRoot elements of the message which are of the same form, as was previously coded:
Code:
OutputRoot.MRM.header.field1 = InputRoot.MRM.header.field1


Have you tried:

Code:
OutputRoot.XMLNSC.header.field1 = InputRoot.XMLNSC.header.field1

_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 07, 2012 7:07 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So if the input document looks like
Code:
<xml>
<root>
     <header>
        <field1>data</field1>
        <field2>data</field2>
    <header/>
    <body>
         <field1>data</field1>
....
    </body>
</root>

Then, yes, when you import the schema that describes this into an MRM model, then you will use
Code:
Root.header.field1
to access the field1 data from the header, and use will use
Code:
Root.root.header.field1
to access the field1 data from the header.

And, yes, it's easy enough to use find/replace to change all occurrances of "Root.header" to "Root.root.header".
Back to top
View user's profile Send private message
pawel_janowski
PostPosted: Tue Feb 07, 2012 7:14 am    Post subject: Reply with quote

Apprentice

Joined: 13 Dec 2006
Posts: 38

mqjeff wrote:
So if the input document looks like
Code:
<xml>
<root>
     <header>
        <field1>data</field1>
        <field2>data</field2>
    <header/>
    <body>
         <field1>data</field1>
....
    </body>
</root>

Then, yes, when you import the schema that describes this into an MRM model, then you will use
Code:
Root.header.field1
to access the field1 data from the header, and use will use
Code:
Root.root.header.field1
to access the field1 data from the header.

And, yes, it's easy enough to use find/replace to change all occurrances of "Root.header" to "Root.root.header".


Yes, but in such case I have to know the name of the root element ("root" in this case). I ask if I can do this in situation when I don't know what I've got on input, but I know that the message on input contains "header".

Pawel
_________________
Pawel Janowski
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Feb 07, 2012 7:17 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

pawel_janowski wrote:
I ask if I can do this in situation when I don't know what I've got on input, but I know that the message on input contains "header".


Start here and keep reading.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
pawel_janowski
PostPosted: Tue Feb 07, 2012 7:20 am    Post subject: Reply with quote

Apprentice

Joined: 13 Dec 2006
Posts: 38

Vitor wrote:
pawel_janowski wrote:
I ask if I can do this in situation when I don't know what I've got on input, but I know that the message on input contains "header".


Start here and keep reading.


Thanx.

I did this like this:
Quote:

OutputRoot.XMLNSC.outbody.header.field1 = InputRoot.XMLNSC.(XML.Element)[1].header.field1


P.
_________________
Pawel Janowski
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Feb 07, 2012 7:25 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

pawel_janowski wrote:
I did this like this:
Quote:

OutputRoot.XMLNSC.outbody.header.field1 = InputRoot.XMLNSC.(XML.Element)[1].header.field1


You might want to consider using a field type different to XML.Element. Something that starts with XMLNSC which is part of the XMLNSC domain would be my tip.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Feb 07, 2012 7:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

pawel_janowski: Not sure whether
a) you're a genius or
b) the XMLNSC pages in the info center are getting quite good or
c) you had a lucky moment

Either way, that is exactly the right solution.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 07, 2012 7:26 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It will be more performant to
Code:
Declare thisRef REFERENCE TO InputRoot.XMLNSC;
MOVE thisRef FIRSTCHILD FIELDTYPE(XMLNSC.Element)


Note that you cannot safely use XML domain constants when referring to XMLNSC elements.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 07, 2012 7:30 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

kimbert wrote:
that is exactly the right solution.

Except for that pesky "(XML.Element)" stuck in there.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Feb 07, 2012 7:34 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

mqjeff : Good point. That *must* be changed to XMLNSC.Element. I'm sure pawel_janowski knows why this is important.
Back to top
View user's profile Send private message
pawel_janowski
PostPosted: Tue Feb 07, 2012 9:26 am    Post subject: Reply with quote

Apprentice

Joined: 13 Dec 2006
Posts: 38

Vitor wrote:
pawel_janowski wrote:
I did this like this:
Quote:

OutputRoot.XMLNSC.outbody.header.field1 = InputRoot.XMLNSC.(XML.Element)[1].header.field1


You might want to consider using a field type different to XML.Element. Something that starts with XMLNSC which is part of the XMLNSC domain would be my tip.


I followed your tip and used XMLNSC.Folder instead of XML.Element.
Thanks.

Pawel
_________________
Pawel Janowski
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Feb 07, 2012 12:25 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I followed your tip and used XMLNSC.Folder instead of XML.Element
XMLNSC.Element is the correct choice.
If your document consisted of a single root tag with a value, XMLSNC.Folder wouldn't match the root element. I know that's an unlikely input document, but XMLNSC.Element is specifically designed for matching any XML tag. Accurate code is better than code that 'just works'.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » MRM to XMLNSC migration
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.