Conclusion

XML validation is the parser’s ability to verify that a given XML source document is comformant to a specified layout. The intrinsic importance of validation, and related technologies, can’t be denied, but a few considerations must be kept in mind.

For one thing, XML documents and schema information must be distinct elements. This improves performance when the document is transferred over the wire and keeps the memory footprint as lean as possible. In addition, validating a document to make sure it has the requested layout is not always necessary if the correctness of the data two applications exchange can be ensured by design. If the documents sent and received are generated programmatically and there is no (reasonable) way to hack them, validation can be an unneeded burden. In this case, you can rate the schema information as similar to debug information in Win32 executables: useful to speed up the development cycle, but useless in a production environment.

The real big thing behind XML validation is XSD—a W3C specification to define the structure, contents, and semantics of XML documents. XSD is another key element that enriches the collection of official and de facto current standards for interoperable software. It joins the group formed by HTTP for network transportation, XML for data description, SOAP for method invocation, XSL for data transformation, and XPath for queries.

With XSD, we have a standard but extremely rigorous way to describe the layout of the document that leaves nothing to the user’s imagination. XSD is the constituent grammar for the XML type system, and thanks to the broad acceptance gained by XML, it is a candidate to become a universal and cross-platform type system.

This chapter uses the features and programming interface of a special reader class—the XmlValidatingReader class—to demonstrate how XML validation is accomplished in the .NET Framework. In doing so, we have inevitably touched on the technologies that are involved with the schema definition—from the still-flourishing DTD, to the newest and standard XSD, and passing through the intermediate, and mostly Microsoft proprietary, XDR.

For the most part, this chapter covers issues revolving around XML validating parsers. It also opens a window into the world of XML-related technologies.

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

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