write a sample code make use of xmltext writer
Answer Posted / 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 |
Post New Answer View All Answers
How would you get asp.net running in apache web servers? Explain it's limitations.
Can we have multiple master pages in asp net?
What is asp net objects?
What is state management techniques in asp.net?
What is data grid view in asp.net?
What is the most appropriate lifetime for a database connection/orm context in an asp.net mvc application? : Asp.Net MVC
When you are running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
What is the difference between globalization and localization?
Define page output caching?
To get the values in two different controls to match which control you use it?
What is custom attribute? How to create?
How use Xml data in ASP.net?
What methods are fired during the page load? Init()
Hi this is the coding for adding data in to an xml table
i want the coding for update and delete
Try
Dim emp_xml_doc As New XmlDocument
If
System.IO.File.Exists(Server.MapPath("emp.xml")) Then
emp_xml_doc.Load(Server.MapPath("emp.xml"))
Dim myrow_element As XmlElement
myrow_element =
emp_xml_doc.CreateElement("EmpDetails")
Dim str As String
str = "
can s/w quality assurance engineer switch field to programming side i m very much interested in programming but not much good in it