[xsd-users] Roundtrip errors with CXX-Tree
Russell C. Johns
johns at lanl.gov
Tue Mar 11 02:36:31 EDT 2008
Hi-
I have been attempting to round trip a document from memory to XML to
memory and I am getting tripped up on the parsing.
the document serializes the regular serialization routines with validation
not disaabled as well as passes the validation in Altova XMLspy, but I
get the following error when I try to load it:
system> ./XMLtest inpTest.xml inpTest.out
terminate called after throwing an instance of
'xsd::cxx::tree::parsing<char>'
what(): instance document parsing failed
Aborted
the main routine is:
if (argc < 2) {
std::cerr << "usage: " << argv[0] << "< txt or XML inp
file> < XML/txt out file>";
exit(1);
}
// perform Global Initialization;
TEST::initializeElements();
// load input file
std::string inpFile(argv[1]);
std::string outFile(argv[2]);
if (inpFile.compare(inpFile.size()-4,4,".xml",4)==0) {
// read XML file
xml_schema::properties props;
props.schema_location("http://schema.domain.com/TEST/input","TEST-input.xsd");
std::auto_ptr<TEST::input::TestInput> tif
(TEST::input::TEST_input(argv[1],0,props));
} else {
//read Txt-- output XML
TxtInputFile *inp = new TxtInputFile(argv[1]);
//inp->printAllBlocks();
TxtModel model(*inp);
TEST::input::TestInput ti(model.createTestInputModel());
try {
xml_schema::namespace_infomap map;
map[""].name= "http://schema.domain.com/TEST/input";
map[""].schema= "TEST-input.xsd";
std::ofstream fout(argv[2]);
TEST::input::TEST_input(fout , si, map);
} catch (const xml_schema::exception& e) {
std::cerr << e << std::endl;
}
}
so if you run it with a txt file it generates a corresponding XML file,
or with an XML file it should eventually produce the matching txt file.
I have tried this on windows and linux, with versions 2.3, 3.0, and 3.1
all produce the same error...
is there an error in the parsing design?
-Russ Johns
More information about the xsd-users
mailing list