Read From XML

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
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Read From XML

Post by behrouz »

All,

I have a XML file which is defined as below:
<XML deffinition..>
<endheadertag>
- <sets>
- <set id="0">
. <differents sub-tag>..
.
.
</sets>
my sets tag is repeted less(3times) than my promotions tags(15 times)
<promotions>
.
.
</promotoions>
</endheadertag>

it seems to merge 2 differents axe of XML,

and i am trying to read this xml from xml output but get some strange error

do i have to split them before reading? if yes how to do so?

can anyone explaine in detail what am i wrong for reading my xml?
i use external source and read my xml by ls xmlfile.xml command

then using xml_input
defining/stage/ validate input xml, etat=reject,error=reject,warning=reject
transformation setting/repetation element required, replace emty valu with nulls

input/ xml source coloumn define my input record from external source
-xml document checked

Output/transformation setting -includ namespace declaration('i loaded my schema md5..)

and define a second output for my reject


but where is the problem to read this file?
i am reading the both tags in one times but does not work,
tryed to read them seperately from same xml file, did not work !
i indeed defined description as required

any helps plz?
thank you
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Read From XML

Post by chulett »

How did you create your XPath Expressions?
behrouz wrote:i am trying to read this xml from xml output but get some strange error
Do we have to guess the "strange error" you are getting? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Re: Read From XML

Post by behrouz »

chulett wrote:How did you create your XPath Expressions?
behrouz wrote:i am trying to read this xml from xml output but get some strange error
Do we have to guess the "strange error" you are getting? :?
LOL, thank you for your reply,

in fact i just got the error XML_Input_114,0: Operator terminated abnormally: received signal SIGILL
main_program: Step execution finished with status = FAILED.

but i solved it,
now i need to know how to define the key when you have different deffinition in different sub-tag?

eg
if you have
<my_tag>
<tag1>
<val>sqsdqsd<\val>
<val>aaa<\val>
<val>bbb<\val>
</tag1>

<shop>
<tel>09777</tel>
<fax>098</fax>
</shop>
<tag1>
<val>sqsdqsd<\val>
<val>aaa<\val>
</tag1>

<shop>
<tel>09777</tel>
<tel>0987</tel>
<tel>0987</tel>
<tel>0987</tel>
<fax>098</fax>
</shop>

what do i have to define as key? val or tel? the both is not possible
i ca not extract all expected data, i extract only a part of them



thank you
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Spend some time reviewing many of the xml threads here in the forum.

The key here is to have a separate link for each repeating "path" for which you want rows....

Create an independent table definition from the xml importer for each of those nodes. Include their common parent info. Make the "key" on each link a member of the repeating node (one for the "15" and another for the "3")....

...downstream you can join those links together if you feel it is necessary, although in most parsing scenarios where you are targeting an rdbms, the target is already normalized along those paths...

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Post by behrouz »

thank you all,
it s sure before sending any post i do some search
but i expected some help from experts here which was not the case,

i solved

Regards
Behrouz
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

behrouz wrote:but i expected some help from experts here which was not the case
How was that "not the case"? You got help from the expert here. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Post by behrouz »

Do you see any helpful reply here? please read them, i just had some advice to do some search wich i did before and did not find

i do not see any help here lol :-)
but i hope for the other post are not the same as myne
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You seem to be missing a vital point on how things work here, many many people can see the entirety of Ernie's always very helpful posts.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Well...the advice in my last post is "the" answer for multiple repeating nodes, regardless of whether additional searching in the forum was done or not.

Ernie
Ernie Ostic

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