Summary

The beauty of XML is that it isolates data representation from data display. Technologies such as HTML contain data that is tightly bound to its display format. XML does not suffer this limitation, and at the same time it has the readability of HTML. Accordingly, the XML facilities available to a Visual Basic application are vast, and a large number of XML-related features, classes, and interfaces are exposed by the .NET Framework.

This chapter showed you how to use System.Xml.Serialization.XmlSerializer to serialize classes. Source Code Style attributes were introduced in conjunction with serialization. This style of attributes enables the customization of the XML serialized to be extended to the source code associated with a class. What is important to remember about the direction of serialization classes is that a required change in the XML format becomes a change in the underlying source code. Developers should resist the temptation to rewrite serialized classes in order to conform to some new XML data standard (such as the example movie order format endorsed by the consortium of movie rental establishments). Technologies such as XSLT, exposed via the System.Xml.Query namespace, should be examined first as alternatives. This chapter demonstrated how to use XSLT style sheets to transform XML data using the classes found in the System.Xml.Query namespace.

The most useful classes and interfaces in the System.Xml namespace were reviewed, including those that support document-style XML access: XmlDocument, XmlNode, XmlElement, and XmlAttribute. The System.Xml namespace also contains classes and interfaces that support stream-style XML access: XmlReader and XmlWriter.

This chapter also described how to use LINQ to XML and some of the options available to you in reading from and writing to XML files and XML sources, whether the source is static or dynamic. Next, you were also introduced to the LINQ to XML helper objects XDocument, XElement, XNamespace, XAttribute, and XComment. These outstanding new objects make working with XML easier than ever before. Finally, you looked at how to use XML with ASP.NET. While you can use the XmlReader and XmlDocument (and related) classes with ASP.NET, there are included controls to make working with XML easier.

As you learned from reviewing this chapter, XML serves as a powerful method for storing and transferring data. You also learned that Language Integrated Query (LINQ) provides a strong framework for easily working with and manipulating this data and the XML structure itself. In the next chapter you will learn how to perform similar actions using LINQ with data stored in databases and accessible via ADO.NET.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset