5.11. System.Xml

The representation of relational table data can be poured like water back and forth between a DataSet object and an XML representation. In particular, the XmlDataDocument class, defined in the System.Xml namespace, has a special relationship to the DataSet class. It allows us to load relational data (or XML data, of course) and manipulate that data using the W3C Document Object Model (DOM). One way to do the binding is to pass the DataSet object to the XmlDataDocument constructor:

DataSet ds = new DataSet();
adapter.Fill( ds, "FOOD_DES" );

XmlDataDocument xmlDoc = new XmlDataDocument( ds );

Now we can manipulate the XmlDataDocument just as if we had directly loaded it with XML data. In this section we look at the DOM, its navigation ...

Get C# Primer: A Practical Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.