The Other XML Namespaces


Microsoft is serious about .NET's commitment to XML. This is made obvious by the extent to which XML is used in the .NET architecture and supported through several feature-rich namespaces. In this chapter, you were introduced to the XML support available in the System.Data and System.Xml namespaces.

It may surprise you (or maybe it will not) to know that several more namespaces are dedicated to supporting XML. They each have their purpose: targeting certain XML usage scenarios. You will discover that classes from one XML namespace will often be used together with classes from a different XML namespace. For that reason, you will often "cross" namespaces, leveraging the strengths of XML objects as appropriate. The following list presents a review of these "other" XML namespaces:

System.Xml.Schema: This namespace offers classes, delegates, and enumerations used to support your XML Schema Definition (XSD) language and XML-Data Reduced (XDR) Schema needs. It strongly supports the W3C Recommendations for XML Schemas for structures and XML Schemas for data types. The classes in this namespace service the Schema Object Model (SOM). You can use the System.Xml.Schema.XmlSchemaCollection class through the Schemas property of the System.Xml.XmlValidatingReader class.

System.Xml.XPath: This namespace offers support for the XPath parser (query support) via several classes, interfaces, and enumerations. Two commonly used classes from this namespace are XPathDocument (fast, read-only cache, optimized for XSLT) and XPathNavigator (read-only, random access, cursor model).

System.Xml.Xsl: This namespace provides full support for the Extensible Stylesheet Transformation (XSLT) technology. [2] Although several classes and interfaces are offered in this namespace, you will likely use the XslTransform class most often.

Microsoft.Data.SqlXml: This namespace represents the XML for SQL Server (SQLXML) set of managed objects. The current version of SQLXML, 3.0 SP1, is available as a free download (see the "Web Sites" subsection of the "To Learn More" section at the end of this chapter for the URL). The SQLXML offering (also known as Web Release ) is essentially a series of "service packs " for SQL Server 2000. Its three managed classes, SqlXmlCommand , SqlXmlParameter , and SqlXmlAdapter , enable more direct XML support (XPath, XQuery, XML Templates, XML Bulk Load, and so forth) to Microsoft's SQL Server database product. Using the FOR XML clause in your SQL Server SQL queries is considered to be an "XML for SQL Server" enhancement.

System.Xml.Serialization: This namespace offers classes and delegates to assist with object serialization. Among the many managed classes offered, you will use the XmlSerializer class the most. Using the XmlSerializer class, you can serialize and deserialize instantiated objects to and from XML documents or streams. Object serialization is a useful technique for persisting (or saving) the state of an object so that you can later re-create an exact copy of the object. Object serialization is also useful when you want to pass the object (marshal by value) during .NET Remoting scenarios. (I further discuss .NET Remoting in Chapter 20.)

The preceding list of namespaces is provided to give you a more complete picture of the XML support available through the .NET Framework and platform. Combining this information with that of the System.Xml namespace, you are certainly off to an informed start. The "To Learn More" section at the end of this chapter provides additional references for your extended retraining experience.

[2] Microsoft has announced (through the Microsoft Knowledge Base Article Q317691) that the COM-based Microsoft XML Core Services (MSXML 4.0) library actually offers a preferred XSLT parser. Until this is corrected through forthcoming .NET improvements, you can use the MSXML 4.0 parser/engine in your .NET applications through the COM Interop feature.




COBOL and Visual Basic on .NET
COBOL and Visual Basic on .NET: A Guide for the Reformed Mainframe Programmer
ISBN: 1590590481
EAN: 2147483647
Year: 2003
Pages: 204

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net