XML 2 same tags,same attributs but the value differents
Moderators: chulett, rschirm, roy
XML 2 same tags,same attributs but the value differents
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
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
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>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
...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=#395502behrouz wrote:@eostic, that s not the anwser that i expected, if you see any post with answer you can send me the linkeostic wrote:I think you asked this already in another entry... ...
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.
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.
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.
Ah... I see Mark was quicker.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
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
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.
Me, it's well past time to get my ass out the door to my paying job.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
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,
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.
All generalizations are false, including this one - Mark Twain.
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
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>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
thanks all,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 ...
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.
?
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
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>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>