Author |
Message
|
scravr |
Posted: Wed Nov 21, 2007 10:31 am Post subject: Eliminate empty elements on output XML |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
HI ALL,
On a compute node I generate XML output from imput-XML + DB calls.
How do I eliminate empty output elements?
..
...
..
and happy ThanksGiving to all,
Moshe |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 21, 2007 2:21 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You are using a Compute node, so this is completely under your control. Don't put things in OutputRoot unless you want the corresponding tags in your output message. |
|
Back to top |
|
 |
AkankshA |
Posted: Wed Nov 21, 2007 7:48 pm Post subject: Re: Eliminate empty elements on output XML |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
scravr wrote: |
How do I eliminate empty output elements?
|
compare the value of elements with ''(empty element) and if the condition is satisfied initialize them to NULL.
 _________________ Cheers |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Nov 21, 2007 10:41 pm Post subject: Re: Eliminate empty elements on output XML |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi scravr,
AkankshA wrote: |
scravr wrote: |
How do I eliminate empty output elements?
|
compare the value of elements with ''(empty element) and if the condition is satisfied initialize them to NULL. |
In more elaborate terms...if the DB is returning empty i.e '' use COALESCE, but if not returning fields(which i thought would be a more obvious database architecture) i.e nulls, then use NULLIF.
Regards. |
|
Back to top |
|
 |
scravr |
Posted: Thu Nov 22, 2007 8:27 am Post subject: |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
The problem is: I have lots of these assignments from InputRoot to OutputRoot and more from DB calls:
SET PCS.INCIDENTDATETIME = AIB.INCIDENTDATETIME;
SET PCS.DESCRIPTIONRECURRINGTIME = AIB.DESCRIPTIONRECURRINGTIME;
SET PCS.VARCHAR100_3 = AIB.VARCHAR100_3;
SET PCS.REFERRINGAGENCY = AIB.REFERRINGAGENCY;
SET PCS.LOCATIONTYPE = AIB.LOCATIONTYPE;
SET PCS.AREATYPE = AIB.AREATYPE;
(PCS points to OutputRoot and AIB points to InputRoot)
So if I need to check each for NULL (or empty), the code will go from 300 lines to 1800 lines:
(adding the: IF .... = NULL THEN ... ELSE... END IF)
Since many of input elements maybe empty (in some cases), I am looking to see if there is a simpler way to ask compute node (or some other node following the comute) to eliminate empty elements.
One more related question:
--------------------------------
I created a msg-set + dictionary from XSD file.
The flow gets MQinput XML file according to XSD.
The above compute node needs to create a new XML msg (as a subset of the original input).
Last step is to MQoutput the new generated XML to a Q.
The MQinput node parsh the XML correctly (as MRM with the msg-set format). The compute node maps input to output correctly, and msg is posted nicly on outQ.
Great ha....
But when looking into trace I see lot of error messages on the MQoutput, saying new XML is not formated corectly according to XSD.
Well, the new XML as nothing to do with the XSD...
How to I gener a new XML that has no relation to other XML, XSD...?
What do I need to copy from InputRoot to OutputRoot?
SET OutputRoot = InputRoot;
SET OutputRoot.Properties= InputRoot.Properties;
SET OutputRoot.MRM = NULL;
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC';
DECLARE PCS REFERENCE TO OutputRoot.XMLNSC;
Anything else ????? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 22, 2007 10:33 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
add
SET PSC.myxmlroottag = InputRoot.MRM;
or your mapping for PSC.myxmlroottag.... _________________ MQ & Broker admin |
|
Back to top |
|
 |
|