Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359564

Summary: XPath error when XML contains multiple times the same path
Product: [Tools] Data Tools Reporter: Federico Uexit <antideutone>
Component: ConnectivityAssignee: dtp.connectivity-inbox <dtp.connectivity-inbox>
Status: NEW --- QA Contact: Maggie Shen <lshen>
Severity: major    
Priority: P3 CC: antideutone, bluesoldier, zqian
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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