....">
C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




xml Document


Posted Date: 11 Oct 2008      Total Responses: 2

Posted By: lakshmi       Member Level: Silver     Points: 1


<Photo>
<MasterEvents Name="Conference">
<SubEventName Name="ExamCo-Ordinators2" />
<SubEventName Name="ExamCo-Ordinators" />
<SubEventName Name="Conference2008" />
</MasterEvents>
</Photo>

I am having a XML Document like this.

In SubEventName i want to add one more attribute at specific place, with value .
So it will look like this.

<SubEventName Name="ExamCo-Ordinators2" Venue="Vizag"/>

How to add this attribute from .net.
Urgent requirement.




Responses

Author: Vivek    11 Oct 2008Member Level: GoldRating:     Points: 1
Refer

http://www.example-code.com/vbdotnet/addAttribute.asp


Author: ANIL PANDEY    14 Oct 2008Member Level: DiamondRating:     Points: 6
hi,

u canXMLWriter to Write the XML element in the xml file.

refer this code..


XmlDocument doc = new XmlDocument();


string filename="c:\\sample.xml";
XmlTextWriter tw=new XmlTextWriter(filename,null);//null represents the Encoding Type//
tw.Formatting=Formatting.Indented; //for xml tags to be indented//

//tw.WriteStartDocument(); //Indicates the starting of document (Required)//


//tw.WriteStartElement("Employees");
//tw.WriteStartElement("Employee","Genius");
//tw.WriteAttributeString("Name","krishnan");
//tw.WriteElementString("Designation","Software Developer");
//tw.WriteElementString("FullName","krishnan Lakshmipuram Narayanan");

tw.WriteStartElement("Author");
tw.WriteElementString("ID","1");
tw.WriteElementString("SubmissionDate","1-1-08");
tw.WriteElementString("Topic","test");
tw.WriteElementString("Title","test");
tw.WriteStartElement("Authors");
tw.WriteStartElement("Author");
tw.WriteElementString("Name","XYZ");
tw.WriteElementString("Affiliation","ABC");
tw.WriteEndElement();
tw.WriteEndElement();
tw.WriteElementString("Summary","Hi");
tw.WriteElementString("Text","Hello");

tw.WriteEndElement();
//tw.WriteEndDocument();
tw.Flush();
tw.Close();

StreamReader srXml = new StreamReader(filename);
string xmlFile = srXml.ReadToEnd();




Regards
Anil Pandey



Post Reply
You must Sign In to post a response.
Next : XML Read/Write
Previous : C# win app
Return to Discussion Forum
Post New Message
Category: XML

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

conference call definitions

Contact Us    Privacy Policy    Terms Of Use