Click here to Skip to main content
15,892,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: AutoSave Pin
WillemM22-Jan-06 20:16
WillemM22-Jan-06 20:16 
GeneralRe: AutoSave Pin
WillemM22-Jan-06 20:19
WillemM22-Jan-06 20:19 
GeneralRe: AutoSave Pin
pxp23-Jan-06 9:07
pxp23-Jan-06 9:07 
GeneralRe: AutoSave Pin
Guffa24-Jan-06 1:27
Guffa24-Jan-06 1:27 
GeneralRe: AutoSave Pin
pxp24-Jan-06 3:40
pxp24-Jan-06 3:40 
AnswerRe: AutoSave Pin
Guffa24-Jan-06 23:01
Guffa24-Jan-06 23:01 
GeneralRe: AutoSave Pin
karizmaguy200722-Feb-10 2:01
karizmaguy200722-Feb-10 2:01 
QuestionXML: why use Encoding ? Pin
pxp21-Jan-06 4:40
pxp21-Jan-06 4:40 
Hi all,

i have some trouble with XML file reading.

My logic:
<br />
  // 1: write code snippet<br />
  XmlWriter myXmlWriter = new XmlTextWriter(_filename, System.Text.Encoding.UTF8);<br />
  myXmlWriter.WriteElementString( "Version", "example string" );<br />
  ...etc...<br />

<br />
  // 2: load code snippet<br />
  XmlDocument myXmlDocument = XmlDocument();<br />
  myXmlDocument.Load(_filename);<br />
  ...<br />
  string strVersion = myXmlNode["Version"].InnerText;<br />

When opening a xml file i get the following error: "There is no Unicode byte order mark. Cannot switch to Unicode."

What i would like to achieve is a simple XML save/load for some values i wanna retrieve at runtime.

My suggestion without the use of Encoding:

<br />
TextWriter tw = new StreamWriter(_filename);<br />
XmlWriter myXmlWriter = new XmlTextWriter(tw);<br />


I could be getting the problem becuase the xml file was manually edited at one time using Notepad.

My question(s):

Can (or may) i skip the "System.Text.Encoding" ?
And if so, what are the downsides of it ?

Thanks in advance,

Jan
AnswerRe: XML: why use Encoding ? Pin
Guffa21-Jan-06 10:15
Guffa21-Jan-06 10:15 
GeneralRe: XML: why use Encoding ? Pin
pxp22-Jan-06 1:52
pxp22-Jan-06 1:52 
QuestionC# equiv. of Java synchronized keyword Pin
J4amieC21-Jan-06 3:16
J4amieC21-Jan-06 3:16 
AnswerRe: C# equiv. of Java synchronized keyword Pin
Ravi Bhavnani21-Jan-06 4:43
professionalRavi Bhavnani21-Jan-06 4:43 
AnswerRe: C# equiv. of Java synchronized keyword Pin
Judah Gabriel Himango21-Jan-06 14:38
sponsorJudah Gabriel Himango21-Jan-06 14:38 
QuestionAxiom 3d engine problems Pin
psycokara21-Jan-06 3:01
psycokara21-Jan-06 3:01 
AnswerRe: Axiom 3d engine problems Pin
Dave Kreskowiak21-Jan-06 11:50
mveDave Kreskowiak21-Jan-06 11:50 
QuestionHow to pass a complex object to a web service Pin
sergestusxx21-Jan-06 2:09
sergestusxx21-Jan-06 2:09 
GeneralRe: How to pass a complex object to a web service Pin
Guffa21-Jan-06 2:34
Guffa21-Jan-06 2:34 
GeneralRe: How to pass a complex object to a web service Pin
sergestusxx21-Jan-06 2:36
sergestusxx21-Jan-06 2:36 
Questioncreating and handling serial numbers Pin
ranzask21-Jan-06 1:36
ranzask21-Jan-06 1:36 
AnswerRe: creating and handling serial numbers Pin
CodyGen21-Jan-06 3:52
CodyGen21-Jan-06 3:52 
AnswerRe: creating and handling serial numbers Pin
shabonaa22-Jan-06 2:08
shabonaa22-Jan-06 2:08 
QuestionDatabase Provider error,Plz Help Pin
rudra08321-Jan-06 1:22
rudra08321-Jan-06 1:22 
QuestionHow can i check if the application run ? Pin
Gamil Mohamad21-Jan-06 1:05
Gamil Mohamad21-Jan-06 1:05 
AnswerRe: How can i check if the application run ? Pin
AB777121-Jan-06 2:34
AB777121-Jan-06 2:34 
GeneralRe: How can i check if the application run ? Pin
Gamil Mohamad21-Jan-06 4:43
Gamil Mohamad21-Jan-06 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.