Page 1 of 1

XML Output Stage Usage

Posted: Thu Jul 19, 2012 7:16 am
by balu536
Hi,
I've a requirement where i need to extract the data from Flat file and load it to XML File. The sample XML File given to me is mentioned below.

Please help me on this.

Code: Select all

  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <report xmlns="http://www.***.com/reportSchema">
 - <jobSummary>
  - <jobDefinition>
      <jobName>TARGET LOADER</jobName> 
	  <frequency>HOURLY</frequency> 
	  <sourceSystem>SOURCE</sourceSystem> 
	  <targetSystem>TARGET</targetSystem> 
	  </jobDefinition>
	  <redwoodJobID>1</redwoodJobID> 
	  <startDate>20120408060000</startDate> 
	  <endDate>20120408060000</endDate> 
    </jobSummary>
- <workSliceStatistics>
	  <parentRunId>2207</parentRunId> 
- <workSliceDetails>
- <workSliceDetail>
 	 <workSliceDate>20120408060000</workSliceDate> 
 	 <sourceSystemNbr>9360</sourceSystemNbr> 
 	 <insertNbr>9360</insertNbr> 
 	 <updateNbr>0</updateNbr> 
 	 <deleteNbr>0</deleteNbr> 
 	 <distinctNbr>0</distinctNbr> 
  </workSliceDetail>
  - <workSliceDetail>
   	 <workSliceDate>20120505050000</workSliceDate> 
   	 <sourceSystemNbr>5897</sourceSystemNbr> 
   	 <insertNbr>2546</insertNbr> 
   	 <updateNbr>120</updateNbr> 
   	 <deleteNbr>365</deleteNbr> 
   	 <distinctNbr>457</distinctNbr> 
  </workSliceDetail>
  </workSliceDetails>
  </workSliceStatistics>
- <logDetails>
- <logDetail>
  	<detailRunId>10</detailRunId> 
  	<logDetailHeader>MapReduce Jobs</logDetailHeader> 
  	<logDetailContent>http://****.***.com:50030/jobdetails.jsp?jobid=job_201207171652_0196</logDetailContent> 
  </logDetail>
- <logDetail>
  	<detailRunId>11</detailRunId> 
  	<logDetailHeader>System Error</logDetailHeader> 
  	<logDetailContent>Exception stack trace</logDetailContent> 
  </logDetail>
  </logDetails>
  </report>

Posted: Thu Jul 19, 2012 7:17 am
by balu536
Please help on how to configure the XML Output Stage for this requirement.

Posted: Thu Jul 19, 2012 7:19 am
by chulett
First step would be to get your hands on an xsd and import that metadata so you can properly configure the XML Output stage.

Posted: Thu Jul 19, 2012 7:21 am
by balu536
Hi,
I've imported the xsd and defined the key column in meta data. Please help on steps to be followed in XML Output Stage

Posted: Thu Jul 19, 2012 8:23 am
by chulett
I'm sure those steps are documented in the manuals. I'm curious how much XML experience you have, both in general and with DataStage in particular? It can get very... confusing... if this is your first exposure to the Wonderful World of XML.

Posted: Thu Jul 19, 2012 8:41 am
by rameshrr3
The best sites to learn about Xpath. XSLT and XML are the w3 websites.
Tutorials will help , but w3 gives you an understanding that surpasses all else ( at least to my knowledge) - since all explanations are detailed and verbose - though not everyone likes it that way . The XML pack reference in datastage is good if you are just starting with XML stages - please inform your managers about the skills gap if you are unfamiliar- I assume you work for an organization that understands timely and open communication.

Xpath specification : http://www.w3.org/TR/xpath/

Posted: Thu Jul 19, 2012 9:04 am
by chulett
Also make sure you understand a couple of things:

1. The dashes in your desired output are not part of the actual XML but rather an artifact of your display tool - IE, I assume.

2. Do not worry about all of the formatting your example shows - you format ('pretty print') XML for peoples, not for consumption by other systems. Each XML file is perfectly happy to be a stream of characters, i.e. "one long record".