Click here to Skip to main content
11,920,772 members (60,473 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Origin X="0.117" Y="0.027"/>
<RegistrationMark TopLeftX="1.317" TopLeftY="2.043" TopRightX="7.100" TopRightY="2.047" BottomLeftX="1.313" BottomLeftY="3.073" BottomRightX="7.097" BottomRightY="3.077"/>
This is the generated xml in c#. In that
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
encoding="utf-8" standalone="yes"? i don't want this parameter how we can genarate xml with out this parameter. only i want
<?xml version="1.0"?>
like this
Posted 22-Dec-11 9:50am
Edited 22-Dec-11 10:13am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

All that does is defines the document.

XDocument doc = new XDocument();

I believe that if you don't specify a new XDeclaration, it will not set any of that stuff. My suggestions is to try the code above and loo at your file to see what's in it.
Wonde Tadesse 22-Dec-11 18:45pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The situation is directly opposite: I have no idea how you ended up with the "standalone" attribute in the XML prolog. I must confess I never faced with this "mysterious" (see below) attribute before, as all direct ways to produce XML found in the standard libraries won't produce this attribute, unless you intentionally create it, of course.

About this attribute and its use, please see[^].

By the way, I don't know why this attribute can do anything wrong. But of course, you have every right to avoid having it.

So, just in case, let me overview all standard methods of working with XML directly. Of course, this review does not include various forms of serialization (which you might have faces with) or Data Contract (which I always highly recommend). Let's see:

  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
  2. Use the classes System.Xml.XmlTextWriter and System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.

Wonde Tadesse 22-Dec-11 18:45pm
SAKryukov 22-Dec-11 19:13pm
Thank you, Wonde.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 548
1 Dave Kreskowiak 245
2 phil.o 170
3 KrunalRohit 134
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,815
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web04 | 2.8.151120.1 | Last Updated 22 Dec 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100