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)
Parsing XML into columns in a dataset
brittonxem
I am trying to create a BIRT dataset from a Web Services Data Source. Due to the way the response is constructed, I am having a problem getting the data into columns.<br />
<br />
Here is how BIRT sees the response:<br />
<blockquote class='ipsBlockquote' ><p><SOAP-ENV:Envelope><br />
<SOAP-ENV:Body><br />
<ns1:getArtifactResponse><br />
<return><br />
<artifact_id>12345</artifact_id><br />
<tracker_id>102</tracker_id><br />
<value><br />
<item><br />
<field_name>summary</field_name><br />
<field_label></field_label><br />
<field_value>Create DB repository</field_value><br />
</item><br />
<item><br />
<field_name>status_id</field_name><br />
<field_label></field_label><br />
<field_value>Open</field_value><br />
</item><br />
<item><br />
<field_name>stage</field_name><br />
<field_label></field_label><br />
<field_value>In Process</field_value><br />
</item><br />
<item><br />
<field_name>severity</field_name><br />
<field_label></field_label><br />
<field_value>Normal</field_value><br />
</item><br />
</value><br />
</return><br />
</ns1:getArtifactResponse><br />
</SOAP-ENV:Body><br />
<SOAP-ENV:Envelope></p></blockquote>
<br />
I need to end up with each item placed in a column identified by the "field_name".<br />
I was hoping I could use conditional XPATH statements in the Data Set's Column Mapping but I cannot get it to work.<br />
<br />
The logic would be something like:<br />
For column named "summary" - if field_name='summary' then field_value<br />
For column named "status_id" - if field_name='status_id' then field_value<br />
For column named "stage" - if field_name='stage' then field_value<br />
For column named "severity" - if field_name='severity' then field_value<br />
<br />
Does anyone know if this can be done with the example given?
Find more posts tagged with
Comments
brittonxem
<blockquote class='ipsBlockquote' data-author="'brittonxem'" data-cid="101414" data-time="1338301364" data-date="29 May 2012 - 07:22 AM"><p>
I am trying to create a BIRT dataset from a Web Services Data Source. Due to the way the response is constructed, I am having a problem getting the data into columns.<br />
<br />
Here is how BIRT sees the response:<br />
<br />
<br />
I need to end up with each item placed in a column identified by the "field_name".<br />
I was hoping I could use conditional XPATH statements in the Data Set's Column Mapping but I cannot get it to work.<br />
<br />
The logic would be something like:<br />
For column named "summary" - if field_name='summary' then field_value<br />
For column named "status_id" - if field_name='status_id' then field_value<br />
For column named "stage" - if field_name='stage' then field_value<br />
For column named "severity" - if field_name='severity' then field_value<br />
<br />
Does anyone know if this can be done with the example given?<br /></p></blockquote>
I solved this by setting the row mapping to the value element then for each of the seperate columns, I had the following:<br />
For column named "summary" - XPATH=/item[1]/field_value<br />
For column named "status_id" - XPATH=/item[2]/field_value<br />
For column named "stage" - XPATH=/item[3]/field_value<br />
For column named "severity" - XPATH=/item[4]/field_value
mwilliams
Great! Glad you got a solution to your issue. Let us know whenever you have questions!