[xsd-users] XML encoding

Boris Kolpackov boris at codesynthesis.com
Fri Mar 2 05:38:55 EST 2007


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070302/261e3ac6/attachment.pgp


More information about the xsd-users mailing list