Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Read XML using xpath
Rags
Hi All,
Am trying to read XML data. I want to read a xml file thorugh BIRT mapping something like shown below:
<parent>
<name>1952 SOMETHINGROYAL </name>
<child><name>1970 SECRETARIAT</name></child>
<child><name>1962 FIRST FAMILY </name></child>
</parent>
I tried using //name it gives me only the first name i.e. "1952 SOMETHINGROYAL ". Is it possible to read same tags data sequentially like shown above?. Plz help.
Regards,
Rags
Find more posts tagged with
Comments
bhanley
The XML data source flattens the underlying XML so it can be stored in a standard Data Set. The Data Set is table-driven and as such it cannot understand/render any sort of hierarchy. It will endeavor to turn each node found via your XPath statement into a row in the data set. As such, you are only going to get one instance of name per node.
Rags
Hi,
Thanks for your reply.
So i would like to know if it is possible to read such tags in BIRT using any other approach. One approach is just create a table programmatically and create the cells and populate it without a dataset. which will be really difficult i guess cause for example i want to represent my data in the below said fashion:
parent
<tab here>child1
<tab here>child2
<tab here>child3
<tab here><tab here>sub-child1
<tab here><tab here>sub-child2
<tab here>child4 and goes on.,
and i will not be using grouping. Is this the only approach? or first of all is it a good or valid approach?
Regards,
Rags
bhanley
Unless your XML already mimics a table-style data set (each node is relatively complete with values for all "columns") then you best bet would probably be a custom Data Set. This Set would be controlled by your code and you would be able to construct the columns/rows to work as you need. You can implement the custom data set using the ODA framework or a scripted data set. There are examples of both on the DevShare.
Rags
Hi,
Am kind a new to this custom data set. Can you kindly give a brief about it. It would be good if you can provide me the links.
Regards,
Rags