Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<FormData>
<Registered>1</Registered>
<Version>1</Version>
<FormId/>
<Sides>1</Sides>
<SubForms>0</SubForms>
<Angle>=0.001</Angle>
<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
<?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
<?xml version="1.0"?>
like this
Posted
Updated 22-Dec-11 9:13am
v2

All that does is defines the document.

C#
XDocument doc = new XDocument();
doc.Save();


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.
 
Share this answer
 
Comments
Wonde Tadesse 22-Dec-11 18:45pm    
5+
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 http://www.xmlplease.com/standalone[^].

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.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^].
  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.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx[^], http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^].
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].


—SA
 
Share this answer
 
v2
Comments
Wonde Tadesse 22-Dec-11 18:45pm    
5+
Sergey Alexandrovich Kryukov 22-Dec-11 19:13pm    
Thank you, Wonde.
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900