From gen.i.shu at gmail.com Wed Nov 24 05:41:07 2021 From: gen.i.shu at gmail.com (=?UTF-8?B?6Kix5bO757+K?=) Date: Thu Nov 25 03:07:52 2021 Subject: [xsde-users] Load Xml and Parse error Message-ID: HI, My purpose is use xsd file to generate the c++ .h file and serialize/deserialize so I follow the sample in cxx\hybrid\library. I use xsde.exe tool to generate the file by my own xsd file with "--generate-parser --generate-serializer --generate-aggregate --omit-default-attributes". But when I exec the driver.exe it will have an error when code running to "doc_p.parse(argv[1])". The error is below "terminate called after throwing an instance of 'xsde::cxx::parser::schema' what(): schema error". I have no idea what's wrong for this error message. Is that mean something wrong when I use xsde.exe to generate file? or is there anything step I miss it? My step 1.Modify makefile to generate the file which is require by my own xsd. 2.Modify driver.cxx to load my own xml(is already validate by xsd) and parse. Thanks for help. Lucas Hsu. From boris at codesynthesis.com Thu Nov 25 03:31:28 2021 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Nov 25 03:29:12 2021 Subject: [xsde-users] Load Xml and Parse error In-Reply-To: References: Message-ID: ??? writes: > But when I exec the driver.exe it will have an error when code running > to "doc_p.parse(argv[1])". > The error is below > "terminate called after throwing an instance of > 'xsde::cxx::parser::schema' what(): schema error". > I have no idea what's wrong for this error message. This exception likely means that your XML document does not conform to your XML Schema. You can get more details if you catch the exception and print the information like in the library/driver.cxx example: catch (const xml_schema::parser_exception& e) { cerr << input << ":" << e.line () << ":" << e.column () << ": " << e.text () << endl; return 1; } One common cause of this king of exception is getting the root element namespace (or lack thereof) wrong in this call: xml_schema::document_pimpl doc_p ( catalog_p.root_parser (), catalog_p.root_namespace (), catalog_p.root_name ()); From gen.i.shu at gmail.com Thu Nov 25 22:32:49 2021 From: gen.i.shu at gmail.com (=?UTF-8?B?6Kix5bO757+K?=) Date: Fri Nov 26 05:44:43 2021 Subject: [xsde-users] Load Xml and Parse error In-Reply-To: References: Message-ID: Thanks for your reply. The reason is about xml in not match for xsd file. And I also face the other problem is about use XSD/e tool to generate header file. XSD/e command:"cxx-hybrid --generate-parser --generate-serializer --generate-aggregate ABC.xsd" In ABC.xsd file I use " to refence another xsd, and in ABC.hxx it will show "#include "AAA.hxx"" And in pimpl.h and simpl.h will also show include "AAA-pimpl.h" and include "AAA.-simpl.h" . But it looks like the XSD/e tool will not like visual studio XSD.exe tool to help us auto generate the reference XSD header file? Boris Kolpackov ? 2021?11?25? ?? ??4:31??? > ??? writes: > > > But when I exec the driver.exe it will have an error when code > running > > to "doc_p.parse(argv[1])". > > The error is below > > "terminate called after throwing an instance of > > 'xsde::cxx::parser::schema' what(): schema error". > > I have no idea what's wrong for this error message. > > This exception likely means that your XML document does not conform to > your XML Schema. You can get more details if you catch the exception > and print the information like in the library/driver.cxx example: > > catch (const xml_schema::parser_exception& e) > { > cerr << input << ":" << e.line () << ":" << e.column () << ": " > << e.text () << endl; > return 1; > } > > One common cause of this king of exception is getting the root element > namespace (or lack thereof) wrong in this call: > > xml_schema::document_pimpl doc_p ( > catalog_p.root_parser (), > catalog_p.root_namespace (), > catalog_p.root_name ()); >