Click here to Skip to main content
15,917,176 members
Home / Discussions / C#
   

C#

 
GeneralRe: Querying NDIS Pin
Dave Kreskowiak17-May-05 9:42
mveDave Kreskowiak17-May-05 9:42 
QuestionVS.NET 2003 - Bug in project list ? Pin
Seraphin16-May-05 22:29
Seraphin16-May-05 22:29 
AnswerRe: VS.NET 2003 - Bug in project list ? Pin
Colin Angus Mackay16-May-05 22:38
Colin Angus Mackay16-May-05 22:38 
GeneralRe: VS.NET 2003 - Bug in project list ? Pin
Anonymous16-May-05 23:02
Anonymous16-May-05 23:02 
AnswerRe: VS.NET 2003 - Bug in project list ? Pin
leppie17-May-05 1:18
leppie17-May-05 1:18 
GeneralRe: VS.NET 2003 - Bug in project list ? Pin
Anonymous17-May-05 1:45
Anonymous17-May-05 1:45 
GeneralPDF Server Pin
HuntTheShunt216-May-05 21:53
HuntTheShunt216-May-05 21:53 
GeneralInserting XML elements between node Pin
ksanju100016-May-05 21:11
ksanju100016-May-05 21:11 
hi,
I have written code to insert node
but its inserting after root node i want that it should insert after farm-config
pls check my code

private void button6_Click_1(object sender, System.EventArgs e)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("c:/farm-config.xml");
XmlElement farmelement = xmldoc.CreateElement("farm");
xmldoc.DocumentElement.InsertBefore(farmelement,xmldoc.DocumentElement.LastChild);

FileStream fsxml = new FileStream("c:/farm-config.xml",FileMode.Truncate,FileAccess.Write,FileShare.ReadWrite);

// XML Document Saved
xmldoc.Save(fsxml);
}
Pls modify my existing code so that i could insert after farm-config node


Hi this is my original stururtue of XML file
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>

</farm>

</farm-config>
</root>

after inserting XML looks like in the given below structure
----- --------- ----------------


<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm />
<farm-config>
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>

</farm>

</farm-config>
</root>

I want Xml to be inserted after farm-config
This should be inserted like that
I am giving you the structure of XML file
What fucntion should i write or modify my existing code
For the code see above

<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm />
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>

</farm>

</farm-config>
</root>

regards
sanjeev

GeneralRe: Inserting XML elements between node Pin
Anonymous16-May-05 21:37
Anonymous16-May-05 21:37 
GeneralRe: Inserting XML elements between node Pin
ksanju100016-May-05 23:26
ksanju100016-May-05 23:26 
GeneralRe: Inserting XML elements between node Pin
Wilco017-May-05 1:49
Wilco017-May-05 1:49 
GeneralRe: Inserting XML elements between node Pin
ksanju100022-May-05 2:18
ksanju100022-May-05 2:18 
QuestionSoftware licencing ..How to make my product expire after 15 days? Pin
Member 187880616-May-05 20:48
Member 187880616-May-05 20:48 
GeneralActive desktop Pin
Sabry190516-May-05 20:36
Sabry190516-May-05 20:36 
GeneralHopefully the last post concerning client/server Pin
methodincharge16-May-05 20:22
methodincharge16-May-05 20:22 
GeneralQuestion on custom attributes Pin
Senthil Sivasubramanian16-May-05 20:18
Senthil Sivasubramanian16-May-05 20:18 
GeneralRe: Question on custom attributes Pin
spif200116-May-05 20:25
spif200116-May-05 20:25 
GeneralStretching and Transforming Pictures Pin
Reanalyse16-May-05 20:15
Reanalyse16-May-05 20:15 
GeneralRe: Stretching and Transforming Pictures Pin
Werdna17-May-05 14:52
Werdna17-May-05 14:52 
GeneralRe: Stretching and Transforming Pictures Pin
Reanalyse17-May-05 17:13
Reanalyse17-May-05 17:13 
GeneralGENERAL NETWORK ERROR..CONTACT YOUR DOCUMENTATION Pin
pubududilena16-May-05 19:38
pubududilena16-May-05 19:38 
GeneralRe: GENERAL NETWORK ERROR..CONTACT YOUR DOCUMENTATION Pin
mav.northwind17-May-05 22:05
mav.northwind17-May-05 22:05 
Generalempty project wizard in Visual studio 2005 Pin
Anonymous16-May-05 18:46
Anonymous16-May-05 18:46 
GeneralSetCaretPos is not working Pin
CsharpHelp16-May-05 17:47
sussCsharpHelp16-May-05 17:47 
Questiona Collection of Panel's Problem ? Pin
hareluya16-May-05 17:32
hareluya16-May-05 17:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.