Author |
Message
|
beth_carlin |
Posted: Wed Jan 18, 2012 5:41 pm Post subject: esql to transform xml |
|
|
Acolyte
Joined: 08 Jun 2004 Posts: 64
|
Hi Guru
I am trying to solve this problem. I appreciate any suggestion
my input xml:
<testinput>
<SetLevelProperties>
<Name name="Name">aa</Name>
<Description name="Description">bb</Description>
</SetLevelProperties>
</testinput>
I'd like the output to be like this (w/o the name='Name')
<testoutput>
<SetLevelProperties>
<TopName>aa</TopName>
<TopDescription>bb</TopDescription>
</SetLevelProperties>
</testoutput>
and this is my code:
SET OutputRoot.XML.testoutput.SetLevelProperties.TopName =
InputBody.testinput.SetLevelProperties.Name ;
SET OutputRoot.XML.testoutput.SetLevelProperties.TopDescription =
InputBody.testinput.SetLevelProperties.Description ;
but it comes out to be like this:
<testoutput>
<SetLevelProperties>
<TopName name="Name">aa</TopName>
<TopDescription name="Description">bb</TopDescription>
</SetLevelProperties>
</testoutput>
How can i rid the name="Name" in the output? Look thru the entire esql
manual and not find it yet.
Thanks again
Beth |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 18, 2012 8:12 pm Post subject: Re: esql to transform xml |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
|
Back to top |
|
 |
cociu_2012 |
Posted: Thu Jan 19, 2012 12:12 am Post subject: Re: esql to transform xml |
|
|
Acolyte
Joined: 06 Jan 2012 Posts: 72
|
beth_carlin wrote: |
Hi Guru
and this is my code:
SET OutputRoot.XML.testoutput.SetLevelProperties.TopName =
InputBody.testinput.SetLevelProperties.Name ;
SET OutputRoot.XML.testoutput.SetLevelProperties.TopDescription =
InputBody.testinput.SetLevelProperties.Description ;
How can i rid the name="Name" in the output? Look thru the entire esql
manual and not find it yet.
Thanks again
Beth |
What version of broker are you using. Isn't XML parser deprecated?
Solution is really simple:
Code: |
SET OutputRoot.XMLNSC.testoutput.SetLevelProperties.TopName = InputBody.testinput.SetLevelProperties.Name;
SET OutputRoot.XMLNSC.testoutput.SetLevelProperties.TopDescription = InputBody.testinput.SetLevelProperties.Description; |
This will output your desire XML.
To map Attributes you'll have to code:
Code: |
SET OutputRoot.XMLNSC.testoutput.SetLevelProperties.TopName(XMLNSC.Attribute)name = InputBody.testinput.SetLevelProperties.Name.name; |
Last edited by cociu_2012 on Thu Jan 19, 2012 4:23 am; edited 1 time in total |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 19, 2012 3:47 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You must change your message flow to use the XMLNSC domain. The XML domain is deprecated in *all* supported versions of WMB.
Please take the time to use [c o d e] tags when posting XML. It makes it much easier for us to understand your problem. You can use the edit button now if you like
If you just want to remove an attribute from the output message, then this is the easiest way to do it:
Code: |
SET OutputRoot.XMLNSC.testoutput = InputRoot.XMLNSC.testinput;
SET OutputRoot.XMLNSC.testOutput.(XMLNSC.Attribute)name = NULL; |
|
|
Back to top |
|
 |
cociu_2012 |
Posted: Thu Jan 19, 2012 4:20 am Post subject: |
|
|
Acolyte
Joined: 06 Jan 2012 Posts: 72
|
kimbert wrote: |
Code: |
SET OutputRoot.XMLNSC.testoutput = InputRoot.XMLNSC.testinput;
SET OutputRoot.XMLNSC.testOutput.(XMLNSC.Attribute)name = NULL; |
|
He has a different structure at Output. So the code you've posted will not solve the problem. He just has to map element by element.
Attributes will not map, as it needs special treatment. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 19, 2012 4:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
True - I missed the addition of the 'Top' prefix to the tag names. |
|
Back to top |
|
 |
beth_carlin |
Posted: Thu Jan 19, 2012 1:07 pm Post subject: Re: esql to transform xml |
|
|
Acolyte
Joined: 08 Jun 2004 Posts: 64
|
----------------------------------------
THANK YOU Guru, the FIELDVALUE works great and THANK to ALL of YOU. I am using wmbv7 |
|
Back to top |
|
 |
cociu_2012 |
Posted: Thu Jan 19, 2012 11:44 pm Post subject: Re: esql to transform xml |
|
|
Acolyte
Joined: 06 Jan 2012 Posts: 72
|
beth_carlin wrote: |
THANK YOU Guru, the FIELDVALUE works great and THANK to ALL of YOU. I am using wmbv7 |
I'm glad that it worked for you, but you should really take into consideration that using a DEPRECATED parser is not a good idea. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jan 20, 2012 2:45 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
using a DEPRECATED parser is not a good idea. |
 |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Jan 20, 2012 4:31 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
kimbert wrote: |
Quote: |
using a DEPRECATED parser is not a good idea. |
 |
SET OutputRoot.XML.testoutput.SetLevelProperties.TopName =
InputBody.testinput.SetLevelProperties.Name ;
SET OutputRoot.XML.testoutput.SetLevelProperties.TopDescription =
InputBody.testinput.SetLevelProperties.Description ;
--> you should use XMLNSC instead. _________________ Just use REFERENCEs |
|
Back to top |
|
 |
cociu_2012 |
Posted: Fri Jan 20, 2012 4:42 am Post subject: |
|
|
Acolyte
Joined: 06 Jan 2012 Posts: 72
|
mqsiuser wrote: |
Code: |
SET OutputRoot.[b]XML[/b].testoutput.SetLevelProperties.TopName =
InputBody.testinput.SetLevelProperties.Name ;
SET OutputRoot.[b]XML[/b].testoutput.SetLevelProperties.TopDescription =
InputBody.testinput.SetLevelProperties.Description ; |
--> you should use XMLNSC instead. |
your post is a little bit misleading. Setting XMLNSC just on mapping is not enough. He has to use this parser when first parsing occurs(Input node, ESQL parsing, and so on). If you're also using an MS, verify if you have XMLNSC checked.[/code] |
|
Back to top |
|
 |
|