Solved

XML creation

Posted on 2012-03-14
3
507 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

803 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