Click here to Skip to main content
15,920,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: Application.Exit() not working very well Pin
J Liang10-Sep-06 2:28
J Liang10-Sep-06 2:28 
AnswerRe: Application.Exit() not working very well Pin
Arjun "Mjolnir" Bahree10-Sep-06 4:17
Arjun "Mjolnir" Bahree10-Sep-06 4:17 
Questionhow can i make wizard in c# Pin
Parshant Verma9-Sep-06 3:21
Parshant Verma9-Sep-06 3:21 
AnswerRe: how can i make wizard in c# Pin
Ravi Bhavnani9-Sep-06 3:58
professionalRavi Bhavnani9-Sep-06 3:58 
Questionhow can i integrate vc++ code in c# Pin
Parshant Verma9-Sep-06 3:20
Parshant Verma9-Sep-06 3:20 
AnswerRe: how can i integrate vc++ code in c# Pin
User 66589-Sep-06 3:31
User 66589-Sep-06 3:31 
AnswerRe: how can i integrate vc++ code in c# Pin
Arjun "Mjolnir" Bahree9-Sep-06 10:11
Arjun "Mjolnir" Bahree9-Sep-06 10:11 
QuestionWriting date and time in seperate tags xml Pin
Yustme9-Sep-06 3:12
Yustme9-Sep-06 3:12 
Hi,

Im having a strange problem which i can't solve.

this is the code:

XmlWriter writer = null;
DateTime dateNow = DateTime.Now;
DateTime timeNow = DateTime.Now;
string test = "testinggggg";
string tessst = "testtetststs";

// Create an XmlWriterSettings object with the correct options.
XmlWriterSettings settings = new XmlWriterSettings();

settings.Indent = true;
settings.IndentChars = ("\t");
settings.OmitXmlDeclaration = true;
settings.Encoding = Encoding.Default;
settings.NewLineOnAttributes = true;
settings.ConformanceLevel = ConformanceLevel.Fragment;

//dateNow.ToString("dd-MM-yyyy");
//timeNow.ToString("HH:mm:ss");

Console.WriteLine("The date of today = " + dateNow.ToString("dd-MM-yyyy"));
Console.WriteLine("The time of right now = " + timeNow.ToString("HH:mm:ss"));

try
{
// Create the XmlWriter object and write some content.
writer = XmlWriter.Create("Testing.xml", settings);
writer.WriteStartElement("Information");
writer.WriteElementString("DateOfBuilding", ""+dateNow.ToString());
writer.WriteElementString("TimeOfBuilding", ""+timeNow.ToString());
writer.WriteElementString("Testing", test.ToString());
writer.WriteElementString("Whatever", tessst.ToString());
writer.WriteEndElement();

writer.Flush();
}

finally
{
if (writer != null)
writer.Close();
}

Console.Read();

The problem is the date and time are written in the same tag.

This is how it looks like:

<Information>
<DateOfBuilding>9-9-2006 14:51:42</DateOfBuilding>
<TimeOfBuilding>9-9-2006 14:51:42</TimeOfBuilding>
<Testing>testinggggg</Testing>
<Whatever>testtetststs</Whatever>
</Information>

How can i write the date and time in sperate tags?

Thanks in advance!
AnswerRe: Writing date and time in seperate tags xml Pin
Ravi Bhavnani9-Sep-06 3:24
professionalRavi Bhavnani9-Sep-06 3:24 
AnswerRe: Writing date and time in seperate tags xml Pin
User 66589-Sep-06 3:29
User 66589-Sep-06 3:29 
GeneralRe: Writing date and time in seperate tags xml Pin
Yustme9-Sep-06 3:36
Yustme9-Sep-06 3:36 
Questionsome thread problem in client/server application Pin
selcux9-Sep-06 1:43
selcux9-Sep-06 1:43 
AnswerRe: some thread problem in client/server application Pin
Arjun "Mjolnir" Bahree10-Sep-06 4:19
Arjun "Mjolnir" Bahree10-Sep-06 4:19 
QuestionCreate own .tsk file(PocketPC file) Pin
2J2E9-Sep-06 1:22
2J2E9-Sep-06 1:22 
AnswerRe: Create own .tsk file(PocketPC file) Pin
User 454271820-Feb-10 10:45
User 454271820-Feb-10 10:45 
Questionaccess video frames Pin
trosten9-Sep-06 0:46
trosten9-Sep-06 0:46 
AnswerRe: access video frames Pin
Arjun "Mjolnir" Bahree10-Sep-06 4:21
Arjun "Mjolnir" Bahree10-Sep-06 4:21 
QuestionAutomating Telnet Pin
Green Fuze8-Sep-06 23:53
Green Fuze8-Sep-06 23:53 
AnswerRe: Automating Telnet Pin
Nader Elshehabi9-Sep-06 0:44
Nader Elshehabi9-Sep-06 0:44 
AnswerRe: Automating Telnet Pin
trosten9-Sep-06 0:44
trosten9-Sep-06 0:44 
AnswerRe: Automating Telnet Pin
Arjun "Mjolnir" Bahree9-Sep-06 10:14
Arjun "Mjolnir" Bahree9-Sep-06 10:14 
GeneralRe: Automating Telnet Pin
Green Fuze9-Sep-06 10:39
Green Fuze9-Sep-06 10:39 
GeneralRe: Automating Telnet Pin
Arjun "Mjolnir" Bahree9-Sep-06 10:47
Arjun "Mjolnir" Bahree9-Sep-06 10:47 
GeneralRe: Automating Telnet Pin
Green Fuze9-Sep-06 11:07
Green Fuze9-Sep-06 11:07 
GeneralRe: Automating Telnet Pin
Green Fuze9-Sep-06 13:20
Green Fuze9-Sep-06 13:20 

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.