Solved

XML creation

Posted on 2012-03-14
3
517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 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