Removing <?xml version = "1.0" encoding = "

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Removing <?xml version = "1.0" encoding = "

Post by parag.s.27 »

Hi All,

I am having a small problem with XML, which after reading all the posts, I am still not able to solve. the problem description is as follows: -

I am having data where I need to send a message on MQ. The data is being read from tables then transformed and then it is converted to XML and then sent to MQ. Now in data if a Client has more then 1 account then a single message should be generated where all the accounts will come in one message for only that Client No. Finally this message payload has to be added to a Wrapper called as CCP Trigger.

I was able to manage the first part using trigger column property, but int this case the Wrapper also repeats for each account number, due to which the XML is not well formed. So I used a way to create a payload in one XML stage and then sent the output as a single row using output as Root and then this value was fed to another XML stage as an input where I added this incoming payload to a wrapper "/defns:".

Now the message is getting opened in Internet Explorer but the tag

Code: Select all

<?xml version = "1.0" encoding = "UTF-8"?>
is repeating in between the XML message for each XML stage.

This causes the XML to be rejected by MQ in Tibco. I want to have only single occurrence of "<?xml version = "1.0" encoding = "UTF-8"?>" tag and remove all in between tags.

I am not able to do it even after trying many settings. Can anyone help me with this.

@Ernie: I've read many of your posts but could not find anything matching this. May be I've not searched enough.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

Following is the sample of one of my XML

Code: Select all

"<?xml version="1.0" encoding="UTF-8" ?>"
- <defns:CCP_Trigger xmlns:defns="http://schemas.xyz.com/CCP/Standards/Common/Messaging/CCP_Trigger_v1_0/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:schemas-xyz-com:dataservices-application-abc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
  <defns:TriggerSentTimestamp>2010-03-10T23:01:16</defns:TriggerSentTimestamp> 
- <defns:TriggerKey> 
  <defns:IDType>ProfileID</defns:IDType> 
  <defns:IDValue>ID1</defns:IDValue> 
  </defns:TriggerKey> 
- <defns:TriggerDetails> 
  <defns:CorrelationID>ID1</defns:CorrelationID> 
  <defns:DataCategory>Profile</defns:DataCategory> 
  <defns:DataSubCategory>ID</defns:DataSubCategory> 
  <defns:RefreshFlag>N</defns:RefreshFlag> 
  <defns:Event>GWMIndexProfileEvent</defns:Event> 
  "<?xml version="1.0" encoding="UTF-8" ?>"  
- <defns:Payload> 
- <ns1:TCRMService> 
  <ns1:requestID>{ID}{1000563}{DS.xyz.abc.pqr.COM}{lmn}{2010-03-10 23:01:16.163005}</ns1:requestID> 
Here the tag <?xml version="1.0" encoding="UTF-8" ?> in quotes is repeating twice. I want to remove the second iteration.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
ArjunK
Participant
Posts: 30
Joined: Sun Apr 30, 2006 6:32 pm

Post by ArjunK »

In the XML Output Stage --> Output Tab --> Document Settings --> Check the property "Generate XML Chunk"

This will prevent the "<?xml version = "1.0" encoding = "UTF-8"?>" tag from getting generate for each output xml.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Hmm.... If I understand the issue, it would appear to simply be that the first XMLOutput Stage is creating a fully valid and normal document, and then the next XMLOutput Stage is "wrapping it" again inside of another normal document......

If that's the problem, look at the settings in your first XMLOutput Stage.....find and check the "generate chunk" setting....that means "create this xml formatted snippet (chunk), without any header info"......

Then your first xml will not be a valid document on its own, just a "chunk" to carry downstream and include somewhere else.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

eostic wrote:Hmm.... If I understand the issue, it would appear to simply be that the first XMLOutput Stage is creating a fully valid and normal document, and then the next XMLOutput Stage is "wrapping it" again inside of another normal document......

If that's the problem, look at the settings in your first XMLOutput Stage.....find and check the "generate chunk" setting....that means "create this xml formatted snippet (chunk), without any header info"......

Then your first xml will not be a valid document on its own, just a "chunk" to carry downstream and include somewhere else.

Ernie
Hey Ernie thanks for that man and apologies for not updating the post first. After I posted this issue, I searched more and I found one link shared by you where I found this. That link was having the golden old Best Practice doc, in that same forum I found this solution.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
Post Reply