.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Articles >> General >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Understanding XML : PART 1

Posted By:Nikhil Kumar       Posted Date: August 02, 2010    Points: 25    Category: General    URL: http://www.dotnetspark.com  

Extensible Markup Language is a simple and flexible language in the text format. Nowadays it is widely used to exchange a large variety of data over the internet. XML plays a very significant role with respect to .NET Framework 3.5.

Understading XML: Part 1

Extensible Markup Language is a simple and flexible language in the text format. Nowadays it is widely used to exchange a large variety of data over the internet. XML plays a very significant role with respect to .NET Framework 3.5.

.NET Framework 3.5 provides us with a namespace named System.Xml , which includes classes as a convinient data storage medium to store data used in our applications in the form of XML files.

ADO.NET (ActiveX Data Object) is a primary tool used for data access and mor data access and sed ject)_on

.5 anipulation in many programming languages supported by .NET Framework 3.5. ADO.Net uses xml as a medium of transferring data between applications and it provides some powerful features to read and write xml documents.The DOM (Document Object Model) is a plateform- independent interface, which allows programs and script to access and update the content and structure of documents dynamically. We implement the DOM with the help XmlDoculement the DOM with the help of  teform independent  ment class.

We can serialize and deserilize objects using the System.xml.Serialization namespace.

Support for XML in .NET Framework 3.5

XML is a data description language (DDL) developed by World Wide Web Consortium (W3C).

See www.w3.org

Which is used by ADO.Net as a format to store and transfer data. W3C has developed some standards, which make XML a powerful and strong language. The set of w3c standards by .NET Framework 3.5 are as follows:


  1.  XML 1.0 (www.w3.org/TR/1998/REC-xml-19980210) with Document Type  

 Definition (DTD) support

  1.  XML Namespaces (www.w3.org/TR/REC-xml-names) for both stream-level and  


  1.  XML Schemas (www.w3.org/2001/XMLSchema)
  2.  XPath expressions (www.w3.org/ TR /xpath)
  3.  XSLT transformations (www.w3.org/ TR /xslt)
  4.  DOM Level 1 Core (www.w3.org/ TR /REC-DOM-Level-1/)
  5.  DOM Level 2 Core (www.w3.org/ TR / REC-DOM-Level-2-Core/)
  6.  SOAP 1.1 (www.w3.org/ TR /SOAP)


System.Xml namespace


.NET Framework 3.5 provides a namespace known as System.Xml, which contains classes that are used to process XML.

Read important classes contained in the System.Xml namespace:

Working with Streamed XML:

Before the introduction of DOM, Simple Application Programming Interface (API) for XML (SAX) was used to access information stored in XML documents. In the SAX model, we had only the XmlReader and XMLWriter classes to work with XML data.XmlReader-based classes are used to stream the XML data for processing in a fast-forward and rady-only manner. Memory requirements for the SAX model are not too high as it is for a streaming model. The SAX model however dose not provide navigation flexibility and read or write capabilities that are available in DOM.

XmlWriter based classes are used to generate XML documents.The XmlReader and XmlWriter classes are abstract classes. We can use classes derived form these abstract classes to work wth XML in our application Classes derived formt eh XMLReader abstract class are as follows:


1.     XmlTextReader-Works either with a stream-based object or with Textreader/TextWriter objects from the System.IO namespace.

2.     XmlNodeReader-Uses XmlNode class as its source instead of a stream

3.     XmlValidatingReader-Adds DTD and schema validation and hence offers data validation

The XmlTextWriter class is a class that is derived from the XmlWriter abstract class. Similar to the

XmlTextReader class, this class also works either with a stream-based object or with the

TextReader/TextWriter objects from the System.IO namespace.

Now, let's look at some of these classes in detail.


The XmlReader Class

The XmlReader class is used to read XML data in a fast, forward-only, and non-cached manner. It works in the same manner as the SAX model does. However, there are few differences between the two. One of these

differences is the type of model they use to read data from an XML document. The SAX model uses a push model to read XML data, while the XmlReader class uses a pull model for this purpose.

There are a few disadvantages associated with the push model. One disadvantage is that, in this model, data is pushed out to the application and the developer of the application needs to be ready to receive it. Another

disadvantage is that all the data pushed out to the application needs to be processed by the application, whether it is required or not. On the other hand, in the pull model data is pulled into the application that is requesting it. Also in the pull model you do not need to process all the data sent to the application. You can select the data that you want and process only that data

Continue Next Part.

Enjoy reading.

Thank !!

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend