[xsd-users] XML encoding

Yianis Nikolaou yianisn at gmail.com
Fri Mar 2 08:26:43 EST 2007


thank you very much for your prompt reply!

I guess the standard Xerces library that I downloaded along with XSD does
not suport iso-8859-7 since I get an empty file when I call

project (ofs, p, map, "ISO8859-7");


The problem I am trying to solve has to do with Greek character (hence the
iso-8859-7).
When I run xsd with the default char size I get an exception
invalid_utf8_string from string.ixx when I use Greek characters in string
fields. When I use wchar_t it works fine, but the output is UNICODE and not
viewable by notepad etc.

Questions:
Q1: If Xerces recognized the iso8859-7 and I used wchars, then would I get
the correct output in iso8859-7 and not Unicode?
Q2: If I compile XSD with XSD_USE_LCP defined, would I be able to enter
Greek characters in standard char mode without getting the exception
invalid_utf8_string?

thank you in advance!
yianis


PS
Greek Characters, just in case you would like to test something (-:
abcdezh iklmn oprstu xy
αβγδεζηθικλμνξοπρστυφχψω

On 3/2/07, Boris Kolpackov <boris at codesynthesis.com> wrote:
>
> Hi Yianis,
>
> Yianis Nikolaou <yianisn at gmail.com> writes:
>
> > I would like to stream a XML tree to a file with encoding iso-8859-7
> >
> > I currently use the following procedure
> >
> > ......
> > std::ofstream ofs ("result.xml");
> > xml_schema::namespace_infomap map;
> > project (ofs, p, map);
> >
> > The generated file using Unicode encoding (UTF-8). Is there a way to
> > change that?
>
> Yes, by passing "ISO8859-7" to the serialization function:
>
> project (ofs, p, map, "ISO8859-7");
>
>
> This is documented in the Section 4.2, "Namespace Infomap and Character
> Encoding" of the C++/Tree Mapping Manual:
>
> http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#4.2
>
>
> Also note that depending on how you've built Xerces-C++ this encoding
> may not be supported. But I am pretty sure you will get it if you
> build Xerces-C++ with ICU.
>
>
> hth,
> -boris
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
>
> iQGVAwUBRef+v8iAKQuuCE8dAQKhIAv/XT8Ulxe6RxZSFqip6MqI9nbfb5sQFE1X
> oPmaaJd+IpJzO8FnOL4s3zquIOhzkIZHB6vtUx8BOzODfyv+sXetqvnggq6KcDcm
> ruzNEFKbnUWLyzbWKlEFcOyXDilwV1VTVKVR0Yh5sF6i+QSeqAhDkOJsdY8G+512
> g4DnqDduU8Pr+B26ajSdRyt/fQqX3wAmpXvV1LmTnGt0xZq3hp9OlpNytGjk2Dku
> JokTu+JI3P8Bb+HHCM/hRI2nPWcgq4rLWFmLatvTmode+ECFKUPWZr3aDhWDWhxm
> Hb/AU9lZdzUAS+yVQjr+M6MxAJDiz4CoSf65as19HlQQ/cljCy/QmhLa5sw5j+yQ
> KJ6GgTzdsyVCCJF4SGkkCmhQmKf5yP/hMbC+T9t+ZDYE8FXK90G40H59E1drym98
> Z+rlRFHyoEpdjntrQkGdC4/dz7Av1Us9p8nKWLzI1lQDrg+GtEBUIhE9Ho88njYD
> OhwWG9BGW/6Gu4P24mV54DbCbPc2lfNO
> =Uji7
> -----END PGP SIGNATURE-----
>
>


More information about the xsd-users mailing list