Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Collections
Imports System.Data
Imports System.Windows.Forms
Public Class MainClass
Shared Sub Main()
Dim DSStudentClasses As New DataSet()
Dim tmpNode As XmlNode
' Load the schema into the DataSet
DSStudentClasses.ReadXmlSchema("StudentClasses.xsd")
' Load the DataSet into the data document
Dim XDocStudents As New XmlDataDocument(DSStudentClasses)
' Load the data into the data document
XDocStudents.Load("Students.xml")
Console.WriteLine("Students in DataSet:")
Dim Row As DataRow
For Each Row In DSStudentClasses.Tables("Student").Rows
Console.WriteLine("{0}:{1}", Row("Name"), Row("GPA"))
tmpNode = XDocStudents.GetElementFromRow(Row)
Console.WriteLine( _
" Locker Combination (from XML, not DataSet): {0}", _
tmpNode.SelectSingleNode("LockerCombination").InnerText)
Dim Subject As DataRow
For Each Subject In Row.GetChildRows("StudentClasses")
Console.WriteLine(" {0}", Subject("Title"))
Next
Next
End Sub
End Class
'student.xml
'
'
'
' Joe Wang
' 30
' 2.95
' 10-12-35
'
'
'
'
'student.xsd
'
' ' xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
'
'
'
'
'
'
' ' minOccurs="0" msdata:Ordinal="0" />
' ' minOccurs="0" msdata:Ordinal="2" />
' ' minOccurs="0" maxOccurs="unbounded">
'
'
'
' ' use="prohibited" />
'
'
'
'
'
'
'
'
'
'
'
'
' ' msdata:IsNested="true">
'
'
'
'
'