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 |
What is the difference between viewstate and hidden field in asp.net?
can we call webservice in Html form?
1 Answers Bank Of America, BirlaSoft, Microsoft,
Difference between mvc2 and mvc3 in asp.net?
What are the advantages of Web API?
What are the features of asp net?
What is the difference between <%#%> and <%=%>?
What are the different ways you would consider sending data across pages in ASP (i.e between asp to asp)?
What is ispostback method in asp.net?
What are the types of validation in asp net?
Which class provides methods that can be used to manage role membership to be used in user authorization?
How can we Maintain more than on config file in one .Net web application and how?
difference between <connectionstring> <Appsetting>