XML requirement

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
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

XML requirement

Post by vamsi.4a6 »

1)I have one XML file which is having around 1000 columns and in target i need to load only 25 columns

Externalsourcestage-->XMLInput Stage-->Transfomer-->oracle connector

1)In Externalsourcestage i am reading it as single varchar field.In XMLInput Stage do i need to Metadata for 100 columns or 25 columns in outputpage Tab of XMLInput Stage since i need only 25 columns in target?

2)I have one parent tag and under that we have multiple child tags.
there is one to many relationship between parent and child tags.suppose if i have one parent tag and 2 child tages are present.In target i need 2 records.Not sure how to implement this requirement.do i need to use XML trasformer?
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Post by srinivas.nettalam »

What are you passing from ExternalSource stage and what option did you choose in XML input stage for input method URL or XML Content?
N.Srinivas
India.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

1) via the xmlInput Stage, you only need to describe the columns that you want to actually parse out of the xml document. Just describe the 25 that you need.

...Note that "per link", they need to be on the same nested node path...meaning parent-child-grandchild, etc. If you have another completely independent and un-related path (parent-child2), then you need another link (an example might be a company with an employees node, and then the same company with an assets node).

2) the stage is designed exactly for this purpose....describe your parent and child elements and then make ONE column from the child a "key". It doesn't mean a "key" from a uniqueness perspective --- it simply means that this element is the "repeating element" --- you will get two rows as your describe, or as many rows as there are repeating child nodes for the particular parent node.

...as noted in the post above, be sure to use the "URL" option on your input link of the xmlInput Stage in the External Source scenario, passing a "list" of xml documents into the Stage from a general "list" command (ls) inside the External Source.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post by vamsi.4a6 »

@srinivas.nettalam


Input Method is-XML Content


any body input is really appreciated
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

The questions are answered in the prior post.....but here are some further instructions.... Open your xml in the xml metadata importer (under imports...table definitions).

Expand the ENTIRE tree so that you can look at all of it. For your Parent-Child node section, check ONLY the inner-most boxes for the elements that you want...and ONLY the elements that you want, along with any attributes (orange colored icon).

Pick any one of them from the child node to be the key --- try to select something that you expect will always exist in the incoming document.

Ernie
Ernie Ostic

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