[xsd-users] A Question about Unicode Character

Boris Kolpackov boris at codesynthesis.com
Tue Apr 15 03:27:36 EDT 2008


Hi,

kun lv <lvkun2006 at gmail.com> writes:

>     #define ENCODING L"UTF-16"

I assume your wchar_t is 16-bit wide then (e.g., because you are
on Windows and using MS VC++).


> I have solve the serializtion problem with a simple method(I think maybe
> not the right method).

Yes, I wouldn't do it this way.


> But when i try to parse the document, the program throw out exception:
>     instance document parsing failed

This is most likely because your document does not contain XML
declaration which specifies that it is in UTF-16. If encoding
is not specified then the parsers must assume it is UTF-8. I
suggest that you remove the no_xml_declaration flag.
Alternatively, you can override the encoding assumed by the
parser but for that you will need to do XML-to-DOM parsing
yourself. See XSD and Xerces-C++ documentation for more
information on this method.

Boris




More information about the xsd-users mailing list