Если у вас есть класс MyClass
, сгенерированный из вашего XSD, и у вас есть файл с данными XML, который соответствует этому классу в MySample.xml
, вы бы сделали что-то вроде этого (извините, я не бегло говорюв VB - это C #):
// create the XML serializer class, based on your MyClass definition
XmlSerializer ser = new XmlSerializer(typeof(MyClass));
// create filestream to open & read the existing XML file
FileStream fstm = new FileStream(@"C:\mysample.xml", FileMode.Open, FileAccess.Read);
// call deserialize
var result = ser.Deserialize(fstm);
// if result is not null, and of the right type - use it!
MyClass deserializedClass = (result as MyClass);
if(deserializedClass != null)
{
// do whatever you want with your new class instance!
}
Это помогает ??