Accessing an XML sequence
-
Hi I'm trying to access a sequence which is part of a node in an XML file.
<property pr_ref="ABC" ... > <sellingpoint text="HALLWAY" /> <sellingpoint text="DINING ROOM" /> <sellingpoint text="KITCHEN" /> </property>
I can iterate through the "property" nodes and retrieve their columns (pr_ref) but how on earth do I access the sequence of selling points? I've tried childrows and parents rows and I'm lost! I'm using VB.NET and I have the entire file in a DataSet. The second table of the dataset seems to contain ALL of the sellingpoint rows, not just those related to the one property.:confused: I'm desperate! Bernhard Don't worry, nobody lives forever. -
Hi I'm trying to access a sequence which is part of a node in an XML file.
<property pr_ref="ABC" ... > <sellingpoint text="HALLWAY" /> <sellingpoint text="DINING ROOM" /> <sellingpoint text="KITCHEN" /> </property>
I can iterate through the "property" nodes and retrieve their columns (pr_ref) but how on earth do I access the sequence of selling points? I've tried childrows and parents rows and I'm lost! I'm using VB.NET and I have the entire file in a DataSet. The second table of the dataset seems to contain ALL of the sellingpoint rows, not just those related to the one property.:confused: I'm desperate! Bernhard Don't worry, nobody lives forever.The DataSet will load the different levels of nodes into seperate tables, but will create relationships between those tables for you. The property table that is created in the DataSet should have a relationship to the sellingpoint table, which could be accessed through the DataSet.Tables(0).ChildRelations collection. Using this DataRelation, you can access the sellingpoint children of a property row by doing DataSet.Tables(0).Rows(0).GetChildRows(DataRelation). There are other ways to do this as well. Just take a look at the help for DataSet and DataTable for more information. Or, to get an idea of exactly what is in your DataSet after loading the XML, set a breakpoint in your code, and do a QuickWatch (right click on an object after breaking into code during debug of your application) of your DataSet.