write a sample code make use of xmltext writer
Answer / career.tina@yahoo.co.in
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
//creating a apth for writing xml
string xml1 = Server.MapPath("test2.xml");
//initialising xmlwriter
XmlTextWriter xt = new XmlTextWriter(xml1,
System.Text.Encoding.UTF8);
xt.Formatting = System.Xml.Formatting.Indented;
//start writing it
xt.WriteStartDocument();
//element
xt.WriteStartElement("name");
// attribute
xt.WriteAttributeString("my_name", "name");
xt.WriteStartElement("phn");
xt.WriteAttributeString("my_phn", "266549560");
xt.WriteStartElement("id");
xt.WriteAttributeString("my_id", "100");
xt.WriteStartElement("city");
xt.WriteAttributeString("my_city", "city");
xt.WriteElementString ("title","gud girl");
//ending all elements
xt.WriteEndElement ();
xt.WriteEndElement();
xt.WriteEndElement();
xt.WriteEndElement();
xt.WriteEndDocument();
xt.Close ();
}
catch
{
}
}
}
Is This Answer Correct ? | 3 Yes | 0 No |
How .Net has implemented security for web applications?
What is the use of worker process in asp.net?
List the types of authentication supported by asp.net?
What are the differences between primary foreign and unique keys?
Explain the difference between response.redirect vs server.transfer
difference between writing connection string in web.config through connection string and appsettings
Which adapter should you use, if you want to get the data from an access database?
How to improve performance of web application asp.net mvc? : Asp.Net MVC
Differentiate between file-based dependency and key-based dependency.
Given an ASP.NET Web Form called WebFrom1, what class does the WebForm1 class inherit from by default? a) System.Web.Form b) System.Web.GUI.Page c) System.Web.UI.Page d) System.Web.UI.Form
Why Unload event of MasterPage Calls first in ASP.net ?
what is view state and its use
10 Answers DELL, Efextra, HCL,