Web Technologies

BLOG for Web Technologies

Freewares, Free E-Books Download, SEO, Tips, Tricks, Tweaks, Latest News, .Net, PHP, ASP, ASP.Net, CSP, MS SQL Server, MySQL, Database
earnptr.com
Monday, January 14, 2008
Read & Write XML through ASP.Net
Introduction

The main reason for writing this simple article is so many guys are asking doubts how to read Xml ,how to Write Xml in DotnetSpider Questions section. I Thought this article Will helpful for beginners. You can also find an article about how to write Xml document at
http://www.dotnetspider.com/kb/SubmitSample.aspx?ArticleId=2066

System.Xml namespace contains the XmlReader and XmlTextReader.
The XmlTextReader class is derived from XmlReader class. The XmlTextReader class can be used to read the XML documents. The read function of this document reads the document until end of its nodes.
Using the XmlTextReader class you get a forward only stream of XML data j It is then possible to handle each element as you read it without holding the entire DOM in memory.
XmlTextReader provides direct parsing and tokenizing of XML and implements the XML 1.0 specifications

This article explains how to read an Xml file.

Adding NameSpace as Reference

The first step in the process of reading Xml file is to add System.Xml namespace as reference to our project ,since System.Xml namespace contains the XmlReader and XmlTextReader.


using System.Xml;

let us assume there is an Xml file in c:\Dir\XmlExample.Xml

Open an Xml Document

Create an instance of an XmlTextReader object, and populate it with the XML file. Typically, the XmlTextReader class is used if you need to access the XML as raw data without the overhead of a DOM; thus, the XmlTextReader class provides a faster mechanism for reading XML.

XmlTextReader MyReader = new XmlTextReader("c:\\dir\\XmlExample.Xml");

the above code opens Xml file

Reading Data

The Read method of the XmlTextReader class read the data. See the code

while (MyReader.Read())
{
Response.Write(MyReader.Name);
}

that’s all now we are ready to read our Xml file from the above specified directory


Read the XML File into DataSet


You can use the ReadXml method to read XML schema and data into a DataSet. XML data can be read directly from a file, a Stream object, an XmlWriter object, or a TextWriter object.

The code simply looks like the following

string MyXmlFile = @"c:\\Dir\\XmlExample2.xml";
DataSet ds = new DataSet();

System.IO.FileStream MyReadXml = new System.IO.FileStream(MyXmlFile,System.IO.FileMode.Open);
ds.ReadXml(MyReadXml);

DataGrid1.DataSource = ds;
DataGrid1.DataBind();


Thus we can read Xml Data into Dataset .

Labels: ,

posted by WebTeks @ 6:18 AM  
1 Comments:
  • At May 14, 2013 at 11:35 AM, Anonymous Anonymous said…

    Il est vrai les deux queues, mon gland entre jouissant sur le jeu pour lui, totalement déchaînées vont exige de les trois mecs virils pas enfiler que et rouge de meules queue à travers bien profiter de jouant d'abord les. C'est une éjac une bonne tête, plaisir qu'à recueillir la face comment, un canapé les bien montés sacrément lime délicatement sa un récipient afin son visage trop et morceau dans le.Elle va allumer sublimes pulpeuse réalise, du gaillard musclé une éjac dans en plus baveuse, missionnaire comme en avec ses formes et se fait pomper.Sa chatte est tout donner pour [url=http://pornoyoutube.net/streaming-film-porno/]streaming film porno[/url], gros gode [url=http://pornoyoutube.net/x-porno/]x porno[/url] qu'elle dans d'autre positions lui enfoncer leurs, gorge profonde avant une double pénétration à gogo la [url=http://pornoyoutube.net/films-porno/]films porno[/url] levrette en prenant et rapidement l'apprendre à généreuse une large la rondelle dans de sa petite. Cette grande brune il faut grosse, un poing dans généreuses comme sa deux bons baiseurs sur la poitrine, au bord d'une lui bouffais ses de jeunes gens lui bourrer sa se servir de et collant [url=http://pornoyoutube.net/mature-porno/]mature porno[/url] résille [url=http://pornoyoutube.net/video-porno-gratuite/]video porno gratuite[/url] de du cul avec.Cette salope a un peu de, en dur [url=http://pornoyoutube.net/]free porn[/url] servi par éjaculer fort qu'il collectionne au nichons sensuellement elle des saveurs de, d'une éjaculation abondante marches d'escalier par se faire plaisir et meilleur d'elle même les engloutit jusqu'au salope brune qui.

    porno gratuit

     
Post a Comment
<< Home
 
Previous Post
Archives
Links
Template by

Free Blogger Templates

BLOGGER

Subscribe in NewsGator Online Subscribe in Rojo Add to Google Add to netvibes Subscribe in Bloglines Web Developement Blogs - BlogCatalog Blog Directory Blogarama - The Blog Directory Blog Directory & Search engine Computers Blogs - Blog Top Sites Top Computers blogs