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 IndexWebSphere Message Broker SupportRemoving empty tags from XML using DFDL

Post new topicReply to topic
Removing empty tags from XML using DFDL View previous topic :: View next topic
Author Message
IIB_Intel
PostPosted: Fri Jul 07, 2017 4:23 am Post subject: Removing empty tags from XML using DFDL Reply with quote

Apprentice

Joined: 07 May 2015
Posts: 32

My input message is a fixed length message and I am using DFDL parser to parse and validate it.

Then I am converting/Serializing into an XML. Few fields in the input can have value as blank spaces, dfdl, on xml conversion is creating empty xml tags for those fields.

Is there any setting in the dfdl schema that I can use on these fields so that if the value of a field in the input is blank spaces it doesn't create empty tag in xml?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 07, 2017 4:27 am Post subject: Re: Removing empty tags from XML using DFDL Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19147
Location: LI,NY

IIB_Intel wrote:
My input message is a fixed length message and I am using DFDL parser to parse and validate it.

Then I am converting/Serializing into an XML. Few fields in the input can be blank space, dfdl, on xml conversion is creating empty xml tags for those fields.

Is there any setting in the dfdl schema that I can use on these fields so that if the value of a fields in the input is blank spaces it doesn't create empty tag in xml?

You do not specify whether the field is optional or nillable in XML. So there is no straight answer. Once you have figured this out you can look at your DFDL definition for null values for the field in question, and handle the XML accordingly...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
IIB_Intel
PostPosted: Fri Jul 07, 2017 4:41 am Post subject: Reply with quote

Apprentice

Joined: 07 May 2015
Posts: 32

I tried by specifying few fields as option in DFDL schema and trying various combination of null & nillable values but it still creates those empty xml tags.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jul 07, 2017 4:48 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17257

If you're trying to change the XML output, then you need to change the XML model... (xsd)
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Fri Jul 07, 2017 6:20 am Post subject: Reply with quote

Apprentice

Joined: 07 May 2015
Posts: 32

There is just one dfdl model being used. First I use that to parse incoming fixed length then convert it to xml.

Are you saying I need to create 2 message schema and do mapping between them?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jul 07, 2017 6:35 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17257

You need to model both your input message and your output message.

If one is DFDL and one is XML, then you need separate models.
ss
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Fri Jul 07, 2017 11:26 am Post subject: Reply with quote

Apprentice

Joined: 07 May 2015
Posts: 32

And of-course I would need mapping between two models?
Back to top
View user's profile Send private message
timber
PostPosted: Sun Jul 09, 2017 2:55 pm Post subject: Reply with quote

Yatiri

Joined: 25 Aug 2015
Posts: 629

Quote:
Is there any setting in the dfdl schema that I can use on these fields so that if the value of a field in the input is blank spaces it doesn't create empty tag in xml?
No, but I don't blame you for asking.

If the length of an element in the input bitstream is non-zero then it *will* appear in the message tree. You can control whether DFDL parses it as a normal (logical) value or as a NULL value. This is by design, btw. DFDL is a parsing technology, not a mapping technology. Including this feature would have blurred that line.
Back to top
View user's profile Send private message
mbsa
PostPosted: Mon Jul 10, 2017 8:59 am Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

I had the requirement of removing empty tags in the xml. I used COALESCE function which default NULL while mapping optional fields to get rid of empty tags.
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Tue Jul 11, 2017 5:17 am Post subject: Reply with quote

Apprentice

Joined: 07 May 2015
Posts: 32

I can parse a fixed length message with dfdl parse and easily convert it to xml (ofcourse xml will have empty strings).

I am thinking of writing a generic esql method to remove all empty tags instead of doing a 2nd mapping.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportRemoving empty tags from XML using DFDL
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.