[serialization]Mal-formed XML output
I've finally gotten serialization for XML archives to compile using
Boost 1.33.1. Now I'm trying to execute the test. Unfortunately,
the first archive output statement
outArchive << BOOST_SERIALIZATION_NVP(testObj_out);
triggers an exception saying, "unrecognized XML syntax". The
output file looks like
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
We would have to see more of the code to comment. Merrill Cornish wrote:
I've finally gotten serialization for XML archives to compile using Boost 1.33.1. Now I'm trying to execute the test. Unfortunately, the first archive output statement
outArchive << BOOST_SERIALIZATION_NVP(testObj_out);
triggers an exception saying, "unrecognized XML syntax". The output file looks like
very odd when writing the file !
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization>
Note that the closing ">" for the px element is missing, which is probably the reason why there is no newline before .
The serialize() function for the class object being archived has one ar & for a base class plus three data members. So, it looks like serialization is going awry while string to write the initial class element and never gets to the class contents.
By the way, I've never seen the XML root element (
) with attributes. Is that standard?
any xml elements can have attributes
Any ideas?
Merrill
Merrill Cornish wrote:
outArchive << BOOST_SERIALIZATION_NVP(testObj_out);
triggers an exception saying, "unrecognized XML syntax".
Try to put testObj_out inside a temporary variable.
Inside my code I do something like this:
std::string login = _wengoAccount->_wengoLogin;
ar << BOOST_SERIALIZATION_NVP(login);
Before I was doing:
ar << BOOST_SERIALIZATION_NVP(_wengoAccount->_wengoLogin);
And it was throwing an exception.
--
Tanguy Krotoff
I wouldn't recommend this Tanguy Krotoff wrote:
Merrill Cornish wrote:
outArchive << BOOST_SERIALIZATION_NVP(testObj_out);
triggers an exception saying, "unrecognized XML syntax".
Try to put testObj_out inside a temporary variable.
This would defeat any memory/identity tracking.
Inside my code I do something like this: std::string login = _wengoAccount->_wengoLogin; ar << BOOST_SERIALIZATION_NVP(login);
Before I was doing: ar << BOOST_SERIALIZATION_NVP(_wengoAccount->_wengoLogin); And it was throwing an exception.
Perhaps because there was a ">" character in the argument. Robert Ramey
participants (3)
-
Merrill Cornish
-
Robert Ramey
-
Tanguy Krotoff