Page 1 of 1

Need help while reading xml file

Posted: Sat Oct 06, 2012 11:59 pm
by moulipx
Hi all,

Could you please help me in reading below XML file .I need to produce an sequential file from Xml input file .

<Employee Place="USA" Status="Active" Date="2012-09-30">
<Name="AAA" No="1" Grade="B" />
<Name="BBB" No="2" Grade="D" />
<Name="CCC" No="3" Grade="F" />
</Employee>


I need to Create output file as below format

Name,No,Grade
AAA,1,B
BBB,2,D
CCC,3,F

Posted: Sun Oct 07, 2012 5:19 am
by chulett
What kind of help do you need? What have you tried and what issues have you faced? Have you ever worked with XML before?

Posted: Tue Oct 09, 2012 12:41 am
by moulipx
Hi ,
I never worked on XML part earlier. So please help me in extracting mentioned XML file

Posted: Tue Oct 09, 2012 3:29 am
by BI-RMA
Online-help contains a Section InfoSphere DataStage and QualityStage --> Reference -->XML-transformation containing a tutorial for the XML-Stage contained in IBM Information Server from version 8.5 FP1.

Posted: Tue Oct 09, 2012 5:49 am
by eostic
What everyone is saying here is to just follow the doc and give it a shot...the xml above is actually very straightforward and an excellent one to start with when learning about the various xml stages. Hint --- you'll need a table definition, and for this, the xmlInput Stage will be fine..... and spend more time doing searches thru the forum here. There are many threads that discuss xml, how to read it from disk, what to specify in the Stages, etc.

Ernie

Posted: Tue Oct 09, 2012 5:55 am
by eostic
I take that back. Sorry --- the xml that you have pasted up above is not legitimate xml. There needs to be an element name collecting the various attributes for each "name" line.

Did you cut and paste this from somwhere or type it in manually?

<Employee Place="USA" Status="Active" Date="2012-09-30">
<Name="AAA" No="1" Grade="B" />
<Name="BBB" No="2" Grade="D" />
<Name="CCC" No="3" Grade="F" />
</Employee>

Look carefully at the source again. It "should" be easy, but not in this format.

A good tricks to always try:

...put a string like that in an editor, like Notepad and add an xml header line at the top....

<?xml version="1.0" ?>

...then try to open it in IE or other favorite browser. You'll see that this one dies. It is not well-formed.

The problem is the attribute lines...the probably should be something like:

<EmployeeDetail Name="AAA" No="1" Grade="B" />

Ernie