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 » XML creation in MB

Post new topic  Reply to topic
 XML creation in MB « View previous topic :: View next topic » 
Author Message
panktibhavsar
PostPosted: Tue Oct 21, 2008 3:45 pm    Post subject: XML creation in MB Reply with quote

Newbie

Joined: 21 Oct 2008
Posts: 1

Hi,

I am creating a xml file using Message broker. I am mapping my input file to a target message set created with the help of an xsd.

The output is in format EAIHdr><hdrVer>1</hdrVer><eaiTmstp>2008-09-1810:30:40.890</eaiTmstp><countryCd>WW</countryCd></EAIHdr>

But I need data in
<EAIHdr>
<hdrVer>1</hdrVer>
<eaiTmstp>2008-09-1810:30:40.890</eaiTmstp>
<countryCd>WW</countryCd>
</EAIHdr>

I need a new line after every name value pair in xml.

Can anyone help me on this?
Back to top
View user's profile Send private message
broker_new
PostPosted: Tue Oct 21, 2008 4:16 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

your requirement looks something strange but you can do it either by Java Compute node or using TDS message set.
you have to use multiple type defnitions and for each type you have to specify Group Indicators with unicode characters for "<" and ">" and delimiters as <CR> or <LF> depending on the operating system.

TDS message domain is a powerful feature to create and parse any type of data.
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
sebastianhirt
PostPosted: Wed Oct 22, 2008 12:09 am    Post subject: Reply with quote

Yatiri

Joined: 07 Jun 2004
Posts: 620
Location: Germany

Sorry, maybe I am ignorant. But why would you need those linebreaks?
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Oct 22, 2008 12:44 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

OK, here are the facts.
- Any proper XML parser will ignore whitespace. Why do you think you need it?
- You cannot do what you require using the MRM parser.
- You can do what you require with the XMLNSC parser, and you can still use the Mapping node to construct it.
Back to top
View user's profile Send private message
eskil
PostPosted: Mon Dec 01, 2008 4:57 am    Post subject: Reply with quote

Novice

Joined: 25 Nov 2008
Posts: 14

I'm hijacking this thread little.

If I want my outputted XML to be in an "inline" format how do I do that? I'm using the XMLNSC domain, but can't find any settings to get this fysical format.

The problem I have is that the receiving system is also parsing the <CR> characters in the elements holding the data. Which gives me some trouble.

I would like to change the following format:
Code:

<document>
  <head>
     <title>
       Title_data_here
     </title>
  </head>
</document>


.. to..
Code:

<document>
  <head>
     <title>Title_data_here</title>
  </head>
</document>


.. or at least to..
Code:

<document><head><title>Title_data_here</title></head></document>
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Dec 01, 2008 5:10 am    Post subject: Reply with quote

Grand High Poobah

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

eskil wrote:
The problem I have is that the receiving system is also parsing the <CR> characters in the elements holding the data.


At worst, it should be holding them as escaped characters. To a properly compliant parser, those 2 forms are identical because the tag structure is the same. The CRs are whitespace outside the tags & shouldn't be visible except as that.

Get the receiving system to use a proper parser.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Dec 01, 2008 5:22 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I'm using the XMLNSC domain, but can't find any settings to get this fysical format.
Where have you looked? I hope you haven't tried changing the message set properties. XMLNSC does not use them.

Facts:
- By default, XMLNSC discards any characters, including any whitespace, between the end of one tag and the start of the next.
- If you enable the 'Retain mixed content' option in the XMLNSC parser properties, then it will put the whitespace into the message tree as nameless fields with the field type set to XMLNSC.PCDataValue.
- If you really want to insert whitespace into your output XML, you can create elements in the message tree and explicitly set their field type to 'PCDataValue'.

You are getting unwanted whitespace in your XMLNSC output message. So your message tree *must* contain some fields with field type 'XMLNSC.PCDataValue'. If you created them yourself, stop doing so. If the XMLNSC parser put them there, ask it to stop.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Dec 01, 2008 5:23 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
The CRs are whitespace outside the tags & shouldn't be visible except as that.


The whitespace inside of <title> must be maintained, as it is properly part of the element value.

All other whitespace in the original example is also "inside" of tags, although properly part of "mixed content", rather than fully as an element value. The distinction between mixed content and an element value is whether or not an element also occurs inside the tag.

So it's not quite as clear cut as it looks. It's not legal to turn the example into anything "flatter" than
Code:
<document><head><title>
title_data_here
</title></head></document>
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Dec 01, 2008 5:27 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Thanks Jeff - that is a very important point which I should have mentioned
Back to top
View user's profile Send private message
eskil
PostPosted: Mon Dec 01, 2008 5:29 am    Post subject: Reply with quote

Novice

Joined: 25 Nov 2008
Posts: 14

I totally agree on that. But just incase if they are not able to fix this on their side, is there anything I can do about it to get either format #2 or #3?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Dec 01, 2008 5:31 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

There's always a way.

Whether there's a good way or not is a different question...

A simple way would be to flatten the document into a BLOB and then use OVERLAY to remove all <CR>/<LF>/<CR><LF> sets that you find.
Back to top
View user's profile Send private message
eskil
PostPosted: Mon Dec 01, 2008 5:55 am    Post subject: Reply with quote

Novice

Joined: 25 Nov 2008
Posts: 14

Sorry for making a hen from a feather (or perhaps vacuum) here. The problem was actually me. I had autodetect XML message marked on MQmon. Removing it I actually saw that the whole XML message was in an "inline" format, so everything is as it should.

Thanks anyway guys, I will definately not do this misstake again.
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 » XML creation in MB
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.