Solved

XML creation

Posted on 2012-03-14
3
500 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
Comment Utility
0
 

Author Comment

by:DamoD0
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

16 Experts available now in Live!

Get 1:1 Help Now