I tried to read file below
<?xml version="1.0" encoding="utf-8"?>
<BankAccount>
<Number>1234</Number>
<Name>James & Dean</Name>
<Type>Checking - é ü</Type>
<OpenDate>11/04/1934 </OpenDate>
<Balance>25382.20</Balance>
</BankAccount>
with XmlTextReader but an Exception thrown.
I thing that values inside Type tag should be indicated in diffrently but
how?
Or should I give XmlTextReader an option?
Reader code is below
namespace ReadXML
{
using System;
using System.Xml;
using System.Diagnostics;
public class ReadBankAccount
{
private const string m_strFileName = "c:\\account.xml";
[STAThread]
public static void Main()
{
XmlTextReader bankReader = null;
bankReader = new XmlTextReader (m_strFileName);
while (bankReader.Read())
{
if (bankReader.NodeType == XmlNodeType.Element)
{
if (bankReader.LocalName.Equals("Name"))
{
System.Diagnostics.Debug.WriteLine(String.Format("{0}
has balance of $",
bankReader.ReadString()));
}
if (bankReader.LocalName.Equals("Balance"))
{
System.Diagnostics.Debug.WriteLine(String.Format("{0}",
bankReader.ReadString()));
}
}
}
}
}
[quoted text, click to view] "Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1ea8b0ed610cff4498d0b0@msnews.microsoft.com...
JimmyW <JimmyW@hotmail.com> wrote:
> How characters é and ü should be coded into App.Config file?
> For Example & must be converted to & but how those two
> characters é (e with dot) and ü (German u) should be coded?
>
> Can anyone help?
Assuming the configuration file is encoded in an encoding which
includes those characters (such as UTF-8) you can just include the
character in the text.
--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too