C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » XML »

XML support in .net framework


Posted Date: 20 Jul 2009    Resource Type: Articles    Category: XML
Author: PunitMember Level: Gold    
Rating: 1 out of 5Points: 9



XML Namespace:The .net framework give support for xml documents.The namespace system.xml support various classes that are used to deal with XML language.

The commonly used classes for xml data are,

1)XmlTextReader:The instance created by using this class provide forward only access to xml data.It checks whether XML data is well formed.The syntax to declare object of this class,

XmlTextReader mWriter=new XmTextReader("tmpXML.xml");

2)XmlTextWriter:Provides forward only way of generating streams or files containing XML data that conforms to w3c xml standered.The syntax to declare object of this class,

XmlTextWriter mReader=new XmlTextWriter("tmpXML.xml");

3)XmlDocument:This class allows navigation and editing of XML nodes.This class also support XML DOM.The syntax to declare object of this class,

XmlDocument mDoc=new XmlDocument();

4)XmlDataDocument:One can use this class with dataset to providerelational and non-relational views of the same set of data.This class is normally used to access functionality of ado.net.This class support XML DOM.The syntax to declare object of this class,

Dataset ds1 =new dataset();
XmlDataDocument mDoc=new XmlDataDocument(ds1);

5)XmlNodeReader:This class provide forward only access to the data represented by XmlDocument and XmlDataDocument class.This class support XML DOM.The syntax to declare object of this class,

XmlDocument mDoc=new XmlDocument();
XmlNodeReader mNode=new XmlNodeReader(mDoc);

6)XslTransform:This class provide support for XSLT documents.You need to include system.xsl namespace before using this class.The syntax to declare object of this class,

XslTransform mDoc=new XslTransform();

XML Web Server Control:
The .net framework provide XML web server control.This control is used to display contents of an XML documents without formatting or using XSL transformation.
The XML web server control has the following properties,

DocumentSource:Allows you to specify the Uniform Resource Locater or the path pf the XML Documents.

TransformSource:Allows you to specify the Uniform Resource Locater(URL) of XSLT file or the path pf the XML Documents.

Document:Instance of XmlDocumet class.

Transfomrm:Instance of XslTransform class.


Load XML document into dataset:

The dataset object has ReadXml methode which is used to read data into the dataset from an XML file.
The syntax to declare ReadXml method,

ReadXml(Stream|File|textReader|XMLReader,XmlReadMode);

The ReadXml method can read data from Stream|File|textReader|XMLReader

XMLReadMode can take following values,
Auto
DiffGram
Fragment
IgnoreSchema
InferSchema
ReadSchema

If you want to represent XML(Menu.xml) document with a dataset:



Speghati
2.5$


Pizza
4.5$




One can read Menu.xml file int o dataset and bind the datagrid control by adding following code at load event.
public sub load()
{
dataset ds=new dataset();
ds.ReadXml(MapPath("Menu.xml"));
datagrid1.datasource=ds;
datagrid1.databind();
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
XML support in .net framework  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: XML Structure
Previous Resource: XML Basics
Return to Discussion Resource Index
Post New Resource
Category: XML


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use