} // Test04 private static void ValidateNG2newsItem(string serializedNG2) { // executing the line below throws an exeption: the XsdValidator needs more data (maybe of the XML Schema) LiquidTechnologies.XmlObjects.NewsMLPower227.XsdValidator validator = new LiquidTechnologies.XmlObjects.NewsMLPower227.XsdValidator(); using (XmlReader validatingReader = validator.CreateValidatingReader(serializedNG2, ValidatingReaderErrorHandler)) { LxSerializer <NewsItemElm> serializer = new LxSerializer <NewsItemElm>(); LxReaderSettings lxReaderSettings = new LxReaderSettings() { ErrorHandler = LxErrorHandler }; NewsItemElm newsItemElm = serializer.Deserialize(validatingReader, lxReaderSettings); } }
static void Main(string[] args) { var path = "Examples/ESADout_CU.xml"; var serializer = new LxSerializer <ESADout_CUElm>(); Console.WriteLine("Deserialization started..."); ESADout_CUElm company = serializer.Deserialize(path, GetReaderSettings()); Console.WriteLine(); // error 1: min length = 1 company.DocumentModeID = ""; // error 2: length = 2 company.CustomsProcedure = "123"; Console.WriteLine("Serialization started..."); serializer.Serialize("out.xml", company, GetWriterSettings()); Console.ReadKey(); }