From adi4info at gmail.com Fri May 1 12:02:06 2015 From: adi4info at gmail.com (Adinath Shetye) Date: Sun May 3 09:02:37 2015 Subject: [xsde-users] Program crash: How to use XML-Schema built-in string type Message-ID: Hi All, I'm trying to generate XMl from below shcema and need help to initialse a XML-Schema built-in string type and my program is crashing: Generated code using command:xsde cxx-hybrid --generate-parser --generate-serializer --generate-aggregate Schema.xsd *Schema.hxx file:* // UUID (fixed-length) // class UUID: public ::std::string { public: UUID (); }; // GetID (fixed-length) // class GetID { public: GetID (); GetID (const GetID&); GetID& operator= (const GetID&); ~GetID (); // IDField // const ::UUID& IDField () const; ::UUID& IDField (); void IDField (const ::UUID&); private: ::UUID IDField_; }; *Main Program:* int main (int argc, char* argv[]) { UUID UObj; std::string Str("adasddsaadasddsa"); UObj.assign(Str);* //---Core Dump* // UObj.base_value(Str); *//---Compilation Error* GetID IDObj; IDObj.IDField(UObj); RootNode_saggr getid_s; xml_schema::document_simpl doc_s (getid_s.root_serializer (), getid_s.root_name ()); ostringstream ostr; ofstream myfile; myfile.open ("example.xml"); myfile << "\n"; myfile << "\n"; getid_s.pre (IDObj); doc_s.serialize (cout,xml_schema::document_simpl::pretty_print); getid_s.post (); myfile.close(); cout << ostr.str () << endl; return 0; } *Compilation Error:* >From the link( http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#5) I tried to initialise UUID as below but getting compilation error: Main.cxx: In function ?int main(int, char**)?: Main.cxx:15:7: error: ?class UUID? has no member named ?base_value? UObj.base_value(Str); *Program Crash:* When I try UObj.assign(Str); the program compiles but I get core dump: terminate called after throwing an instance of 'xsde::cxx::serializer::schema' what(): schema error Aborted (core dumped) GDB stack frames: #0 0xb7fdbd4c in __kernel_vsyscall () #1 0xb7d38607 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #2 0xb7d3ba33 in __GI_abort () at abort.c:89 #3 0xb7f22595 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #4 0xb7f201f3 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #5 0xb7f2022f in std::terminate() () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #6 0xb7f20496 in __cxa_throw () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #7 0x08056d6a in xsde::cxx::serializer::genx::document_simpl::serialize(genxWriter_rec*) () #8 0x08056fdc in xsde::cxx::serializer::genx::document_simpl::serialize(std::ostream&, unsigned short) () #9 0x08049a94 in main (argc=1, argv=0xbffff5a4) at Main.cxx:28 Thanks in Advance, Adinath From boris at codesynthesis.com Sun May 3 09:26:23 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun May 3 09:26:30 2015 Subject: [xsde-users] Program crash: How to use XML-Schema built-in string type In-Reply-To: References: Message-ID: Hi, Adinath Shetye writes: > *Program Crash:* > When I try UObj.assign(Str); the program compiles but I get core dump: > terminate called after throwing an instance of > 'xsde::cxx::serializer::schema' > what(): schema error I suggest that you do the following: 1. Read the documentation, specifically on the schema exception. 2. Based on what you have learned from the step above, catch and print the information from this exception so that it allows you to understand where the problem it. Boris From adi4info at gmail.com Sun May 3 10:51:31 2015 From: adi4info at gmail.com (Adinath Shetye) Date: Mon May 4 02:58:00 2015 Subject: [xsde-users] Program crash: How to use XML-Schema built-in string type In-Reply-To: References: Message-ID: Thanks Boris, The exception was due to assigning UUID length not exactly equal to 36. *Schema:* *Main.cxx:* UUID UObj; std::string Str("adasddsaadasddsa");------This string should have been 36 chars long Regards, Adinath On Sun, May 3, 2015 at 3:26 PM, Boris Kolpackov wrote: > Hi, > > Adinath Shetye writes: > > > *Program Crash:* > > When I try UObj.assign(Str); the program compiles but I get core dump: > > terminate called after throwing an instance of > > 'xsde::cxx::serializer::schema' > > what(): schema error > > I suggest that you do the following: > > 1. Read the documentation, specifically on the schema exception. > > 2. Based on what you have learned from the step above, catch and > print the information from this exception so that it allows > you to understand where the problem it. > > Boris > From Jonathan.Haws at sdl.usu.edu Thu May 28 18:24:04 2015 From: Jonathan.Haws at sdl.usu.edu (Jonathan Haws) Date: Thu May 28 18:24:14 2015 Subject: [xsde-users] Potential Bug when Parsing xs:double? Message-ID: <9c4b7cdfb70b46f3af13f276fc3d2792@Perses.usurf.usu.edu> Boris, I don't know if this is a bug or if I am doing something wrong, but I have a very simple schema where I am trying to parse xs:double. I am parsing the input character stream in pieces, meaning I am calling doc_p.parse() and setting the last boolean appropriately. In nearly every case things work just fine. However, when I am parsing a negative value and the last parse call ended with the '-' sign, the first digit of the number is lost. I've attached a schema, XML, makefile, and test application that shows what I am talking about. Just build and run ./driver instance1.xml 275 and you'll see that the longitude value is incorrect. Thoughts? Is this a bug or am I doing something wrong? My guess would be the latter... Thanks! Jon PS - if some of the files don't make it through (there should be 4) let me know and I'll zip them up and send them directly. Thanks! -------------- next part -------------- A non-text attachment was scrubbed... Name: driver.cpp Type: text/x-c++src Size: 2037 bytes Desc: driver.cpp Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20150528/71a37691/driver.cpp -------------- next part -------------- A non-text attachment was scrubbed... Name: instance1.xml Type: text/xml Size: 332 bytes Desc: instance1.xml Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20150528/71a37691/instance1.bin -------------- next part -------------- ############################################################################### # # XML Makefile # # Author: Jonathan R. Haws # Date: 2012-05-23 # ############################################################################### ############################################################################### # XSD/e Root Settings # These must be first since they (can) overwrite variables I set here ############################################################################### ifeq ($(XSDE_ROOT),) XSDE_ROOT := /usr/xsde endif root := $(XSDE_ROOT) include $(root)/build/cxx/rules.make ############################################################################### # Debug Settings # # Set DEBUG = y to enable debugging code ############################################################################### DEBUG = y ifeq ($(DEBUG),y) DFLAGS = -g -O0 else DFLAGS = -O2 endif OBJECTS = test-pskel.o \ test-pimpl.o \ test.o \ driver.o TARGETS = driver INC_PATHS = -I../ -I$(root)/libxsde LIB_PATHS = -L. -L$(root)/libxsde/xsde CPPFLAGS += -Wall $(DFLAGS) $(INC_PATHS) LDFLAGS = $(LIB_PATHS) -lxsde ############################################################################### # XSD/e Settings ############################################################################### #EXTRA_CPPFLAGS := -I$(root)/libxsde ifeq ($(XSDE_ENCODING),iso8859-1) EXTRA_XSDFLAGS += --char-encoding iso8859-1 endif ifeq ($(XSDE_LONGLONG),n) EXTRA_XSDFLAGS += --no-long-long endif ifeq ($(XSDE_PARSER_VALIDATION),n) EXTRA_XSDFLAGS += --suppress-parser-val endif ifeq ($(XSDE_SERIALIZER_VALIDATION),n) EXTRA_XSDFLAGS += --suppress-serializer-val endif ifeq ($(XSDE_REUSE_STYLE),mixin) EXTRA_XSDFLAGS += --reuse-style-mixin endif ifeq ($(XSDE_POLYMORPHIC),y) EXTRA_XSDFLAGS += --runtime-polymorphic endif GENERATED_SRC = test-pskel.hxx \ test-pimpl.hxx \ test.hxx ############################################################################### # Targets ############################################################################### all: $(OBJECTS) $(TARGETS) @echo " -> Finished compiling!" driver: $(root)/libxsde/xsde/libxsde.a driver.cpp $(CXX) -o driver $(OBJECTS) $(CPPFLAGS) $(LDFLAGS) test.o: test.cxx test-pskel.o: test-pskel.cxx test-pimpl.o: test-pimpl.cxx # Mark the generated files as precious so that they do not get deleted on a # failed build .PRECIOUS: test.hxx test.cxx \ test-pskel.hxx test-pskel.cxx \ test-pimpl.hxx test-pimpl.cxx \ test.hxx test.cxx \ test-pskel.hxx test-pskel.cxx \ test-pimpl.hxx test-pimpl.cxx: test.xsd xsde cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \ --generate-parser --generate-aggregate --root-element rootelement $< .PHONY: gen gen: test.xsd $(GENERATED_SRC) .PHONY: clean clean: rm -f driver *.exe *.o *.cxx *.hxx *.ixx *.a testapp -------------- next part -------------- A non-text attachment was scrubbed... Name: test.xsd Type: application/xml Size: 633 bytes Desc: test.xsd Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20150528/71a37691/test.xml From boris at codesynthesis.com Fri May 29 11:23:20 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri May 29 11:23:25 2015 Subject: [xsde-users] Potential Bug when Parsing xs:double? In-Reply-To: <9c4b7cdfb70b46f3af13f276fc3d2792@Perses.usurf.usu.edu> References: <9c4b7cdfb70b46f3af13f276fc3d2792@Perses.usurf.usu.edu> Message-ID: Hi Jonathan, Jonathan Haws writes: > Is this a bug or am I doing something wrong? I think this is a bug that we have already fixed. I tried your test with the version from the repository and it works fine. Could you try the latest pre-release to confirm this: http://codesynthesis.com/~boris/tmp/xsde/ Boris From Jonathan.Haws at sdl.usu.edu Fri May 29 13:38:28 2015 From: Jonathan.Haws at sdl.usu.edu (Jonathan Haws) Date: Fri May 29 13:38:38 2015 Subject: [xsde-users] Potential Bug when Parsing xs:double? References: <9c4b7cdfb70b46f3af13f276fc3d2792@Perses.usurf.usu.edu> Message-ID: <31782361263a43bf8a3ba741b194408f@Perses.usurf.usu.edu> Boris, Yes this is fixed in the latest pre-release. Thanks for the help! Do you know when this version will be released? Thanks! Jon On 05/29/2015 09:23 AM, Boris Kolpackov wrote: > Hi Jonathan, > > Jonathan Haws writes: > > > Is this a bug or am I doing something wrong? > > I think this is a bug that we have already fixed. I tried your > test with the version from the repository and it works fine. > Could you try the latest pre-release to confirm this: > > http://codesynthesis.com/~boris/tmp/xsde/ > > Boris > >