Solved

XML creation

Posted on 2012-03-14
3
504 Views
Last Modified: 2012-06-27
Hi, how do I create the following xml file in c sharp code:

<?xml version="1.0" encoding="utf-16" ?>
<ci:CommandInstruction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://navtechradar.com/ICDNAV001-StatusReport ICDNAV001-CommandInstruction.xsd"
xmlns:ci="http://www.navtechradar.com/ICDNAV001-CommandInstruction"
xmlns:cmn="http://www.navtechradar.com/ICDNAV001-CommonTypes">
<!-- Note that the sender element is not optional in command instructions - the subscriber must include it -->
<ci:Sender SenderId ="XFSControlSuite:1" NetworkAddress="192.168.24.5" NetworkPort ="2077"/>
<!-- Command ID:4 is a request for a status report -->
<ci:Command Sent="2010-04-03T22:01:02.112" CommandId="4" />
</ci:CommandInstruction>
0
Comment
Question by:DamoD0
3 Comments
 
LVL 29

Assisted Solution

by:QPR
QPR earned 100 total points
ID: 37723588
0
 

Author Comment

by:DamoD0
ID: 37723596
The specific problem I have is how to add the <ci:CommandInstruction/> root element. The exception tells me I can't use ":".

I'm using XmlDocument so I'm sure there's just one method to do this.

Thanks.
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 400 total points
ID: 37723847
Use LINQ To XML, perffered way to create/edit xml files...
Its much much easier and developer friendly syntax

Here is an example:-
http://msdn.microsoft.com/en-us/library/bb308960.aspx
http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/creating-and-saving-xml-tree-using-linq-to-xml/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sum Column in GridView 3 44
Transform XML to Excel using XSL 1 23
C# Offline Apllication 5 55
Configure a Bean in an XML file 4 12
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now