Do XML Attributes HURT VB.Net DATAVIEWS????
Question posted by: Alan Mailer
(Guest)
on
June 27th, 2008 07:20 PM
I don't know how else to put this, because I'm new to VB.net but here
goes...
I'm trying to create a DataView from an XML file. Some of the nodes
in the XML file happen to have Attributes, others do not. Lets use
the following as an example:
<MyXml>
<ANode>
<ANodeWithNoAttribute>Hello</ANodeWithNoAttribute>
<ANodeWhichHasAnAttribute MyAttribute="MyAttributeValue">World.
</ANodeWhichHasAnAttribute>
</ANode>
</MyXml>
Now, imagine I'm creating a DataSet based on the above XML document
called "MyDataSet". I then create a DataView based on "MyDataSet" in
the following manner:
MyDataView = New DataView(MyDataSet.Tables("ANode"))
Am I going crazy, or are both of the two following propositions true:
Proposition 1) A DataView will not 'Sort' by a Node that has an
Attribute in it. In fact, attempting to do so will trigger an Error.
(If I'm correct about Proposition 1, using the above XML, the line
MyDataView.Sort("ANodeWhichHasAnAttribute ")... would trigger an
error.
Proposition 2) If you make a DataView the DataSource of a
DataGridView, the only columns which will appear in the DataGridView
are the ones associated in the underlying XML with Nodes that *do not*
have Attributes linked to them.
(If I'm correct about Proposition 2, using the above XML, a
DataGridView which had MyDataView as a DataSource would only end up
displaying ONE column; a column called "ANodeWithNoAttribute" with the
value "Hello" in it.
....Can someone please tell me if I'm right about these DataView
'propositions'? Of course, if I'm wrong, and I hope I am, PLEASE help
me out of this problem.
Thanks in advance.
Not the answer you were looking for? Post your question . . .
189,171 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|