Hi,
I am having trouble handling my XML document. I'm new to SQL and XML anyway and would appreciate any help! My XML doc is basically the following...
<root>
<developments ID="xx" Ref="xx" Name="xx">
<Criteria ID = "xx" Name="xx" Value="xx" Type="xx"/>
<Criteria ID = "xx" Name="xx" Value="xx" Type="xx"/>
<Criteria ID = "xx" Name="xx" Value="xx" Type="xx"/>
.
.
.
</developments>
</root>
This is how the XML document is given to me, prepared elsewhere by an external company. My trouble is that I don't know how to handle the fact that the sub elements of <developments> element repeat (i.e there is more than one criteria element) and also the attributes or name/value pairs, ID, Name, Value and Type, reside in every Criteria element. The only values I get output are the first instances of the name/value pairs that the OPEMXML comes across.
So...
1) how do I get each and every value from this XML doc?
2) how can I miss certain attributes? i.e I don't want to pick up the values for any ID except the first one located in the development tag. I also wish to ignore the Type attribute too.
The examples I've looked at in TransactSQL Help are all short and have unique names within tags etc which is far easier but this document is giving me a lot of headaches! Any help very much appreciated.
I am having trouble handling my XML document. I'm new to SQL and XML anyway and would appreciate any help! My XML doc is basically the following...
<root>
<developments ID="xx" Ref="xx" Name="xx">
<Criteria ID = "xx" Name="xx" Value="xx" Type="xx"/>
<Criteria ID = "xx" Name="xx" Value="xx" Type="xx"/>
<Criteria ID = "xx" Name="xx" Value="xx" Type="xx"/>
.
.
.
</developments>
</root>
This is how the XML document is given to me, prepared elsewhere by an external company. My trouble is that I don't know how to handle the fact that the sub elements of <developments> element repeat (i.e there is more than one criteria element) and also the attributes or name/value pairs, ID, Name, Value and Type, reside in every Criteria element. The only values I get output are the first instances of the name/value pairs that the OPEMXML comes across.
So...
1) how do I get each and every value from this XML doc?
2) how can I miss certain attributes? i.e I don't want to pick up the values for any ID except the first one located in the development tag. I also wish to ignore the Type attribute too.
The examples I've looked at in TransactSQL Help are all short and have unique names within tags etc which is far easier but this document is giving me a lot of headaches! Any help very much appreciated.