XML Stage in Datastage

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
purohitsrikanth
Participant
Posts: 1
Joined: Thu Jul 26, 2018 11:01 am

XML Stage in Datastage

Post by purohitsrikanth »

Hi,
I am working on a XML job where i am creating the data into an XML

so the xml is being created based on an ID which is a key but whenever there is a value populated in <Benefits>/<Benefit>/<CAMP>/<EventType> the XML created is something like the one shown in 2. I want the XML to be created like 1. irrespective of the values populated. can anyone point to me whats goign wrong here?

1.

Code: Select all

<Name>Example</Name>
<ID>12345</ID>
 <Groups>
  <Group GroupType="ME">
	 <TransactionType>AU</TransactionType>
		 <CarrierIdentifiers>
			 <CarrierIdentifier>
				 <Value>10020335</Value>
				 <Date>20180101</Date>
				 <Name>ID_NBR</Name>
			 </CarrierIdentifier>
				 <CAMP>
					 <EventType></EventType>
					 <EventDate></EventDate>
					 <Start></Start>
					 <End></End>
				 </CAMP>
  </Group>
 <Group GroupType="PH">
	<TransactionType>AU</TransactionType>
		<CarrierIdentifiers>
			<Value>10020335</Value>
			<Date>20180101</Date>
			<Name>ID_NBR</Name>
		</CarrierIdentifier>
		  <CAMP>
				<EventType></EventType>
				<EventDate></EventDate>
				<Start></Start>
				<End></End>
			</CAMP>
	 </Group>
	</Groups>

2.

Code: Select all

<Name>Example</Name>
<ID>12345</ID>
 <Groups>
	<Group GroupType="ME">
		<TransactionType>AU</TransactionType>
		 <CarrierIdentifiers>
				<CarrierIdentifier>
					<Value>10020335</Value>
					<Date>20180101</Date>
					<Name>ID_NBR</Name>
				</CarrierIdentifier>
					<CAMP>
						<EventType>TEST</EventType>
						<EventDate>20180101</EventDate>
						<Start>2010101</Start>
						<End>20190101</End>
					</CAMP>
	</Group>
 </Groups>					
<Name>Example</Name>
<ID>12345</ID>
 <Groups>							
	<Group GroupType="PH">
	 <TransactionType>AU</TransactionType>
		<CarrierIdentifiers>
			<Value>10020335</Value>
			<Date>20180101</Date>
			<Name>ID_NBR</Name>
			</CarrierIdentifier>
		<CAMP>
			<EventType>TEST</EventType>
			<EventDate>20180101</EventDate>
			<Start>2010101</Start>
			<End>20190101</End>
		</CAMP>
	</Group>
</Groups>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

FYI -

Code: Select all

 tags preserve whitespace and thus formatting.  :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Not sure "exactly" what is happening here because there could be a lot of things going on, depending on the expectation of those nodes and whether they repeat (or not), but I've seen things like this with child nodes when they don't have a unique identifier.

One thing that might help with testing is to generate a unique counter upstream for something in "CAMP" and then put it into that node as an additional element like (in the xpath of the description) /.../Group/CAMP/dummyCounter/text()

That may or may not solve it, but it might help you debug it, if that changes the behavior of that node's formatting.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply