read XML (unicode) data from a file by using Visual C++ .NET

G

Guest

http://support.microsoft.com/default.aspx?scid=kb;en-us;815658

The page above solved all of my problems with one exception. When the file
has strange data in it, possibly Japanese, I get the following error:

System.Xml.XmlException: '☼', hexadecimal value 0x0F, is an invalid
character. Line 8, position 18.
at System.Xml.XmlScanner.ScanContent()
at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
at System.Xml.XmlTextReader.Read()
at main(Int32 argc, SByte** argv) in
c:\work\xml_reader\xml_reader.cpp:line 74

This error comes from while (reader->Read()) command, so although I have
#define _UNICODE and changed my char to wchar_t, still getting the error.

Leads me to believe the XmlTextReader is not set up to read unicode.

How would I fix this?

Many, many thanks for your help!!! <Exasperated>
 
T

Tomas Restrepo \(MVP\)

Michael,
http://support.microsoft.com/default.aspx?scid=kb;en-us;815658

The page above solved all of my problems with one exception. When the file
has strange data in it, possibly Japanese, I get the following error:

System.Xml.XmlException: '?', hexadecimal value 0x0F, is an invalid
character. Line 8, position 18.
at System.Xml.XmlScanner.ScanContent()
at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
at System.Xml.XmlTextReader.Read()
at main(Int32 argc, SByte** argv) in
c:\work\xml_reader\xml_reader.cpp:line 74

This error comes from while (reader->Read()) command, so although I have
#define _UNICODE and changed my char to wchar_t, still getting the error.

Leads me to believe the XmlTextReader is not set up to read unicode.

How would I fix this?

_UNICODE and friends won't really change anything here, overall.

What are you reading the XML from? My guess (provided the XML is actually
well-formed) is that you need to ensure the XmlReader picks up the correct
encoding of the document, but the way to ensure that depends on how you load
the document and where you load it from....

If you can show us the code, we could help...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top