473,383 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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

http://support.microsoft.com/default...b;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.ParseBeginTagExpandCharEn tities()
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>
Nov 17 '05 #1
1 1826
Michael,
http://support.microsoft.com/default...b;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.ParseBeginTagExpandCharEn tities()
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...
--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
15
by: | last post by:
The data file is a simple Unicode file with lines of text. BCP apparently doesn't guarantee this ordering, and neither does the import tool. I want to be able to load the data either sequentially...
2
by: hezhenjie | last post by:
Hi, all: I just need to parse a unicode file, and assume to get data one line by one line. I use _wfopen(), fgetws(), wcslen(), wcsstr(), making it work normally on Windows platform. However,...
3
by: Kidus Yared | last post by:
I am having a problem displaying Unicode characters on my Forms labels and buttons. After coding Button1.Text = unicode; where the unicode is a Unicode character or string (‘\u1234’ or...
1
by: Jordan | last post by:
I have a unicode XML file that I am trying to read using the .NET XmlTextReader in C#. How do I read the unicode file? If I try to using the XmlTextReader.Read() method, it throws an exception. ...
10
by: Tibby | last post by:
I need to read/write not only text files, but binary as well. It seems like on binary files, it doesn't right the last 10% of the file. -- Thanks --- Outgoing mail is certified Virus...
5
by: Norman Diamond | last post by:
Here are two complete lines of output from Visual Studio 2005: 1>$B%W%m%8%'%/%H=PNO$K(B Authenticode $B=pL>$7$F$$$^$9(B... 1>Successfully signed: c:\T The first line means roughly: Doing...
14
by: Zoro | last post by:
My task is to read html files from disk and save them onto SQL Server database field. I have created an nvarchar(max) field to hold them. The problem is that some characters, particularly html...
3
by: Learning.Net | last post by:
How to read a Unicode data saved as ASCII in notepad file as txt ? I tried using streamReader but it is not showing Unicode data. eg. using (StreamReader sr = new StreamReader(test.txt) {...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.