Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
<?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 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
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

All that does is defines the document.
 
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.
  Permalink  
Comments
Wonde Tadesse at 22-Dec-11 18:45pm
   
5+
Rate this: bad
good
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 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
  Permalink  
v2
Comments
Wonde Tadesse at 22-Dec-11 18:45pm
   
5+
SAKryukov at 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)

  Print Answers RSS
0 OriginalGriff 275
1 DamithSL 265
2 CPallini 235
3 Maciej Los 185
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 22 Dec 2011
Copyright © CodeProject, 1999-2014
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