Altova Mailing List Archives


XPath equivalent to doing table joins

From: Mike@-----------.---------.---
To: NULL
Date: 5/26/2006 7:03:00 AM

Hello all,

I have run across a problem where I need to perform a table join against my 
xml to pull back certain nodes. 

For example <Object Type="T_DATA_1"> represents a table and <Object 
Type="T_DATA_2"> is another table in the xml. <Keys> contain the keys to 
correlate rows from one table to the other. 

I am trying to return all row nodes from <Object Type="T_DATA_1"> where 
Value = 0 for InstanceElementID="100174" in <Object Type="T_DATA_2">. 

So in the case of the xml below I want to return the 2nd and 3rd <Row> nodes. 

Is this possible using XPath and if so how? If not what are alternatives 
could I try?

Any help would be appreciated. Thanks.

<DataBuffer>
<Object Type="T_DATA_1">
<Row>
<Keys>
<Key Name="ID" Value="100601"/>
<Key Name="FUNDING_YEAR" Value="1951"/>
<Key Name="ORG_ID" Value="100702"/>
</Keys>
<Data>
<DataElement InstanceElementID="100172" Value="100"/>
</Data>
</Row>
<Row>
<Keys>
<Key Name="ID" Value="100601"/>
<Key Name="FUNDING_YEAR" Value="1951"/>
<Key Name="ORG_ID" Value="100703"/>
</Keys>
<Data>
<DataElement InstanceElementID="100172" Value="200"/>
</Data>
</Row>
<Row>
<Keys>
<Key Name="ID" Value="100601"/>
<Key Name="FUNDING_YEAR" Value="1951"/>
<Key Name="ORG_ID" Value="100704"/>
</Keys>
<Data>
<DataElement InstanceElementID="100172" Value="300"/>
</Data>
</Row>
</Object>
<Object Type="T_DATA_2">
<Row>
<Keys>
<Key Name="ID" Value="100601"/>
<Key Name="FUNDING_YEAR" Value="1951"/>
<Key Name="ORG_ID" Value="100702"/>
</Keys>
<Data>
<DataElement InstanceElementID="100174" Value="1"/>
</Data>
</Row>
<Row>
<Keys>
<Key Name="ID" Value="100601"/>
<Key Name="FUNDING_YEAR" Value="1951"/>
<Key Name="ORG_ID" Value="100703"/>
</Keys>
<Data>
<DataElement InstanceElementID="100174" Value="0"/>
</Data>
</Row>
<Row>
<Keys>
<Key Name="ID" Value="100601"/>
<Key Name="FUNDING_YEAR" Value="1951"/>
<Key Name="ORG_ID" Value="100704"/>
</Keys>
<Data>
<DataElement InstanceElementID="100174" Value="0"/>
</Data>
</Row>
</Object>
</DataBuffer>

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.