XML Output Format

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
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

XML Output Format

Post by Raftsman »

Two of my output columns are float and decimal.

The input is 8.99 and 1998

When I parse the input, zeros come out on the numeric fields. Is there a way to see my output correctly without putting a XML transformer in the stream.

Thanks
Jim Stewart
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not enough information. What stage types are involved?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Try with varchar of 255
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

Post by Raftsman »

Sorry Ray, I agree, my message is very vague.

I am taking a XML file (sequential stage) and parsing it using the XML Input stage. On the output tab, I loaded the XML format in the description column. It is defined as /CATALOG/CD/PRICE/text(). But my price comes out as zeros. I am not sure if I am suppose to define it differently.

Thanks
Jim Stewart
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Neither are we without seeing the actual XML. How did you generate the XPath expression(s) you are using? By hand? Best would be to use the XML Metadata Importer goodie and point it to an xsd for the file in question.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

Post by Raftsman »

I used the metadata imported to load the layout. My input is one field called TITLE. All the infomation is correct until I reach the numeric values.


THe XML File is:

- <CATALOG>
- <CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>

My output layout is:

/CATALOG/CD/TITLE/text()
/CATALOG/CD/ARTIST/text()
/CATALOG/CD/COUNTRY/text()
/CATALOG/CD/COMPANY/text()
/CATALOG/CD/PRICE/text()
/CATALOG/CD/YEAR/text()
Jim Stewart
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Hi Jim...

Is that the "actual" XML file? (just curious --- it looks like a cut/paste from IE)...you might want to be sure that the file is clean in notepad or some other pure text editor.....

Otherwise, you are right --- it should be ok with the Xpath that you have specified. What are your datatypes on the columns? For simplicity, what happens when you make all of your columns pure VARCHAR with length of 255? This might be something that is happening after the xml parsing is completed.

Also, how are you looking at the results? Peek? Sending to a flat file? Something else? Make 'em all char or varchar and lets see what you get. Sounds possibly like an EE import thing and not an XMLPack thing...

Ernie
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

Post by Raftsman »

This is the real file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v2007 (http://www.altova.com) -->
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>

I am using the PEEK stage to verify the output.

The first four field are varchar(255) unicode
The price is FLOAT(10) scale 2
The year is DECIMAL(10)
Jim Stewart
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

as I suspected. make 'em all char. convert 'em later. they'll come out of the xml ok.

Ernie
Post Reply