Page 1 of 2

XML 2 same tags,same attributs but the value differents

Posted: Fri Apr 29, 2011 12:39 am
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

Posted: Fri Apr 29, 2011 5:44 am
by eostic
I think you asked this already in another entry...

Posted: Fri Apr 29, 2011 6:11 am
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

Posted: Fri Apr 29, 2011 6:26 am
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:

Posted: Fri Apr 29, 2011 6:28 am
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:

Posted: Fri Apr 29, 2011 6:40 am
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

Posted: Fri Apr 29, 2011 6:42 am
by behrouz
Dear All,

it s not the same question,
has anyone any idea?

Posted: Fri Apr 29, 2011 6:55 am
by chulett
Well then, hang tight and I guess we'll find out.

Posted: Fri Apr 29, 2011 6:58 am
by MarkB
Craig has removed the original post, but it was the exact same question. So what's changed?

Posted: Fri Apr 29, 2011 6:58 am
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 ?

Posted: Fri Apr 29, 2011 7:04 am
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:

Posted: Fri Apr 29, 2011 8:47 am
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,

Posted: Fri Apr 29, 2011 10:58 am
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

Posted: Sat Apr 30, 2011 11:19 am
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.
?

Posted: Sun May 01, 2011 6:19 am
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