[xsd-users] iso-8859-1 - Serialization Error
Constantin Iacobescu
sir.costy at gmail.com
Tue Apr 21 11:11:31 EDT 2009
Hello,
I try to create a xml.file .. to serialize using the XSD tree. The binding
is created for parsing/serializing LandXML files.
When I use the UTF-8 encoding anything is ok.
The problem now is that I want serialize elements which are using Latin-1
character set.
And now is the crash of the program in the file "streambuff" - exception:
xsd::cxx::xml::invalid_utf8_string at memory location 0x0017b492.
Also I use VC9 and Windows Vista
The Xercesc library is compiled statical and with Multi Byte Character Set
option.
To understand better here is the code used:
///////////////////////////////////////////////////////////////
XMLPlatformUtils::Initialize ();
try
{
std::ofstream ofs;
ofs.exceptions (std::ios_base::badbit | std::ios_base::failbit);
ofs.open (fileName);
std::auto_ptr<LandXML> objLandXML ( new
LandXML(xml_schema::Date(2008,4,20),
xml_schema::Time(12,
34, 56),
"1.2"));
xml_schema::NamespaceInfomap infoMap;
infoMap[""].name = "http://www.landxml.org/schema/LandXML-1.2";
infoMap[""].schema = "
http://www.landxml.org/schema/LandXML-1.2/LandXML-1.2.xsd";
LandXML::ProjectSequence& projectSequence(objLandXML.getProject());
Project project("Project");
project.setDesc("óáé"); //
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HERE IS THE
PROBLEM
projectSequence.push_back(project);
serializeLandXML (ofs,
*objLandXML,
infoMap,
"iso-8859-1",
xml_schema::Flags::dont_initialize); //
!!!!!!!!!!!!!!!!!!!!!!! APPLICATION CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
catch (const xml_schema::Exception& e)
{
assert(false);
}
XMLPlatformUtils::Terminate ();
///////////////////////////////////////////////////////////////
If anybody has had the same problem or know how to do this would be
appreciate.
Thanks.
Best Regards,
Constantin Iacobescu
More information about the xsd-users
mailing list