Select the product you need help with
INFO: Roadmap for Programming XML with the Pull-Model Parser in the .NET FrameworkArticle ID: 313816 - View products that this article applies to. This article was previously published under Q313816 On This PageSummary This article provides a roadmap for programming XML with
the pull-model parser of the .NET Framework. To help with learning a Microsoft
product or technology, roadmap articles provide links to useful information,
including online documentation, Microsoft Knowledge Base articles, and white
papers. OverviewThe .NET Framework provides two ways to parse XML data:
The pull model is implemented with classes based on the XmlReader class. XmlReader provides read access to XML data, and also enables you to skip data that you do not want. Note that the pull model has several advantages over the Simple API for XML (SAX) model, as explained at the following MSDN Web site:
Comparing XmlReader to SAX Reader SAX is not implemented in .NET Framework, although it can be
built by using the XmlReader class.http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcomparingxmlreadertosaxreader.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcomparingxmlreadertosaxreader.asp)
XML in the .NET Framework is implemented under the System.Xml namespace. The following classes are related with the pull model:
Key Concepts and QuickStartsThe best place to start is with the following SDK documention link:
Reading XML with the XmlReader Follow the links in the "See Also" section for samples of reading
elements and attributes, validating against schemas, and skipping content that
you do not want.http://msdn2.microsoft.com/en-us/library/aa720470(VS.71).aspx
(http://msdn2.microsoft.com/en-us/library/aa720470(VS.71).aspx)
Knowledge Base ArticlesMicrosoft Knowledge Base How To articles provide step-by-step instructions for accomplishing specific tasks.Typical steps in pull-model parsing include instantiating one of the XmlReader-based classes, based on the application's requirements, and reading the data after setting up the required properties. For example, if performance is the key factor and no validation is required, XmlTextReader is a good choice. With the use of MoveToContent and Skip methods, it enables reading only the required data with improved performance. The following Knowledge Base articles provide code samples for programming XmlReader-related classes. 301225
(http://support.microsoft.com/kb/301225/EN-US/
)
HOW TO: Read XML from a File by Using Visual Basic .NET
307548
(http://support.microsoft.com/kb/307548/EN-US/
)
HOW TO: Read XML from a File by Using Visual C# .NET
301232
(http://support.microsoft.com/kb/301232/EN-US/
)
HOW TO: Read XML Data from a URL by Using Visual Basic .NET
307643
(http://support.microsoft.com/kb/307643/EN-US/
)
HOW TO: Read XML Data from a URL by Using Visual C# .NET
315533
(http://support.microsoft.com/kb/315533/EN-US/
)
HOW TO: Use DTDs, XDR, or XSD to Validate an XML Document in Visual Basic .NET
307379
(http://support.microsoft.com/kb/307379/EN-US/
)
HOW TO: Use DTDs, XDR, or XSD to Validate an XML Document in Visual C# .NET
317463
(http://support.microsoft.com/kb/317463/EN-US/
)
HOW TO: Validate XML Fragments Against an XML Schema in Visual Basic .NET
318504
(http://support.microsoft.com/kb/318504/EN-US/
)
HOW TO: Validate XML Fragments Against an XML Schema in Visual Basic .NET
317595
(http://support.microsoft.com/kb/317595/EN-US/
)
HOW TO: Validate an XML Document That Uses Multiple Schemas
301228 You can also run XSL transformations (XSLT), query
and modify XML data by using DOM, and serialize or deserialize XML data by
using the System.Xml classes in .NET Framework. For more information, see the
following Knowledge Base article:
(http://support.microsoft.com/kb/301228/EN-US/
)
HOW TO: Read XML Data from a Stream in .NET Framework SDK
313651
(http://support.microsoft.com/kb/313651/EN-US/
)
INFO: Roadmap for XML in the .NET Framework
GuidelinesYour choice of parser may depend on your application's requirements. Note that the DOM-model parser loads the whole XML document into memory whereas the pull model loads one node at a time. The pull model consumes less memory but does not provide random access to data.The DOM model is suited for applications that require random, read/write access to the data where memory consumption is not a factor. The pull model is suited for applications that require speed and memory conservation. Under many circumstances, the required solution may be a hybrid of these two models. For example, if part of a very large XML document needs to be manipulated, it may be efficient to use the pull model to read it, and then construct a DOM with only the data needed for additional modification. TroubleshootingIf you experience problems and want assistance, the best place to start is at the Microsoft Product Support Services (PSS) Web site:http://support.microsoft.com You have several options to find answers to your questions. You
can search the Microsoft Knowledge Base, post your questions or share your
experiences on Microsoft newsgroups, obtain the latest service packs and news
about a specific product, or contact Microsoft Product
Support.
(http://support.microsoft.com)
PropertiesArticle ID: 313816 - Last Review: May 22, 2013 - Revision: 5.0
|


Back to the top








