ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing

ExpertRating Home
ExpertRating Benefits
Recommend ExpertRating
Suggest More Tests
Privacy Policy
FAQ
Login
 
ASP Dot Net Tutorial - Index
ASP Dot Net Tutorial - Microsofts ASP.NET
ASP Dot Net Tutorial - Begining Web Forms
ASP Dot Net Tutorial - User Controls
ASP Dot Net Tutorial - ADO .NET
ASP Dot Net Tutorial - DataBinding to WebControls
ASP Dot Net Tutorial - DataList Controls
ASP Dot Net Tutorial - DataGrid Control
ASP Dot Net Tutorial - Advance Practical Examples on DataGrid
ASP Dot Net Tutorial - Working with DataSets
ASP Dot Net Tutorial - Working with XML
ASP Dot Net Tutorial - Forms Based Authentication
ASP Dot Net Tutorial - Windows Based Authentication
     

 
Online Personal Trainer Certification
Personal Trainer Certification (Spanish)
Six Sigma Certification
Find a Personal Trainer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Master Black Belt Certification
Six Sigma Green Belt Certification
Life Coach Certification
Lean Management Certification
Lean Six Sigma Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
Business Analyst Certification
SEO Certification
Online Business Writing Course & Certification
Makeup Artist Certification
Baby Sitting Course & Certification
Time Management Certification
Health Club Management Certification
Medical Coding Certification
Medical Billing Certification
Business Analysis Course
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
Event Management Certification
Test Search by Job Title
Administrative Assistant Certification
Virtual Assistant Certification
  All Online Courses
   

   
   
   
   
   
   

   
  Home > Courses, Tutorials & eBooks > ASP.NET Tutorial > Working with XML
 

ASP.NET Tutorial - Working with XML

                                                                                                                Page 1 of 3
 
Suggestion
A good understanding of XML will be an added advantage to work with it.

XML

The eXtensive Markup Language has a very important role in web applications. .Net has given enough space for XML classes in its framework. The main classes working with XML data are as follows: -

XmlTextReader

The XmlTextReader class is an implementation of XmlReader.

It provides a fast, performant parser.

It enforces the rules that XML must be well formed.

It is neither a validating nor a non-validating parser since it does not have DTD or schema information.

It can read text in blocks, or read characters from a stream.

The XmlTextReader performs the following functions:

  • Enforces the rules that XML must be well-formed.
  • Checks that the DTD is well-formed. However, does not use the DTD for validation, expanding entity references, or adding default attributes.
  • Validating is not done against DTDs or Schemas.
  • Checks the correct formation of any DOCTYPE nodes.
  • Checks the correct formation of the entities. For node types of EntityReference, a single empty EntityReference node is returned. An empty EntityReference node is one in which its Value property is a string. Empty. This is because there is no DTD or schema to expand the entity reference. The XmlTextReader does ensure that the whole DTD is well-formed, including the EntityReference nodes.
  • Provides a performant XML parser, because the XmlTextReader does not havethe overhead involved with validation checking.

XMLTextWriter

Represents a writer that provides a fast, non-cached, forward the only way of generating streams or files containing XML data that conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.

XMLDocument

This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document that enables the navigation and editing of this document.

XmlDataDocument

This class Allows structured data to be stored, retrieved, and manipulated through a relational DataSet.

XmlNodeReader

The XmlNodeReader has the ability to read an XML DOM sub tree. This class does not support DTD or schema validation.

Document Navigator

This class enables to navigate an XML document represented by XmlDocument class.

XML with Dataset

In the previous chapters DataSet was used with SqlServer. A DataSet can also be used with XML data. The following example shows how to read an XML document into a Dataset.

Reading an XML document into a DataSet

A XML file directly can be directly read from the hard drive into DataSet by using the ReadXml () method of the DataSet class. The following example demonstrates it: -

Example1:Items.xml

<Items>

<FoodItems>

<Food>

Toast

</Food>

<Price>

14.45

</Price>

</FoodItems>

<FoodItems>

<Food>

Noodles

</Food>

<Price>

30.00

</Price>

</FoodItems>

</Items>

 

Example56:ReadXmlItems.aspx

<%@ Import Namespace="System.Data" %>

 <Script Runat="Server">

 Sub Page_Load

Dim dstMenu As DataSet

 dstMenu = New DataSet()

dstMenu.ReadXml( MapPath( "Items.xml" ))

 dgrdMenu.DataSource = dstMenu

dgrdMenu.DataBind ()

End Sub

 </Script>

 <html>

<head><title>ReadXmlItems.aspx</title></head>

<body>

 <asp:DataGrid

ID="dgrdMenu"

cellpadding="10"

Runat="Server" />

 </body>

</html>

 

     

 

 
     
Home  |  About Us  |  Privacy Policy  |  Site Map  |  FAQs  |  Contact Us
 
© ExpertRating 2015. All Rights Reserved.