Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359564 - XPath error when XML contains multiple times the same path
Summary: XPath error when XML contains multiple times the same path
Status: NEW
Alias: None
Product: Data Tools
Classification: Tools
Component: Connectivity (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: dtp.connectivity-inbox CLA
QA Contact: Maggie Shen CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-30 09:47 EDT by Federico Uexit CLA
Modified: 2014-09-03 14:30 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Uexit CLA 2011-09-30 09:47:48 EDT
Build Identifier: 20090920-1017 and 20110615-0604

I need to create a report based on an XML with the following format:

<?xml version="1.0" encoding="utf-8"?>
<Products>
<ProductRevision name="TEST 001">
<UserData>
<UserValue value="Yes" title="Critical Test" /> 
<UserValue value="Concept" title="Phase" /> 
<UserValue value="FER" title="Milestone" /> 
<UserValue value="In Progress" title="Test Lifecycle" /> 
</UserData>
</ProductRevision>

<ProductRevision name="TEST 002">
<UserData>
<UserValue value="Yes" title="Critical Test" /> 
<UserValue value="Production" title="Phase" /> 
<UserValue value="FER" title="Milestone" /> 
<UserValue value="In Progress" title="Test Lifecycle" /> 
</UserData>
</ProductRevision>

<ProductRevision name="TEST 003">
<UserData>
<UserValue value="No" title="Critical Test" /> 
<UserValue value="Functional" title="Phase" /> 
<UserValue value="FER" title="Milestone" /> 
<UserValue value="In Progress" title="Test Lifecycle" /> 
</UserData>
</ProductRevision>

</Products>


If i create a Data Set with the following XPath

/Products/ProductRevision/UserData

And the following column mapping:


/UserValue[@title='Critical Test']/@value
/UserValue[@title='Phase']/@value
/UserValue[@title='Milestone']/@value
/UserValue[@title='Test Lifecycle']/@value

The resulting data are incorrect, i.e. the value retrieved is related to the next node.

This means that the value shown for "Critical Test" is the one related to Phase, the value for "Phase" is the one related to Milestone and so on ( final value for "Test Lifecycle" is empty).



Reproducible: Always

Steps to Reproduce:
1. Create an xml file with the following data:

<?xml version="1.0" encoding="utf-8"?>
<Products>
<ProductRevision name="TEST 001">
<UserData>
<UserValue value="Yes" title="Critical Test" /> 
<UserValue value="Concept" title="Phase" /> 
<UserValue value="FER" title="Milestone" /> 
<UserValue value="In Progress" title="Test Lifecycle" /> 
</UserData>
</ProductRevision>

<ProductRevision name="TEST 002">
<UserData>
<UserValue value="Yes" title="Critical Test" /> 
<UserValue value="Production" title="Phase" /> 
<UserValue value="FER" title="Milestone" /> 
<UserValue value="In Progress" title="Test Lifecycle" /> 
</UserData>
</ProductRevision>

<ProductRevision name="TEST 003">
<UserData>
<UserValue value="No" title="Critical Test" /> 
<UserValue value="Functional" title="Phase" /> 
<UserValue value="FER" title="Milestone" /> 
<UserValue value="In Progress" title="Test Lifecycle" /> 
</UserData>
</ProductRevision>

</Products>


2. Create a new Report
3. Add the xml created at 1. as XML Data Source
4. Create a new dataset with the following row mapping:

/Products/ProductRevision/UserData

5. Create the following column mappings:


/UserValue[@title='Critical Test']/@value
/UserValue[@title='Phase']/@value
/UserValue[@title='Milestone']/@value
/UserValue[@title='Test Lifecycle']/@value

6. Preview the results. The values shows for each column mapping are incorrect, i.e. show wrong value