Author |
Message
|
chris boehnke |
Posted: Fri Sep 25, 2015 9:35 am Post subject: removing empty XML tags |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
All,
We are using Message broker V8.0.0.2.
I am using ESQL to map the data from backend to client response. The data coming from backend is a collection of benefits.
So in order to map correctly with the client response schema,
a. I am first creating the XML whith empty tags, which matches the client schema.
b. Then I am mapiong the values to the client rsp created.
I am seeing empty tags for which there is no data.
How can I remove the empty tags after mapping the backend data? |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Sep 25, 2015 9:46 am Post subject: Re: removing empty XML tags |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
chris boehnke wrote: |
a. I am first creating the XML whith empty tags, which matches the client schema.
|
sorry to be a bit pedantic on a Friday but you are not creating the XML. You are creating a message tree. This is only converted to XML when the tree hits whatver output node you have wired into your flow.
As for what your want then something like this might do the job
Quote: |
set OutputRoot.XMLNSC.Data.Tree1.Tree2.Tree3 = NULL;
|
To delete the .Tree3 element. _________________ 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 |
|
 |
joebuckeye |
Posted: Fri Sep 25, 2015 11:23 am Post subject: Re: removing empty XML tags |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
chris boehnke wrote: |
So in order to map correctly with the client response schema,
a. I am first creating the XML whith empty tags, which matches the client schema.
b. Then I am mapiong the values to the client rsp created. |
Why are these separate steps?
Why are you not mapping the values as you are creating the message tree?
Also, you may need to keep empty tags if the schema calls for it (rare but possible). Remember your response needs to match the schema when you are done with your mapping, not before then.
This way if the mapped data does not exist it should map to NULL and remove (or not create) that element in the message tree. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Oct 01, 2015 6:14 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The only reason to create an empty message tree representing an XML document before you populate the fields is to ensure that the resulting XML document is in the correct order when it's serialized.
It's usually more straight forward to just make sure your ESQL executes in the proper order when you populate fields in the message tree. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
timber |
Posted: Thu Oct 01, 2015 7:53 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
I agree. And in current versions of IIB either a Mapping node, or a JavaCompute node using JAXB, is a better solution. |
|
Back to top |
|
 |
|