XML
  Home arrow XML arrow XML Processing With The XMLReader Object, ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

XML Processing With The XMLReader Object, Part 2
By: Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 11
    2004-04-14

    Table of Contents:
  • XML Processing With The XMLReader Object, Part 2
  • Returning to the Library
  • To DTD or Not to DTD
  • Of Nodes and Trees
  • Playing Catch
  • Linking Out

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    XML Processing With The XMLReader Object, Part 2


    (Page 1 of 6 )

    This concluding segment discusses XML validation with the XmlValidatingReader class using both DTDs and XML Schemas, introduces the XMLNodeReader, and shows you how to add exception-handling to your XML processing code. If you wish to catch up, check out the first article in this series.
     

    Onward Ho

    You already know that an XML document may be either "well-formed" or "valid."

    A well-formed document is one which meets the specifications laid down in the XML recommendation; that is, it follows the rules for element and attribute names, contains all essential declarations, and has properly-nested elements.

    A valid document is one which, in addition to being well-formed, adheres to the rules laid out in a document type definition (DTD) or XML Schema. By imposing some structure on an XML document, a DTD makes it possible for documents to conform to some standard rules, and for applications to avoid nasty surprises in the form of incompatible or invalid data.

    DTDs and XML Schemas are essential when managing a large number of XML documents, as they immediately make it possible to apply a standard set of rules to different documents and thereby demand conformance to a common standard. However, for smaller, simpler documents, a DTD can often be overkill, adding substantially to download and processing time.

    Now, what does this have to do with the XmlTextReader class I discussed in so much detail in the last segment of this previous tutorial? Nothing, really. You see, while the class does throw up errors if your XML document isn't well-formed, it does not support validation against a DTD, XDR or XSD Schema. If you need to validate your XML file before processing it, you need to know its close cousin, the XmlValidatingReader object, which is derived from the same abstract XMLReader parent class. And then, once you know how to perform validation, you also need to know how to handle validation errors, which is why this article also includes a simple example that uses built-in exception handling mechanisms to trap errors that the Reader may come across.

    Let's get started!

    More XML Articles
    More By Harish Kamath (c) Melonfire


     

    XML ARTICLES

    - More on Triggers and Styles and Control Temp...
    - Looking at Triggers with Styles and Control ...
    - A Closer Look at Styles and Control Templates
    - Styles and Control Templates
    - Properties and More in XAML
    - Elements and Attributes in XAML
    - XAML in a Nutshell
    - Importing XML Files into Access 2007
    - Using MSXML3.0 with VB 6.0
    - MSXML, concluded
    - MSXML, continued
    - MSXML Tutorial
    - Generating XML Schema Dynamically Using VB.N...
    - XSL Transformations using ASP.NET
    - Applying XSLT to XML Using ASP.NET





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek