xml writer

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
satheesh_color
Participant
Posts: 182
Joined: Thu Jun 16, 2005 2:05 am

xml writer

Post by satheesh_color »

Hi,

I just want to create an xml file with the help of xml writer from oracleDB as source.


Output

<Id=1 name="aaa" age=23 city="plano" state="TX" /Id>
<Id=2 name="bbb" age=25 city="Divnie" state="OH" /Id>


Please through me some light on how to acheive this in server job.


Thanks,
Satheesh
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

The doc is pretty good, but in brief, put an XMLOutput Stage on your canvas....it has lots of options for how and where you want to send the xml. Your xml snippet below doesn't exactly look correct, but it's close...... what you need is the following xpath expressions (or close to these) in the Description property for each of your columns on the input link: (you need a root element and such to have a valid xml document)...

[this assumes that you have columns of ID, name, age, city, state coming in...

/myXML/id/@id
/myXML/id/@name
/myXML/id/@age
.
.
.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
satheesh_color
Participant
Posts: 182
Joined: Thu Jun 16, 2005 2:05 am

Post by satheesh_color »

Hi Ernie,

Thanks for your inputs. When i tried with XMLOutput stage i got the below value

<Outlet Id="10009" Name="SUMMERLIN @ WASHINGTON" Address1="30 N. SUMMERLIN AVE." City="ORLANDO" State="FL" PostalCode="328012930" CountryCode="US" DIVISION_CO
DE="0071599" DIVISION_NAME="FLORIDA DIVISION" MACRO_MARKET_CODE="9" MACRO_MARKET_NAME="FL_Orlando" SUBSCRIPTION_DMA_CODE="534" SUBSCRIPTION_DMA_NAME="ORLANDO-
DAYTONA"></Outlet>

can i create a xml with the below format

<Outlet Id="10009" Name="SUMMERLIN @ WASHINGTON" Address1="30 N. SUMMERLIN AVE." City="ORLANDO" State="FL" PostalCode="328012930" CountryCode="US" DIVISION_CO
DE="0071599" DIVISION_NAME="FLORIDA DIVISION" MACRO_MARKET_CODE="9" MACRO_MARKET_NAME="FL_Orlando" SUBSCRIPTION_DMA_CODE="534" SUBSCRIPTION_DMA_NAME="ORLANDO-
DAYTONA"/>

This needs to be discarded </Outlet> on each record. Please help me out on this thing.

Thanks.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Both are equivalent. If the tooling receiving this does not allow </outlet> then they are not supporting industry standard XML.

You can get rid of it if you need, by passing the final string to a transformer stage....put an output link on your xml with one big column (such as "myxmloutput" with longvarchar and a length of say, 1024)....put a single slash in its Description property. Send that to a Transformer and get rid of whatever you don't want in the string.

Ernie
Ernie Ostic

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