Parse xml which has hierarchical data
Moderators: chulett, rschirm, roy
Parse xml which has hierarchical data
Hi,
I have xsd which has 5 levels of hierarchy in that, in 8.1 i have used 5 xml input stages one after another to parse this XML. I have been trying to use the new XML stage in datastage 8.5 to parse the same XML.
Do i have to use 5 XML parser steps in the new XML stage. I am not able to figure out how to overcome this issue.Can some one please help me with this.
I have xsd which has 5 levels of hierarchy in that, in 8.1 i have used 5 xml input stages one after another to parse this XML. I have been trying to use the new XML stage in datastage 8.5 to parse the same XML.
Do i have to use 5 XML parser steps in the new XML stage. I am not able to figure out how to overcome this issue.Can some one please help me with this.
Thanks
Sheema
Sheema
Re: Parse xml which has hierarchical data
Try setting element of 5th level as KEY (repetition element).
I tried elsont's suggestion to set last level column as key.
I tried that using 3 levels(in xsd) of hierararchy, by setting one of the columns(Col1) in level 3 hierarchy as key . I see that in the Mapping section Col1 is mapped to some other column in level2 when i click auto map.So I am trying to manually select the correct column to map col1(which is in level 3), but i am getting the below error
CDIUI2820E The mapping is not applicable due to an invalid type conversion or difference in the source and target list dimensions.
All the columns in level1,level2 and level3 are of datatatype varchar so i assume that it is not invalid type conversion. Can some please help me with this issue.
I tried that using 3 levels(in xsd) of hierararchy, by setting one of the columns(Col1) in level 3 hierarchy as key . I see that in the Mapping section Col1 is mapped to some other column in level2 when i click auto map.So I am trying to manually select the correct column to map col1(which is in level 3), but i am getting the below error
CDIUI2820E The mapping is not applicable due to an invalid type conversion or difference in the source and target list dimensions.
All the columns in level1,level2 and level3 are of datatatype varchar so i assume that it is not invalid type conversion. Can some please help me with this issue.
Thanks
Sheema
Sheema
Hi,
Are you on DB2? I have just completed working on DB2 Pure XML and this really works great. Its lets you store the data as a XML data type natively in the DB and you write XPATH queries to parse the data. It is pretty simple with some learning. Here is a good document that explains it
http://www.google.com/url?sa=t&rct=j&q= ... L0vK878GgA
Sai
Are you on DB2? I have just completed working on DB2 Pure XML and this really works great. Its lets you store the data as a XML data type natively in the DB and you write XPATH queries to parse the data. It is pretty simple with some learning. Here is a good document that explains it
http://www.google.com/url?sa=t&rct=j&q= ... L0vK878GgA
Sai
are the 5 levels independent of each other? ...meaning, not nested, but entirely independent in meaning and number of occurrences (imagine a company with a node for employees and another node for products).
If they are truly independent, then it can absolutely be done with one single Stage, in the old xmlInput Stage or the new xml Stage.....
....but..... it will be multiple "links" coming out of it..........
Ernie
If they are truly independent, then it can absolutely be done with one single Stage, in the old xmlInput Stage or the new xml Stage.....
....but..... it will be multiple "links" coming out of it..........
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>
if they are nested, it can be done with either Stage, and in a single output link...if you use the new Stage, be sure you have at least FP1, and you need the xsd. If you don't have the xsd, you'll need to generate one, or use the xml Input Stage.
With the new Stage, initially have a parsing step that identifies the correct "root" of your document....then, in the Output Step, first map the "lowest" level list (little blue icon identifing the lowest level repeating node) to your output link, before you do anything else, and then map columns from the nodes that are above it.
Ernie
With the new Stage, initially have a parsing step that identifies the correct "root" of your document....then, in the Output Step, first map the "lowest" level list (little blue icon identifing the lowest level repeating node) to your output link, before you do anything else, and then map columns from the nodes that are above it.
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>