XML Data Binding Introduction
What is XML Data Binding
XML Data Binding is the process of creating an XML Data Model from an XML Schema (XSD). This XML Data Model contain strongly typed classes and properties mirroring those defined in the XML Schema. Using the XML Data Model to read and write XML documents is a quicker, easier and less error prone way of working with XML data.
Liquid XML Objects provides highly accurate conversion between XML and the generated class model. Allowing complex XML standards to be supported, and includes support for XSD 1.0 and XSD 1.1.
Generating code from an XSD
The first step is to generate an XML Data Model from your XML Schema (XSD).
This can be done Visual Studio or via the command line.
In Visual Studio simply include the XSD within your and right click the "Generate Data Binding Code" menu item, that's it your done!
Using the generated code
Once you have generated an XML Data Model, using it couldn't be simpler. We will read an XML document. This is achieved by using the LxSerializer< T> factory class, which will create an instance of our object.
De-serializing and XML document
Then simple use the strongly typed properties to read data from the object.
Reading data from the generated classes
Data within the class library can be modified in the same way.
Writing data into the generated classes
The XML data can then be written back out using the LxSerializer we created earlier.
And that's it in a nutshell. Simple, clean and easy. The generated code makes working with XML data simple and easy, whilst being extremely light weight and fast.
Loading More data ...