The default encoding type on the XmlTextReader is UTF-8, if no encoding type
is specified in the xml file.
Try this to change the default encoding type
//open a file stream
FileStream fstream= new FileStream(@"c: \myXml.xml, FileMode.Open,
FileAccess.Read );
//initialize a XmlParsercontex t and specify the encoding type
XmlParserContex t myParserContext = new XmlParserContex t(null, null, "",
XmlSpace.Defaul t, System.Text.Enc oding.UTF7);
//init XmlTextReader
XmlTextReader xtr = new XmlTextReader(f stream, XmlNodeType.Doc ument,
myParserContext );
--
Shak
(Houston)
"Duncan Welch" <du**@ntpcl.f9. co.uk> wrote in message
news:eX******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
I'm using the XmlTextReader to read a badly formatted XML document from a
URL (it has no <?xml tag) on a remote website (not mine). About halfway
through, I get an Illegal Character exception, which I'm assuming means
that the default encoding type is wrong.
Does anyone know a way to override the encoding type on the XmlTextReader?
Thanks in advance,
Duncan