XML 2 same tags,same attributs but the value differents

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

behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

XML 2 same tags,same attributs but the value differents

Post by behrouz »

Dear All,

if you have the same attribut for the same tags with different value for you
attribut/tags how do you handlle this ?
eg:
<productMetaTitle language="en-US">YELLOW NECTARINES 1 KG</productMetaTitle>
<productMetaTitle language="de-DE">differents value2 here
KG</productMetaTitle>

as u see the value for language and productmetatitle are differents
en-Us,de-De for language and yellow Nectar/value2 here

how do you handle this please?
thank you
Regards
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I think you asked this already in another entry...
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 »

eostic wrote:I think you asked this already in another entry... ...
@eostic, that s not the anwser that i expected, if you see any post with answer you can send me the link
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post by MarkB »

behrouz wrote:
eostic wrote:I think you asked this already in another entry... ...
@eostic, that s not the anwser that i expected, if you see any post with answer you can send me the link
...and why should he do that??? You can check your own posts and see that you've asked this before: viewtopic.php?p=395502&highlight=#395502

Posting it in a new thread when you've already posted once (to which eostic already answered) is only going to get you admonished for double-posting and not magically supply you with new answers. :roll:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not simply check the posts where you asked the same question? :?

Never mind, they didn't belong in that two year old thread so I've removed them. And I'll transport Ernie's answer over here so it is in the right thread, the one you actually started.
Our XML Guy wrote:This is simply two "rows" that will be retrieved. In this case, you will have a link with productMetaTitle as the "key" (called a "repetition element" in the xmlInput Stage).

The Link that retrieves this (in a simple example), will have 2 columns....

One called productMetaTitle, and one called language.

.../productMetaTitle/@language
.../productMetaTitle/text()

...you will get two rows....with the values:

en-US Yellow
de-DE differeent...

Of course, this is in the context of a much larger xml document, but this repeating node will be in its own link, probably with other parent information going upward in the hierarchy.

Ernie
Ah... I see Mark was quicker. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post by MarkB »

chulett wrote:Ah... I see Mark was quicker. :wink:
Yeah, it must have been the tone of the message made me jump in so fast :D
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Post by behrouz »

Dear All,

it s not the same question,
has anyone any idea?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well then, hang tight and I guess we'll find out.
-craig

"You can never have too many knives" -- Logan Nine Fingers
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post by MarkB »

Craig has removed the original post, but it was the exact same question. So what's changed?
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Post by behrouz »

chulett wrote:Well then, hang tight and I guess we'll find out.
thanks, but i did not find any thing

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

Post by chulett »

Didn't ask you to search for anything... just to have some patience. This is an all volunteer site and people help when and where they can, you should have no assumptions on what kind of help you get here, if any.

Me, it's well past time to get my ass out the door to my paying job. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Per Ernie's response to the other thread (as quoted by Craig a few posts ago), the link which retrieves your example data will contain two columns, one with the language and one with the associated text. In other words, column(s) for the node attributes and column(s) for the node text, with individual rows for each instance of the node.

Your original question in this thread was "how do you handle this please?". The answer is now: How do you need to handle it? What do your business rules specify for handling the different formats (your words) of the data?

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Ya got me. It "is" the same question, albeit not worded exactly the same way. You have a particular chunk of xml and are interested in knowing how to read it. It is a repeating element.... it will produce repeating rows.

If you need something different, just say so. The patience of many is running out.

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 »

eostic wrote:Ya got me. It "is" the same question, albeit not worded exactly the same way. You have a particular chunk of xml and are interested in knowing how to read it. It is a repeating element.... it wi ...
thanks all,
I know we can do it as below
produc/text
product/@language..

but the problem is that datastage do not alow you to have to same attribut with different value

like:
<product lang='EN' > my data in english </product>

<product lang='ES' > my data in Spanish </product>


that s what i need and datastage does not alow you to do it by
how can i solve it.
?
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Ok.... you just need some additional processing after you parse the xml.

First, from an xml perspective, this isn't really "two attributes with different values"....it's "two elements", each with an attribute that has a value. That's an important distinction, because the simplest way to handle this is to put the two elements out as "two rows" (as described above)......and then, after you have two rows, just do a reverse pivot on them if you would prefer to have two columns on the same row. Release 8.5 has a Stage that can do that for you directly, but if you look around or ask in a separate post, there are many ways in DataStage that it can be be done.

Ernie
Ernie Ostic

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