Opened 8 years ago
Last modified 8 years ago
#10194 new Bugs
basic_xml_grammar<wchar_t> parses class_id failed
| Reported by: | Owned by: | Robert Ramey | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | serialization | 
| Version: | Boost 1.54.0 | Severity: | Problem | 
| Keywords: | Cc: | 
Description
I found this issue when I used xml wserialization to save config in polymorphic case. After debugging, I found basic_xml_grammar<wchar_t> failed to parse "class_id" under some conditions. There are some info for this issue:
- Compile with NDEBUG, without NDEBUG no this issue.
- basic_xml_grammar<char> works fine.
- Compile with GCC (when compile with VS2010, no this issue)
Detail of GCC: gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
I trimmed the test code:
#include <boost/archive/impl/basic_xml_grammar.hpp> #include <fstream> #include <iostream>
using namespace boost::archive;
int main() {
std::wifstream ifs("./dashboard.xml");
if (ifs) {
basic_xml_grammar<wchar_t> xmlGrammer; xmlGrammer.parse_start_tag(ifs);
std::wcout << "rv.class_id=" << xmlGrammer.rv.class_id << std::endl;
} else {
std::cout << "File doesn't exist." << std::endl;
}
return 0;
}
and the dashboard.xml is very simple with only one line: <item class_id="4" class_name="ComponentDataChart" tracking_level="1" version="4" object_id="_3">
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
| Component: | None → serialization | 
|---|---|
| Owner: | set to | 
comment:3 by , 8 years ago
how can u add "class_name" into your xml? my xml is like this: " <item class_id="4" tracking_level="1" version="4" object_id="_3">", could u help me? thank u very much!


Formatted test code:
#include <boost/archive/impl/basic_xml_grammar.hpp> #include <fstream> #include <iostream> using namespace boost::archive; int main() { std::wifstream ifs("./dashboard.xml"); if (ifs) { basic_xml_grammar<wchar_t> xmlGrammer; xmlGrammer.parse_start_tag(ifs); std::wcout << "rv.class_id=" << xmlGrammer.rv.class_id << std::endl; } else { std::cout << "File doesn't exist." << std::endl; } return 0; }