From boris at codesynthesis.com Mon Oct 2 05:10:52 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] C++/Tree Mapping Customization Guide is ready Message-ID: <20061002091052.GA24662@karelia> Good day, C++/Tree Mapping Customization Guide is ready and available at: http://wiki.codesynthesis.com/Tree/Customization_guide It shows how to customize generated and XML Schema built-in types in the C++/Tree mapping. Comments and suggestions for improvements are welcome. You can post them either to this mailing list, write them in the "talk" page, or incorporate directly to the guide. Have fun, Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061002/3f22f426/attachment.pgp From jwang at saic-asd.com Mon Oct 2 10:50:37 2006 From: jwang at saic-asd.com (Jason Wang) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Serializing ... Message-ID: <4521273D.1040903@saic-asd.com> Hi, I am new to XSD and I like it very much so far. I had some minor issues on serializing to ostream (and the operator<<(...)). I am not sure if it is by design or is it a bug. But when streaming, it crashes when a required element is not set (or null). I guess it is by design. If so, I wonder if there is way to relax this condition by set some parameters at code generation or at run time. I personally feel a warning message is more user friendly than crashing the code if a required element is not set. Also in order to stream, one needs to set the following lines first: xml_schema::namespace_infomap map; map["pos"].name = "..."; map["pos"].schema = "..."; It would be more user friendly to me if a default value is provided. After all those info is readily available at code generation. Thanks, Jason From boris at codesynthesis.com Mon Oct 2 12:01:59 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Serializing ... In-Reply-To: <4521273D.1040903@saic-asd.com> References: <4521273D.1040903@saic-asd.com> Message-ID: <20061002160159.GC28397@karelia> Hi Jason, Jason Wang writes: > I am new to XSD and I like it very much so far. Great! > I had some minor issues on serializing to ostream (and the > operator<<(...)). I am not sure if it is by design or is it a bug. But > when streaming, it crashes when a required element is not set (or null). Hm, I wonder how you managed to construct an object with a required element not set? By default, XSD-generated constructors will force you to supply all required elements and attributes. Unless, of course, you are using the --generate-default-ctor option which will make XSD always generate default constructors which leave required members uninitialized. > I guess it is by design. If so, I wonder if there is way to relax > this condition by set some parameters at code generation or at run time. > I personally feel a warning message is more user friendly than > crashing the code if a required element is not set. It is not clear to me how useful that would be. The resulting XML will be invalid: you won't be able to validate it against the schema nor parse it back to the in-memory representation using the XSD-generated code. Because of this we've decided to leave it as an application logic error just like dereferencing null pointer is. > Also in order to stream, one needs to set the following lines first: > > xml_schema::namespace_infomap map; > map["pos"].name = "..."; > map["pos"].schema = "..."; > > It would be more user friendly to me if a default value is provided. > After all those info is readily available at code generation. I agree the namespace name and prefix information can be inferred from the schema. However, I don't think it is a good idea to use the same schema file name as the one being compiled. What if you are passing an absolute path such as /tmp/my-schema.xsd? You don't want '/tmp/my-schema.xsd' in you XML instances. We could probably strip everything except the file name... I don't see a reason why we can't do that. I will add it to our TODO list, thanks for the suggestion! thanks, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061002/adcd43be/attachment.pgp From web_master at khronos.org Wed Oct 4 16:13:37 2006 From: web_master at khronos.org (Khronos Webmaster) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Do you have support for COLLADA Message-ID: Hello, I saw that you are offering support for X3D with XSD. Are you also offering support for COLLADA? If so I would like to list the news on the Khronos web site Thanks From boris at codesynthesis.com Thu Oct 5 04:09:27 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Do you have support for COLLADA In-Reply-To: References: Message-ID: <20061005080927.GA3637@karelia> Hi, Khronos Webmaster writes: > I saw that you are offering support for X3D with XSD. > Are you also offering support for COLLADA? Yes, XSD supports COLLADA 1.3.1 out of the box and 1.4 with some minor tweaks, please see: https://collada.org/public_forum/viewtopic.php?t=373&sid=2c85f03bb103ec08dbd20ec0534089b1 > If so I would like to list the news on the Khronos web site Thanks, that would be great! Please let me know if you would like me to sent you a short write up about the tool. Thanks, Boris From bao.young at gmail.com Thu Oct 5 22:38:41 2006 From: bao.young at gmail.com (Bao Young) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] schema with optional element in xml Message-ID: <11ae802b0610051938r6483fd45p608092c8891bee1a@mail.gmail.com> Hello, I am trying to set up a schema with optional elements in my xml file. Example of my xml file: abc 123 false def Jack 10052006 The xml file described above may have one or more element missing. ie: and are optional elements. How do I set up the schema and how do I access the field from the application? thanks, Bao From boris at codesynthesis.com Fri Oct 6 03:25:12 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] schema with optional element in xml In-Reply-To: <11ae802b0610051938r6483fd45p608092c8891bee1a@mail.gmail.com> References: <11ae802b0610051938r6483fd45p608092c8891bee1a@mail.gmail.com> Message-ID: <20061006072512.GA6177@karelia> Hi Bao, Bao Young writes: > I am trying to set up a schema with optional elements in my xml file. > Example of my xml file: > > ... > > The xml file described above may have one or more element missing. > ie: and are optional elements. > > How do I set up the schema and how do I access the field from the > application? For an introduction to XML Schema I suggest that you read some tutorials online, for example XML Schema Part 0: Primer[1], and/or buy a book on XML Schema. This mailing list is not really for teaching XML Schema basics. If you would like to use the XML Schema to C++ compiler to access the data stored in XML from your application, I suggest that you start with the C++/Tree Mapping Quick Guide[2]. [1] http://www.w3.org/TR/xmlschema-0/ [2] http://codesynthesis.com/projects/xsd/documentation/cxx/tree/quick-guide/ hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061006/e46787b6/attachment.pgp From marty at tibra.com.au Mon Oct 9 07:12:31 2006 From: marty at tibra.com.au (Martin Nickolas) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] MSVC - static variable initialisation Message-ID: <452A2E9F.6060706@tibra.com.au> Hi, I am using XSD 2.3.0 with GCC 3.4.6 and MSVC 8 and I am experiencing some differences in behaviour between the two. I think the problem is really a difference between the two compilers but perhaps someone can shed some light on things... I have a base schema (BS) with a type declared abstract, then another schema (DS) that declares a type based on that abstract type. I use XSD to generate code for each schema. I am using the --generate-polymorphic flag. The code for BS is compiled into a library (BL). When the code for DS is compiled into an exe (E1) and statically linked to BL there is no problem. But when the code for DS is compiled into a library (DL) and then another exe is created (E2) which links to both BL and DL with GCC, again, there is no problem but with MSVC the exe (E2) fails to parse valid xml files. I have been stepping through the XSD source code and generated code while running E2 and have discovered the following: - An exception of type no_type_info<> is thrown. It simple contains the message: no type information available for type '' - This exception is thrown from type_factory_map<>::find_type() as that function tries to find the factory for the derived type in DS. - It appears that XSD generated code generates a static variable of type ::xsd::cxx::tree::type_factory_initializer<> for declared types whose constructor has the job of inserting a factory for that type into type_factory_map::type_map_. So factories for all types should be installed even before main is called. - It seems that with MSVC the constructor of this static variable is never called when that var is declared in an object file build into a lib (but it is called when built into an exe). The result of this is that E2 fails to parse a valid xml file even though E1 does. Has anyone seen this problem before? Is it really conceivable that static variables aren't getting initialised in a lib? Is there a better work-around than just doing away with the libs and building all the code straight into the final exe? Thanks, CYA From boris at codesynthesis.com Mon Oct 9 15:27:36 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Re: Build Question In-Reply-To: <538118550A437B4CB2731EC25D36CBB6068C8CC2@usplm238.amer.corp.eds.com> References: <538118550A437B4CB2731EC25D36CBB6068C8CC2@usplm238.amer.corp.eds.com> Message-ID: <20061009192736.GA21088@karelia> Hi Richard, In the future please send technical questions like this to the xsd-users mailing list (which I've CC'ed) instead of to me directly. This way a) other developers who may have experienced a similar problem can provide you with a solution b) questions and answers will be archived and available to others with similar problems. Surwilo, Richard writes: > I am trying to build the hello example on a Sun box running Solaris 2.8. > I am getting the following linker errors: > > Undefined first referenced > symbol in file > __1cG__CrunKpure_error6F_v_ > ../../../../../xerces/lib/libxerces-c.so > xercesc_2_7::XMLPlatformUtils::Initialize(char const*, char const*, > xercesc_2_7::PanicHandler*, xercesc_2_7::MemoryManager*, bool)hello.o > xercesc_2_7::InputSource::setEncoding(unsigned short const*)hello.o > __1cG__CrunIex_alloc6FI_pv_ > ../../../../../xerces/lib/libxerces-c.so > xercesc_2_7::XMLUni::fgXercesSchema hello.o > __1cG__CrunIex_throw6Fpvpkn0AQstatic_type_info_pF1_v_v_ > ../../../../../xerces/lib/libxerces-c.so > xercesc_2_7::XMLUni::fgDOMDatatypeNormalization hello.o > xercesc_2_7::XMLString::release(unsigned short**)hello.o > xercesc_2_7::XMLString::release(char**)hello.o > typeinfo for xercesc_2_7::BinInputStreamhello.o > > Can you tell from these function names what lib I might be missing? I > added a search path for xerces to the supplied makefile. Are there > additional libraries I might need? Like libcult? No, you only need the Xerces-C++ library. Those symbols look like they should be resolved in the C++ runtime library supplied by the compiler. Are you using Sun CC and if so which version? The mangled names don't look like they are from GCC. Are you using the same C++ compiler to build Xerces-C++ and the example? Can you provide the exact command lines you used to configure Xerces-C++ (i.e., the one starts from runConfigure) and the one you are using to build the example? thanks, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061009/bb5795b2/attachment.pgp From boris at codesynthesis.com Mon Oct 9 16:22:26 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Re: Build Question In-Reply-To: <538118550A437B4CB2731EC25D36CBB6068C8CC3@usplm238.amer.corp.eds.com> References: <20061009192736.GA21088@karelia> <538118550A437B4CB2731EC25D36CBB6068C8CC3@usplm238.amer.corp.eds.com> Message-ID: <20061009202226.GB21088@karelia> Hi Richard, Surwilo, Richard writes: > Thanks for the timely reply. Point taken re using the mailing list in > the future. You forgot to CC your reply though ;-) > I did not build Xerces, I downloaded this pre-built library for Solaris: > > xerces-c_2_7_0-solaris_28-cc_62.tar.gz This one is built using Sun CC (presumably 6.2). > I am using gcc version 3.4.2 to compile the example: > > g++ -W -Wall -I../../../../../xerces/include -L../../../../../xerces/lib > -o driver driver.o hello.o -lxerces-c You cannot mix C++ libraries build with Sun CC and g++ - they are using different ABIs. That is why you are getting unresolved symbols. You will need to build Xerces-C++ with g++ (or find a pre-built with this compiler version). It is quite easy to build Xerces-C++ yourself. Just download and unpack the latest version (2.7.0) then do: $ cd xerces-c-src_2_7_0 $ export XERCESCROOT=`pwd` $ cd src/xercesc $ ./runConfigure -p solaris -c gcc -x g++ $ gmake The includes will be in xerces-c-src_2_7_0/include and the library will be in xerces-c-src_2_7_0/lib. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061009/5f10b156/attachment.pgp From marty at tibra.com.au Mon Oct 9 22:06:15 2006 From: marty at tibra.com.au (Martin Nickolas) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Re: MSVC - static variable initialisation In-Reply-To: <452A2E9F.6060706@tibra.com.au> References: <452A2E9F.6060706@tibra.com.au> Message-ID: <452B0017.4030903@tibra.com.au> Well, reading back over it, yesterday's post was much more complicated that it needed to be. Here is the problem explained more simply: XSD relies on the initialisation of a non-local object in each generated file to register that type with the parser. In C++ non-local objects are only guaranteed to be initialised before any function in that translation unit is called. Because I was using polymorphic types I never actually referred to my polymorphic types or functions on those types directly -- only via a pointer or a reference to the base type. So because I was never calling any functions in the translation units containing my polymorphic types the non-local object was never initialised and hence the parser failed to parse my valid xml file. GCC always seems to init all non-local objects in all translation units in either the exe or a lib. However MSVC seems to init all non-local objects in the exe, but only non-local objects in translation units in libs that also contain functions that are called directly. I suspect this *may* be legal C++. It was able to work around this problem simple by instantiating an instance of the polymorphic type declared in the generated file somewhere in the exe. Something like this: int main() { { MyPolymorphicXSDType dummy; } // run the program... return 0; } That's enough to cause the non-local object in the generated file to be initialised whether that translation unit is in the exe or the lib and built with GCC or MSVC. CYA Martin Nickolas wrote: > Hi, > > I am using XSD 2.3.0 with GCC 3.4.6 and MSVC 8 and I am experiencing > some differences in behaviour between the two. I think the problem is > really a difference between the two compilers but perhaps someone can > shed some light on things... > > I have a base schema (BS) with a type declared abstract, then another > schema (DS) that declares a type based on that abstract type. > > I use XSD to generate code for each schema. I am using the > --generate-polymorphic flag. > > The code for BS is compiled into a library (BL). > When the code for DS is compiled into an exe (E1) and statically > linked to BL there is no problem. > But when the code for DS is compiled into a library (DL) and then > another exe is created (E2) which links to both BL and DL with GCC, > again, there is no problem but with MSVC the exe (E2) fails to parse > valid xml files. > > I have been stepping through the XSD source code and generated code > while running E2 and have discovered the following: > - An exception of type no_type_info<> is thrown. It simple contains > the message: > no type information available for type '' > - This exception is thrown from type_factory_map<>::find_type() as > that function tries to find the factory for the derived type in DS. > - It appears that XSD generated code generates a static variable of > type ::xsd::cxx::tree::type_factory_initializer<> for declared types > whose constructor has the job of inserting a factory for that type > into type_factory_map::type_map_. So factories for all types should be > installed even before main is called. > - It seems that with MSVC the constructor of this static variable is > never called when that var is declared in an object file build into a > lib (but it is called when built into an exe). > > The result of this is that E2 fails to parse a valid xml file even > though E1 does. > > Has anyone seen this problem before? Is it really conceivable that > static variables aren't getting initialised in a lib? Is there a > better work-around than just doing away with the libs and building all > the code straight into the final exe? > > Thanks, > > CYA > > From boris at codesynthesis.com Tue Oct 10 02:10:32 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Re: MSVC - static variable initialisation In-Reply-To: <452B0017.4030903@tibra.com.au> References: <452A2E9F.6060706@tibra.com.au> <452B0017.4030903@tibra.com.au> Message-ID: <20061010061032.GA434@karelia> Hi Martin, Martin Nickolas writes: > Here is the problem explained more simply: > > XSD relies on the initialisation of a non-local object in each generated > file to register that type with the parser. > In C++ non-local objects are only guaranteed to be initialised before > any function in that translation unit is called. > Because I was using polymorphic types I never actually referred to my > polymorphic types or functions on those types directly -- only via a > pointer or a reference to the base type. So because I was never calling > any functions in the translation units containing my polymorphic types > the non-local object was never initialised and hence the parser failed > to parse my valid xml file. > GCC always seems to init all non-local objects in all translation units > in either the exe or a lib. However MSVC seems to init all non-local > objects in the exe, but only non-local objects in translation units in > libs that also contain functions that are called directly. I suspect > this *may* be legal C++. > > It was able to work around this problem simple by instantiating an > instance of the polymorphic type declared in the generated file > somewhere in the exe. Something like this: > int main() > { > { > MyPolymorphicXSDType dummy; > } > > // run the program... > return 0; > } > That's enough to cause the non-local object in the generated file to be > initialised whether that translation unit is in the exe or the lib and > built with GCC or MSVC. I was under the impression that you are building dynamic libraries on Windows and was going to investigate this further. But now it is clear that you are using static libraries and the behavior you've described is exactly what happens. MS link editor will only link in a translation unit from a static library if you are referencing a symbol from that translation unit. Otherwise it is ignored. Note that some link-editors on UNIX platforms may exhibit the same behavior (I guess they've fixed it in GNU binutils). I cannot see off the top of my head what can be done in the generated code to resolve this automatically. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061010/b9b4e5c9/attachment.pgp From boris at codesynthesis.com Sat Oct 14 12:29:25 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] XSD 2.3.1.b1 released Message-ID: <20061014162925.GC9674@karelia> Hi, Since the XSD release cycle have now become 2-3 months, we would like to start putting out beta releases in between. The major differences between a stable release and a beta are as follows: * beta is available only for most used platforms, at the moment being GNU/Linux (x86 and x86-64) and Windows (x86) * beta is less thoroughly tested, especially with regards to older and less used C++ compilers To start this process we've released 2.3.1.b1 which is the first beta release for the upcoming 2.3.1 maintenance release. The NEWS file entries so far are as follows: C++/Tree * The --parts option has been improved to split generated code more evenly by analyzing the complexity of the generated schema constructs. * Number of bug fixes. C++/Parser * Number of bug fixes, mostly in the generated validation code. Thanks to the following individuals for reporting bugs, suggesting fixes and improvements: Deane Yang Raul Huertas Patrick Shinpaugh Jason Wang Martin Nickolas Greg Carter Lixuesong Precompiled binary distributions are available from the product's download page: http://www.codesynthesis.com/products/xsd/download.xhtml Source code for this release is available from the project's web page: http://www.codesynthesis.com/projects/xsd/ SHA1 checksums for the files: 6a0b43141c28db2f233ac06c8a305a8f8a505c36 xsd-2.3.1.b1.tar.bz2 8e3ef983ccb98618ff32090097f83f6617b9e878 xsd-2.3.1.b1-i686-linux-gnu.tar.bz2 e215dffd2f0e0bf7feb129160c56e97a08aa94b0 xsd-2.3.1.b1-x86_64-linux-gnu.tar.bz2 1f2c178bbcd475455e174e65c0215d4fa6d6ca22 xsd-2.3.1.b1-i686-windows.zip Have fun, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061014/0d08481f/attachment.pgp From jorgemiguelsousa at gmail.com Tue Oct 17 11:15:06 2006 From: jorgemiguelsousa at gmail.com (Jorge Sousa) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] XSD Deploy to itanium 64 Message-ID: <12e8dc7c0610170815o5015083dx35186a35af3b92b@mail.gmail.com> I there, I would like to know if is in XSD road map to launch a deploy to IA (32/64) using icpc. Regards, Jorge Sousa From boris at codesynthesis.com Tue Oct 17 11:50:37 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] XSD Deploy to itanium 64 In-Reply-To: <12e8dc7c0610170815o5015083dx35186a35af3b92b@mail.gmail.com> References: <12e8dc7c0610170815o5015083dx35186a35af3b92b@mail.gmail.com> Message-ID: <20061017155037.GB24788@karelia> Hi Jorge, Jorge Sousa writes: > I there, I would like to know if is in XSD road map to launch a deploy > to IA (32/64) using icpc. I assume you are interested in deploying XSD-based application to GNU/Linux on IA-64 and your application is built with Intel C++ (icpc). I don't see why we won't be able to support XSD on IA-64 with Intel C++ since we are already supporting Intel C++ on IA-32 and EMT64. If you are interested, we can build you XSD binary for GNU/Linux on IA-64. For that we will need to know which distribution you are planning to use as well as the version of Intel C++. Regards, Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061017/7613eefa/attachment.pgp From boris at codesynthesis.com Wed Oct 18 04:08:17 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] XSD benchmarked against validating XML parsers Message-ID: <20061018080817.GB26762@karelia> Hi, We've released XSDBench which is an open-source W3C XML Schema benchmark that compares the performance of validating XML parsers. It measures validation throughput, statically-linked test executable size, and, where possible, peak heap and stack memory usage during parsing. The results are quite interesting: XSD-generated C++/Parser mapping is between 2 to 10 times faster than general-purpose validating parsers while maintaining the lowest static footprint as well as the heap and stack usage. Results for the following platforms and compilers are available: - GNU/Linux on AMD Opteron 244 with GCC 4.1.2 - Windows on Intel Pentium 3 with VC++ 7.1 - GNU/Linux on Intel Pentium 3 with Intel C/C++ 9.1 - GNU/Linux on IBM PowerPC 970MP with IBM XML C/C++ 8.0 More information on the benchmark architecture, results, as well as the benchmark source code are available from the XSDBench home page: http://www.codesynthesis.com/projects/xsdbench/ Regards, Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061018/809aafad/attachment.pgp From boris at codesynthesis.com Wed Oct 18 10:47:43 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Re: Help me please - CodeSynthesis XSD In-Reply-To: <229d1dee0610180453u591f66e1vfc3098435ab7fb30@mail.gmail.com> References: <229d1dee0610180453u591f66e1vfc3098435ab7fb30@mail.gmail.com> Message-ID: <20061018144743.GH27505@karelia> Cl?udio, In the future please send technical questions like this to the xsd-users mailing list (which I've CC'ed) instead of to me directly. This way a) other developers who may have experienced a similar problem can provide you with a solution b) questions and answers will be archived and available to others with similar problems. Cl?udio Margulhano writes: > I'm try to use CodeSynthesis XSD in my application to read a XML file but > with no sucess. > Can you help me, please? > This code allways prints the value 1 at console. What's wrong? > > std::auto_ptr c (config (argv[1])); > for (config_type::module::const_iterator i (c->module ().begin ()); i != > c->module ().end (); ++i) > { > cerr << i->name() << endl; > } > > ... > > > > > > > The 'name' attribute in 'module_type' is optional. As a result XSD-generated code returns a container for it instead of the object itself (since it may or may not be present). You can read more about this in the Section 2.8.2, "Mapping for Members with the Optional Cardinality Class" of the C++/Tree mapping manual[1]. To fix this your code you can do two things: 1. Make the 'name' attribute required (add the use="required" attribute). This is probably a good idea in your situation. 2. Change your code to test for presence and extract the actual value: if (i->name ().present ()) cerr << i->name ().get () << endl; [1] http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.8.2 hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061018/bbd85d90/attachment.pgp From cmargulhano at gmail.com Wed Oct 18 13:56:45 2006 From: cmargulhano at gmail.com (=?ISO-8859-1?Q?Cl=E1udio_Margulhano?=) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Re: Help me please - CodeSynthesis XSD In-Reply-To: <20061018144743.GH27505@karelia> References: <229d1dee0610180453u591f66e1vfc3098435ab7fb30@mail.gmail.com> <20061018144743.GH27505@karelia> Message-ID: <229d1dee0610181056q37f45828g4b54b2e1cbbeb7f4@mail.gmail.com> Boris, Thanks a lot. Very good work your library, congratulations!!! Best regards, Cl?udio 2006/10/18, Boris Kolpackov : > > Cl?udio, > > In the future please send technical questions like this to the > xsd-users mailing list (which I've CC'ed) instead of to me directly. > This way a) other developers who may have experienced a similar > problem can provide you with a solution b) questions and answers > will be archived and available to others with similar problems. > > Cl?udio Margulhano writes: > > > > I'm try to use CodeSynthesis XSD in my application to read a XML file > but > > with no sucess. > > Can you help me, please? > > This code allways prints the value 1 at console. What's wrong? > > > > std::auto_ptr c (config (argv[1])); > > for (config_type::module::const_iterator i (c->module ().begin ()); i > != > > c->module ().end (); ++i) > > { > > cerr << i->name() << endl; > > } > > > > ... > > > > > > > > maxOccurs="unbounded" minOccurs="1"> > > > > > > > > > The 'name' attribute in 'module_type' is optional. As a result > XSD-generated > code returns a container for it instead of the object itself (since it may > or may not be present). You can read more about this in the Section 2.8.2, > "Mapping for Members with the Optional Cardinality Class" of the C++/Tree > mapping manual[1]. > > To fix this your code you can do two things: > > 1. Make the 'name' attribute required (add the use="required" attribute). > This is probably a good idea in your situation. > > 2. Change your code to test for presence and extract the actual value: > > if (i->name ().present ()) > cerr << i->name ().get () << endl; > > > > [1] > http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.8.2 > > hth, > -boris > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.5 (GNU/Linux) > > iQGVAwUBRTY+j8iAKQuuCE8dAQJZTgwAs4VcInA02o7cqZu7t5UDRhqzvyEZRwuc > mkX1Tnkt5pLE41eiyEAWyyobQH8sBhvQHfk492OWa0UH0aRkTMXMpv+vdQfiRkKX > 1lUWMcdcDnids15RxlqFFexwTQqWMVQOIOwL1HCkQS0VumD0ZVnv6HT0U5sityWQ > uYrNKJkQ8t+dQh7xSuNh1r6Fq/4J7BG8jv2dwBRd//kba3+qvWsg1meUvwq8CIp8 > nAKrjOutnl/eqwIVqvHtiIcRFG7d4Am8J6q1kvnrZeszGAIKxvJsQFb6Nby2eZOX > a3hVbmivMFGHaZi2BMLC4rUoYwj2FKNGa6HT5kI5vAEJF2YzMQUIeKL/nC/89gVV > 9BqI+ODmdgsbEqC7sCzgol1y8/JrfDiVrJ5dC3SVZCdPJpDqU9aTaNbf1fzdQXf/ > iVx9jWLH1OPSAv6DE3w6ABeXiNfr0YbM+OmTnde19TPKR/pfxiiaogUi6eBBEpnL > Za1QV7ui/IkfSqkkoohpIb6y0uFP8YKI > =5b2U > -----END PGP SIGNATURE----- > > > From Robert.Boucher at ca.com Fri Oct 20 14:49:12 2006 From: Robert.Boucher at ca.com (Boucher, Robert J) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] C++/Parser: string extension Message-ID: <5E0A26D7F3D1264085CCAFFD111C866801AB16A1@USILMS14.ca.com> Hello! I have encountered difficulty in correctly using XSD for parsing a schema that extends the built-in string data type. For example, I replaced the type of the element "name" in the hello.xsd sample with "stringWithType" which simply adds an attribute "type". When I try to create a parser using this schema, and implement the parser for stringWithType, I can capture the type value, when present, but I cannot capture the value of the actual element. On the otherhand, if I configure the hello_type to use the standard string parser for stringWithType, I get the value but obviously not the attribute. xsi:noNamespaceSchemaLocation="hello.xsd"> Hello sun moon world Is there a way to implement stringWithType to capture both the value and the type? I tried subclassing the template, but without success. Hopefully the solution may be obvious for someone out there. Thank you very much for your assistance, Robert Boucher From boris at codesynthesis.com Mon Oct 23 03:01:52 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] C++/Parser: string extension In-Reply-To: <5E0A26D7F3D1264085CCAFFD111C866801AB16A1@USILMS14.ca.com> References: <5E0A26D7F3D1264085CCAFFD111C866801AB16A1@USILMS14.ca.com> Message-ID: <20061023070152.GA11141@karelia> Hi Robert, Boucher, Robert J writes: > I have encountered difficulty in correctly using XSD for parsing a > schema that extends the built-in string data type. For example, I > replaced the type of the element "name" in the hello.xsd sample with > "stringWithType" which simply adds an attribute "type". > > ... > > > > > > > > > > ... > > When I try to create a parser using this schema, and implement the > parser for stringWithType, I can capture the type value, when present, > but I cannot capture the value of the actual element. On the otherhand, > if I configure the hello_type to use the standard string parser for > stringWithType, I get the value but obviously not the attribute. The way to implement a parser for this type is to derive from the standard string parser. It also gets a bit tricky because the return types of the base parser (xml_schema::string) and the derived one are not covariant. Because of that we will need to do it in two steps: in the first step we 'rename' one of the post functions: struct stringWithTypeParserBase: stringWithType // type { virtual myStringWithType post_string_with_type () = 0; virtual myStringWithType post () { return post_string_with_type (); } }; Here stringWithType is the generated parser template and myStringWithType is a type that captures the result of parsing; you can use 'void' instead of it if you are not returning anything. The second step is to implement the parser itself: struct stringWithTypeParser: stringWithTypeParserBase, xml_schema::string { virtual void pre () { xml_schema::string::pre (); type_.clear (); } virtual void type (const std::string& t) { type_ = t; } virtual myStringWithType post_string_with_type () { return myStringWithType (xml_schema::string::post (), type_); } private: std::string type_; }; The reason why we need this two steps is because if we were to override the post() member function in stringWithTypeParser we would end up with a conflict because there are two virtual functions that can be overridden: one from stringWithType with signature: myStringWithType post (); And the other is from xml_schema::string with signature: std::string post (); Since their return types are not covariant we cannot override both of them with one function. There is the mix-in example in the examples/cxx/parser directory which shows various methods of re-using parsers via derivation, including this one. Also this technique is used in the library example where the title type is derived from string and also has the lang attribute. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061023/52d80066/attachment.pgp From boris at codesynthesis.com Mon Oct 23 07:19:16 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] xsd-2.3.1.b1-ia64-linux-gnu released Message-ID: <20061023111916.GA11882@karelia> Hi, We've released a precompiled binary of XSD 2.3.1.b1 for GNU/Linux on IA-64 (Intel Itanium processor family). It was tested on Red Hat AS 4 and SUSE ES 9 with various versions of GNU g++ and Intel C++. It should also work on Red Hat AS 3. The binary can be downloaded from the usual place: http://www.codesynthesis.com/products/xsd/download.xhtml The SHA1 checksum for the file is as follows: 537acb13f4bb1d7f98e6b7dfc42541d575a9c867 xsd-2.3.1.b1-ia64-linux-gnu.tar.bz2 Have fun, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061023/ca25be58/attachment.pgp From cmargulhano at gmail.com Mon Oct 23 08:09:16 2006 From: cmargulhano at gmail.com (=?ISO-8859-1?Q?Cl=E1udio_Margulhano?=) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Serialize a xml whitout the attributes xmlns, xmlns:xsi and xsi:schemaLocation Message-ID: <229d1dee0610230509o1946514duceb793664e476e13@mail.gmail.com> Hi, I'm begginer with this powerfull tool ... I have a problem ... Is there one way to serialize a xml whitout the attributes xmlns, xmlns:xsi and xsi:schemaLocation? Thanks, Cl?udio 2 3 4 From boris at codesynthesis.com Mon Oct 23 08:41:30 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Serialize a xml whitout the attributes xmlns, xmlns:xsi and xsi:schemaLocation In-Reply-To: <229d1dee0610230509o1946514duceb793664e476e13@mail.gmail.com> References: <229d1dee0610230509o1946514duceb793664e476e13@mail.gmail.com> Message-ID: <20061023124130.GD11882@karelia> Hi Cl?udio, Cl?udio Margulhano writes: > Is there one way to serialize a xml whitout the attributes xmlns, xmlns:xsi > and xsi:schemaLocation? > > ... > > You can get rid of xmlns:xsi and xsi:schemaLocation by not providing schema location in the namespace infomap. E.g., change the following code: xml_schema::namespace_infomap map; map[""].name = "http://www.example.org/logevents"; map[""].schema = "logger.xsd"; message (..., map); to read: xml_schema::namespace_infomap map; map[""].name = "http://www.example.org/logevents"; message (..., map); You cannot get rid of xmlns="http://www.example.org/logevents" if your schema uses XML namespaces (e.g., has targetNamespace attribute in the xsd:schema root). So you will have to change your schema fist and then you can use the empty namespace infomap: xml_schema::namespace_infomap map; message (..., map); hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061023/c325e1e8/attachment.pgp From cmargulhano at gmail.com Mon Oct 23 09:04:58 2006 From: cmargulhano at gmail.com (=?ISO-8859-1?Q?Cl=E1udio_Margulhano?=) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Serialize a xml whitout the attributes xmlns, xmlns:xsi and xsi:schemaLocation In-Reply-To: <20061023124130.GD11882@karelia> References: <229d1dee0610230509o1946514duceb793664e476e13@mail.gmail.com> <20061023124130.GD11882@karelia> Message-ID: <229d1dee0610230604w59c0bd0eicdd4d52ee0e62594@mail.gmail.com> Hi Boris, I really appreciate this powerfull tool. Thank you again! Best regards, Cl?udio 2006/10/23, Boris Kolpackov : > > Hi Cl?udio, > > Cl?udio Margulhano writes: > > > Is there one way to serialize a xml whitout the attributes xmlns, > xmlns:xsi > > and xsi:schemaLocation? > > > > ... > > > > > > You can get rid of xmlns:xsi and xsi:schemaLocation by not providing > schema > location in the namespace infomap. E.g., change the following code: > > > xml_schema::namespace_infomap map; > > map[""].name = "http://www.example.org/logevents"; > map[""].schema = "logger.xsd"; > > message (..., map); > > > to read: > > > xml_schema::namespace_infomap map; > > map[""].name = "http://www.example.org/logevents"; > > message (..., map); > > > You cannot get rid of xmlns="http://www.example.org/logevents" if your > schema uses XML namespaces (e.g., has targetNamespace attribute in the > xsd:schema root). So you will have to change your schema fist and then > you can use the empty namespace infomap: > > > xml_schema::namespace_infomap map; > > message (..., map); > > > hth, > -boris > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.5 (GNU/Linux) > > iQGVAwUBRTy4esiAKQuuCE8dAQJNfQwA081Io68VP2bo6vvAddd27ZpPt1POC34R > 8GvPRRU70GbDOoUyN2RFuYg2vQL3YBuBRApcvCPb/a09BGgp91ZmTAGF+lx8EG/G > tG4x2h0S7zSQwAHp54NvAm+cx3CJNPTwfrWZXTip7YkynHywfV2030vb1rOr9/mR > SAhGlJQMAgDw+y2L1V1/8SXlqDZj3fMkqUejkOGWVqF9PJIvbNCHB0ifm22nsFsK > cKRfqxXdTLMn/NKLRNmpJhSbuxWFXeMyuAPUn3qst9dpr1VEHgBYojgfx0bYUrHS > Ua+bO8dcBd0D0pqVFdpfoV5WeMPFoDVkNbPlBwmz3OtL2K6uLlWUZii3P/wIAck0 > JkLAIIVvLRWoIanQvdPd7WkF8SReg2mzDypg1eBwQ8iRH07e1CPhyqv6SZo+z+fY > xGO56/pHb8bUHzT68MLhNhpVlmp89jQS6oIHwCP2Sd35I7CgAlSEBgJLz/GUoa8j > 5s9g2rZGLjr8M2IwaujCv642evYzXsQ7 > =67xe > -----END PGP SIGNATURE----- > > > From cmargulhano at gmail.com Mon Oct 23 13:54:20 2006 From: cmargulhano at gmail.com (=?ISO-8859-1?Q?Cl=E1udio_Margulhano?=) Date: Sun Oct 11 15:33:49 2009 Subject: [xsd-users] Serialize - Sets the position of the put pointer Message-ID: <229d1dee0610231054nc1f84ycd697cb060059fd1@mail.gmail.com> Hi, Can I set the position of the put pointer before writes on the stream? For example: std::ofstream ofsXML; ofsXML.open ("out.xml", ofstream::out | ofstream::app | ofstream::ate); ofsXML.seekp(ofsXML.tellp()-10, ios::cur); message_type msg = message_type(string(getDateTime()), string(cKey), string(cLevel), string(loggerEvent->LoggerMessageContent)); message(ofsXML, msg, map, "UTF-8", xml_schema::flags::dont_initialize); Thanks, Cl?udio From boris at codesynthesis.com Tue Oct 24 01:35:24 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] Serialize - Sets the position of the put pointer In-Reply-To: <229d1dee0610231054nc1f84ycd697cb060059fd1@mail.gmail.com> References: <229d1dee0610231054nc1f84ycd697cb060059fd1@mail.gmail.com> Message-ID: <20061024053524.GA15245@karelia> Hi Cl?udio, Cl?udio Margulhano writes: > Can I set the position of the put pointer before writes on the stream? Yes, it should be possible. Isn't it working? If not then it would be helpful to know exactly what goes wrong; even more helpful would be a small example that reproduces the problem. You may also be interested in the xml_schema::flags::no_xml_declaration flag which prevents the XML declaration (e.g., ) from being generated. It is usually useful when you want to produce an XML fragment instead of a complete XML document. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061024/6960a884/attachment.pgp From cmargulhano at gmail.com Tue Oct 24 08:23:46 2006 From: cmargulhano at gmail.com (=?ISO-8859-1?Q?Cl=E1udio_Margulhano?=) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] Serialize - Sets the position of the put pointer In-Reply-To: <20061024053524.GA15245@karelia> References: <229d1dee0610231054nc1f84ycd697cb060059fd1@mail.gmail.com> <20061024053524.GA15245@karelia> Message-ID: <229d1dee0610240523q121e4482nb49a7914775d3eb1@mail.gmail.com> Dear Boris, Doesn't work fine but I change my code to use the cointainer type. I think that should be better this technique ratter than another one. I solve the problem with this technique. Thank you very much. Best regards, Cl?udio 2006/10/24, Boris Kolpackov : > > Hi Cl?udio, > > Cl?udio Margulhano writes: > > > > Can I set the position of the put pointer before writes on the stream? > > Yes, it should be possible. Isn't it working? If not then it would be > helpful to know exactly what goes wrong; even more helpful would be a > small example that reproduces the problem. > > You may also be interested in the xml_schema::flags::no_xml_declaration > flag which prevents the XML declaration (e.g., ) > from being generated. It is usually useful when you want to produce an > XML fragment instead of a complete XML document. > > > hth, > -boris > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.5 (GNU/Linux) > > iQGVAwUBRT2mG8iAKQuuCE8dAQLk3wv/dBZnplY5aXuhpCEYEruxIs1QBhUoP+Bc > qR9M+RyGSCos2sVeSMJxlImxAdbDU0jj29AodeiNWlTcjkE3MZREFwHz3C0N0iGH > /ff8gkRQVhdJWOiydKBkU5vfsGAiF46+W+MrUvAcnqPDgeOBNc0eOCkq3dUuwvjo > 0TzRhCiNasI/jEULVDSaFJHmhYrC008BHWGRINVSLcD013TyAWWSJtJ6Gma92e4f > EmZfw7PUdqTKBeUR1y9QhQNYIvy5wYXOq2+5jbqmClc8xZ92LpUMfiEUMwy/hG+H > EGSfFH5ECY7RR0ZzrD64VWfRWTyTQDdqnynjTz3G/qkp8zxmUK+Y51q2i2J19h63 > +3ou9jeY+rPvYLRuce8mQ/MqPAk9jCRDeELiNvZAM4pR+sNAK8wXI14d13ak0jHw > X/mSFVjPRz9bX04ray30Z3dVQYwvRzrFcJUFGMtV/ShPfDg9nabnSvbGyXbYorAu > HZslzRDYuGh7n0519Pr70rdWTw1bS5GH > =mfSm > -----END PGP SIGNATURE----- > > > From boris at codesynthesis.com Thu Oct 26 05:39:03 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] Re: compile errors In-Reply-To: <93DB4F655FC503459A92795214BEA61801F578@ips-e2k.ips.ad.local> References: <93DB4F655FC503459A92795214BEA61801F578@ips-e2k.ips.ad.local> Message-ID: <20061026093903.GA25353@karelia> Hi Dave, In the future please send technical questions like this to the xsd-users mailing list (which I've CC'ed) instead of to me directly. This way a) other developers who may have experienced a similar problem can provide you with a solution b) questions and answers will be archived and available to others with similar problems. dave.keezer@l-3com.com writes: > I am trying to use XSD to create C++ classes that I can use in Borland > C++ Builder ver 5. > > I run XSD and create the .hxx and .cxx files. I then try to compile a > test program that includes the .hxx. > > > I get many errors. Do you know if this can be made to work in Borland > C++ Builder? Borland C++ has a very poor support for the C++ standard which makes it impossible for us to support XSD on this compiler. Sorry. If you don't mind changing the compiler, you can get free (as in no cost) Visual C++ 2005 Express Edition: http://msdn.microsoft.com/vstudio/express/ XSD is regularly tested and is known to work with this compiler. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061026/bfe47d6e/attachment.pgp From Remsy.Schmilinsky at ccra-adrc.gc.ca Thu Oct 26 13:28:11 2006 From: Remsy.Schmilinsky at ccra-adrc.gc.ca (Schmilinsky, Remsy) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] parsing file with complete path Message-ID: Hi. I have a function the includes the following line: std::auto_ptr q(query::queries_(dataFile.c_str())); where dataFile is the file to be parsed it works fine if dataFile is in the same location of the compiled function, however, if dataFile is a path like this ./examples/query.xml, the parsing fails: Debugging LibraryUtil::extractQuery, calling auto_ptr on dataFile: ./examples/query.xml instance document parsing failed so, it doesn't like absolute paths. is this a known bug? any workaround? Maybe something wrong with the slash... thanks, remsy From Remsy.Schmilinsky at ccra-adrc.gc.ca Thu Oct 26 13:51:09 2006 From: Remsy.Schmilinsky at ccra-adrc.gc.ca (Schmilinsky, Remsy) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] parsing file with complete path In-Reply-To: Message-ID: I forgot to mention that I am using cygwin, I haven't tried on linux or mingw. I'll try on these platforms... Remsy -----Original Message----- From: xsd-users-bounces@codesynthesis.com [mailto:xsd-users-bounces@codesynthesis.com] Sent: October 26, 2006 1:28 PM To: xsd-users@codesynthesis.com Subject: [xsd-users] parsing file with complete path Hi. I have a function the includes the following line: std::auto_ptr q(query::queries_(dataFile.c_str())); where dataFile is the file to be parsed it works fine if dataFile is in the same location of the compiled function, however, if dataFile is a path like this ./examples/query.xml, the parsing fails: Debugging LibraryUtil::extractQuery, calling auto_ptr on dataFile: ./examples/query.xml instance document parsing failed so, it doesn't like absolute paths. is this a known bug? any workaround? Maybe something wrong with the slash... thanks, remsy From boris at codesynthesis.com Thu Oct 26 14:11:57 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] parsing file with complete path In-Reply-To: References: Message-ID: <20061026181157.GA26326@karelia> Hi Remsy, Schmilinsky, Remsy writes: > it works fine if dataFile is in the same location of the compiled > function, however, if dataFile is a path like this ./examples/query.xml, > the parsing fails: > > Debugging LibraryUtil::extractQuery, calling auto_ptr on dataFile: ./examples/query.xml > instance document parsing failed > > so, it doesn't like absolute paths. I am pretty sure this is due to the schema not being found when you use absolute paths. In your instance document you probably have something like this: xsi:schemaLocation="http://www.example.com/foo foo.xsd" When schema processor sees a declaration like this it will search for foo.xsd in the directory relative to the document instance, in your case this directory will be ./examples/. There are several ways to resolve this: (1) Disable validation by the underlying XML parser by passing the xml_schema::flags::dont_validate flag to one of the parsing functions, e.g.: query::queries_(dataFile.c_str(), xml_schema::flags::dont_validate) (2) Programmatically override the schema path from XML document with an absolute path. This is described in the C++/Tree Mapping FAQ #2.4: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/faq/#2.4 You may also find other questions and answers in Section 2, "Validation and Parsing" useful. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061026/df41b3b8/attachment.pgp From Remsy.Schmilinsky at ccra-adrc.gc.ca Fri Oct 27 08:06:24 2006 From: Remsy.Schmilinsky at ccra-adrc.gc.ca (Schmilinsky, Remsy) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] parsing file with complete path In-Reply-To: <20061026181157.GA26326@karelia> Message-ID: It resolved my problem, thank you. Remsy -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: October 26, 2006 2:12 PM To: Schmilinsky, Remsy Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] parsing file with complete path Hi Remsy, Schmilinsky, Remsy writes: > it works fine if dataFile is in the same location of the compiled > function, however, if dataFile is a path like this ./examples/query.xml, > the parsing fails: > > Debugging LibraryUtil::extractQuery, calling auto_ptr on dataFile: ./examples/query.xml > instance document parsing failed > > so, it doesn't like absolute paths. I am pretty sure this is due to the schema not being found when you use absolute paths. In your instance document you probably have something like this: xsi:schemaLocation="http://www.example.com/foo foo.xsd" When schema processor sees a declaration like this it will search for foo.xsd in the directory relative to the document instance, in your case this directory will be ./examples/. There are several ways to resolve this: (1) Disable validation by the underlying XML parser by passing the xml_schema::flags::dont_validate flag to one of the parsing functions, e.g.: query::queries_(dataFile.c_str(), xml_schema::flags::dont_validate) (2) Programmatically override the schema path from XML document with an absolute path. This is described in the C++/Tree Mapping FAQ #2.4: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/faq/#2. 4 You may also find other questions and answers in Section 2, "Validation and Parsing" useful. hth, -boris From shpatric at vt.edu Fri Oct 27 15:35:31 2006 From: shpatric at vt.edu (Patrick Shinpaugh) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] Load entire document Message-ID: <1161977731.8532.193.camel@pbslinux01> Hi, Is it possible to directly load an entire xml document using the generted cxx-tree? It appears as though I would need something similar to: auto_ptr t ( text_ (argv[1], xml_schema::flags::keep_dom | xml_schema::flags::dont_initialize)); but it is using a specific type whereas my xml (X3D) documents contain a multitude of different types and there isn't a single base type for which all others are derived - in the schema at least. Anything like - x3dxmldoc newdoc; x3droot = newdoc.load( "somefile.x3d" ); Any help or advice is greatly appreciated. Thanks -- Patrick Shinpaugh Virginia Tech UVAG System Administrator/Programmer 540-231-2054 From MEL at DISC.com Sat Oct 28 15:52:47 2006 From: MEL at DISC.com (Mark Lofdahl) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] hpux 11.11 basic_string abort Message-ID: Hi, I'm trying to create an object heirarchy from scratch, and then serialize that to an xml file. I'm getting strange aborts in the destructor for basic_string. The abort seems to move around - sometimes it is in the destructors for temporary basic_string objects created in the serialize functions in xsd/cxx/xml/dom/serialization.txx. Sometimes it is in the destructors for basic_string objects created by the xsd code as it fills in values for elements. Our code is compiled single-threaded, as is the xerces library we are linking to. I'm using hpux 11.11, and aCC A.03.70. Works fine on hpux 11.23 and aCC A.06.10, and all other platforms I've tried (windows, linux, sun). Below is a sample stack trace of the abort. Any ideas of why this may be happening? Program terminated with signal 10, Bus error. BUS_UNKNOWN - Unknown Error #0 0xc003d478 in pthread_mutex_destroy+0x18 () from /usr/lib/libpthread.1 #1 0xc021c1f0 in __thread_mutex_free+0x40 () from /usr/lib/libc.2 #2 0xeb035730 in _HPMutexWrapper::~_HPMutexWrapper+0x34 () from /usr/lib/libstd_v2.2 #3 0xecaab454 in std::basic_string,std::allocator>::_C_unlink (this=0x400562b0) at /opt/aCC/include_std/string:1002 #4 0xeb2be8b4 in Omnidex::datatypeType::~datatypeType+0x78 () from /users/oadev/omnidex/lib/libodxea.sl #5 0xec77c6f4 in Omnidex::columnsType::column::_xsd_column_::column::~column +0x328 () from /users/oadev/omnidex/lib/libodxdl.sl #6 0xec77caac in Omnidex::columnsType::~columnsType+0x100 () from /users/oadev/omnidex/lib/libodxdl.sl #7 0xec779f44 in Omnidex::tablesType::table::_xsd_table_::table::~table +0x11c () from /users/oadev/omnidex/lib/libodxdl.sl #8 0xec77a504 in Omnidex::tablesType::~tablesType+0x100 () from /users/oadev/omnidex/lib/libodxdl.sl #9 0xec778374 in Omnidex::databasesType::database::_xsd_database_::database::~d atabase+0x17c () from /users/oadev/omnidex/lib/libodxdl.sl #10 0xec7787ec in Omnidex::databasesType::~databasesType+0x100 () from /users/oadev/omnidex/lib/libodxdl.sl #11 0xec777a30 in Omnidex::environmentsType::environment::_xsd_environment_::env ironment::~environment+0xd8 () from /users/oadev/omnidex/lib/libodxdl.sl #12 0xec777f10 in Omnidex::environmentsType::~environmentsType+0x100 () Mark Lofdahl Dynamic Information Systems Corporation mel@disc.com From boris at codesynthesis.com Mon Oct 30 02:12:09 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] Load entire document In-Reply-To: <1161977731.8532.193.camel@pbslinux01> References: <1161977731.8532.193.camel@pbslinux01> Message-ID: <20061030071209.GA5607@karelia> Hi Patrick, Patrick Shinpaugh writes: > Is it possible to directly load an entire xml document using the > generted cxx-tree? It appears as though I would need something similar > to: > > auto_ptr t ( > text_ (argv[1], > xml_schema::flags::keep_dom | > xml_schema::flags::dont_initialize)); > > but it is using a specific type whereas my xml (X3D) documents contain a > multitude of different types and there isn't a single base type for > which all others are derived - in the schema at least. Normally an XML document will have a distinct root element. Some vocabularies have a set of possible root elements. I assume that your case is the latter: you have an X3D document but its root element can be any element from a set of predefined root elements. This is a fairly common scenario and the way to handle this is described in the C++/Tree Mapping Wiki FAQ #2.2[1] [1] http://wiki.codesynthesis.com/Tree/FAQ hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061030/57ea4481/attachment.pgp From boris at codesynthesis.com Mon Oct 30 02:32:04 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: (forw) [xsd-users] hpux 11.11 basic_string abort Message-ID: <20061030073204.GB5607@karelia> Hi, One of our users posted the following problem report to our mailing list. The problem seems to be specific to aCC A.03.70 on HP-UX 11.11 so I was wondering if there is a known issue with this setup or if any of you have seen something similar. Of course, this could be a subtle memory corruption case that only manifests itself on this particular platform/compiler combination. Also is there a way to disable synchronization in std::basic_string for a single-threaded application? Any help would be greatly appreciated. Boris Boris Kolpackov Code Synthesis Tools CC http://www.codesynthesis.com Open-Source, Cross-Platform C++ XML Data Binding ----- Forwarded message from Mark Lofdahl ----- Hi, I'm trying to create an object heirarchy from scratch, and then serialize that to an xml file. I'm getting strange aborts in the destructor for basic_string. The abort seems to move around - sometimes it is in the destructors for temporary basic_string objects created in the serialize functions in xsd/cxx/xml/dom/serialization.txx. Sometimes it is in the destructors for basic_string objects created by the xsd code as it fills in values for elements. Our code is compiled single-threaded, as is the xerces library we are linking to. I'm using hpux 11.11, and aCC A.03.70. Works fine on hpux 11.23 and aCC A.06.10, and all other platforms I've tried (windows, linux, sun). Below is a sample stack trace of the abort. Any ideas of why this may be happening? Program terminated with signal 10, Bus error. BUS_UNKNOWN - Unknown Error #0 0xc003d478 in pthread_mutex_destroy+0x18 () from /usr/lib/libpthread.1 #1 0xc021c1f0 in __thread_mutex_free+0x40 () from /usr/lib/libc.2 #2 0xeb035730 in _HPMutexWrapper::~_HPMutexWrapper+0x34 () from /usr/lib/libstd_v2.2 #3 0xecaab454 in std::basic_string,std::allocator>::_C_unlink (this=0x400562b0) at /opt/aCC/include_std/string:1002 #4 0xeb2be8b4 in Omnidex::datatypeType::~datatypeType+0x78 () from /users/oadev/omnidex/lib/libodxea.sl #5 0xec77c6f4 in Omnidex::columnsType::column::_xsd_column_::column::~column +0x328 () from /users/oadev/omnidex/lib/libodxdl.sl #6 0xec77caac in Omnidex::columnsType::~columnsType+0x100 () from /users/oadev/omnidex/lib/libodxdl.sl #7 0xec779f44 in Omnidex::tablesType::table::_xsd_table_::table::~table +0x11c () from /users/oadev/omnidex/lib/libodxdl.sl #8 0xec77a504 in Omnidex::tablesType::~tablesType+0x100 () from /users/oadev/omnidex/lib/libodxdl.sl #9 0xec778374 in Omnidex::databasesType::database::_xsd_database_::database::~d atabase+0x17c () from /users/oadev/omnidex/lib/libodxdl.sl #10 0xec7787ec in Omnidex::databasesType::~databasesType+0x100 () from /users/oadev/omnidex/lib/libodxdl.sl #11 0xec777a30 in Omnidex::environmentsType::environment::_xsd_environment_::env ironment::~environment+0xd8 () from /users/oadev/omnidex/lib/libodxdl.sl #12 0xec777f10 in Omnidex::environmentsType::~environmentsType+0x100 () Mark Lofdahl Dynamic Information Systems Corporation mel@disc.com ----- End forwarded message ----- From boris at codesynthesis.com Mon Oct 30 15:48:33 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] XSD is used in the Galileo satellite navigation system Message-ID: <20061030204833.GB7954@karelia> Hi, I thought some of you might be interested to know that VEGA[1] has selected XSD for its Galileo Mission Segment Assembly, Integration and Verification Platform (GMS AIVP). You can read more about the Galileo Mission Segment and VEGA's AIVP in the case study[2]. [1] http://www.vega-group.com [2] http://www.vega-group.com/marketsectors/space/casestudiespace/index.asp?id=1504,445,3,446 Regards, -Boris From dhandly at cup.hp.com Mon Oct 30 22:21:09 2006 From: dhandly at cup.hp.com (Dennis Handly) Date: Sun Oct 11 15:33:50 2009 Subject: CXX-DEV: (forw) [xsd-users] hpux 11.11 basic_string abort Message-ID: <200610310321.TAA21998@hpcll183.hp.com> >From: Boris Kolpackov >One of our users posted the following problem report to our mailing >list. The problem seems to be specific to aCC A.03.70 on HP-UX 11.11 This is specific to the aC++ runtime, not the version of the aC++ compiler. If you link with libpthread.1, you must compile everything with -mt. >so I was wondering if there is a known issue with this setup Yes. http://www.docs.hp.com/en/7762/5991-4874/threads.htm Required Command-Line Options >Also is there a way to disable synchronization in std::basic_string >for a single-threaded application? Boris No. This application is NOT single-threaded if you link with libpthread.1. If you don't call pthread_create, you may want to consider stubbing out libpthread.1, if you can't remove the dependency. ----- Forwarded message from Mark Lofdahl ----- >I'm getting strange aborts in the destructor for basic_string. >Our code is compiled single-threaded, as is the xerces library we are >linking to. Who is linking in libpthread? Using chatr(1) on each shlib and the executable. >Works fine on hpux 11.23 and aCC A.06.10 I'm not sure how? >Below is a sample stack trace of the abort. >Any ideas of why this may be happening? Mark Lofdahl Did you try compiling everything with -mt? >Program terminated with signal 10, Bus error. >#0 0xc003d478 in pthread_mutex_destroy+0x18 /usr/lib/libpthread.1 >#1 0xc021c1f0 in __thread_mutex_free+0x40 /usr/lib/libc.2 >#2 0xeb035730 in _HPMutexWrapper::~_HPMutexWrapper+0x34 /usr/lib/libstd_v2.2 >#3 0xecaab454 in std::basic_string::_C_unlink at /opt/aCC/include_std/string:1002 From boris at codesynthesis.com Tue Oct 31 06:04:22 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: CXX-DEV: (forw) [xsd-users] hpux 11.11 basic_string abort In-Reply-To: <200610310321.TAA21998@hpcll183.hp.com> References: <200610310321.TAA21998@hpcll183.hp.com> Message-ID: <20061031110422.GB9855@karelia> Hi Mark, Were you able to resolve your problem based in Dennis' feedback? It seems like you need to find out who links in libpthread and get rid of that. Please let us know how it all works out. Regards, -Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061031/38f44b3e/attachment.pgp From debora.vanni at tvblob.com Tue Oct 31 09:10:34 2006 From: debora.vanni at tvblob.com (Debora Vanni) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] parsing without xsd file Message-ID: <1162303834.14455.16.camel@localhost.localdomain> Hi ! I have this problem: we have an xml message in memory(not a file) with no schemaLocation in the header. I found flags and properties, and it works but this way each time I have to load a xsd file! I thought that since I generate the code from xsd it wasn't necessary to pass the xsd again. I saw that XSD generated a private function "parse" that doesn't need xsd file but it is used only in one of the constructor of the type (hello_type in the simple example). What I need to do is: generate code from xsd(OK) parse an xml message(with no schema location) without loading the xsd file. Is there a way to do this with XSD? Thank you in advanced Debora From Remsy.Schmilinsky at ccra-adrc.gc.ca Tue Oct 31 11:51:59 2006 From: Remsy.Schmilinsky at ccra-adrc.gc.ca (Schmilinsky, Remsy) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] constructor In-Reply-To: <20061023124130.GD11882@karelia> Message-ID: Hi. I have the following schema: ...and I don't understand the generated constructors: queryResponse (const message::type&); queryResponse (const ::xercesc::DOMElement&, ::xml_schema::flags = 0, ::xml_schema::type* = 0); queryResponse (const queryResponse&, ::xml_schema::flags = 0, ::xml_schema::type* = 0); My test code is this: contacts::catalog _catalog; contacts::contact _contact("123456", "name", "email", "888-888-888"); _catalog.contact().push_back(_contact); // ERROR: inappropiate constructor query::queryResponse myQueryResponse = query::queryResponse(std::string("message"), _catalog); can you help me understand how to properly build queryResponse with the available constructors? thanks, remsy From boris at codesynthesis.com Tue Oct 31 13:29:16 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] parsing without xsd file In-Reply-To: <1162303834.14455.16.camel@localhost.localdomain> References: <1162303834.14455.16.camel@localhost.localdomain> Message-ID: <20061031182916.GA10762@karelia> Hi Debora, Debora Vanni writes: > I thought that since I generate the code from xsd it wasn't necessary to > pass the xsd again. I saw that XSD generated a private function "parse" > that doesn't need xsd file but it is used only in one of the constructor > of the type (hello_type in the simple example). > What I need to do is: > generate code from xsd(OK) > parse an xml message(with no schema location) without loading the xsd > file. > Is there a way to do this with XSD? You can disable validation in the underlying XML parser (and thus loading of the .xsd file) by passing the xml_schema::flags::dont_validate flag to one of the parsing functions. You may also be interested in related questions that are discussed in Section 2, "Validation and Parsing" of the C++/Tree Mapping FAQ: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/faq/ HTH, -Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061031/f474309c/attachment.pgp From boris at codesynthesis.com Tue Oct 31 13:49:46 2006 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] constructor In-Reply-To: References: <20061023124130.GD11882@karelia> Message-ID: <20061031184946.GB10762@karelia> Hi Remsy, Schmilinsky, Remsy writes: > > > > > > > > > > > > ...and I don't understand the generated constructors: > > queryResponse (const message::type&); This is the constructor that you would normally use to create an object from scratch. Its arguments are all required members (attributes and elements). In your case you have one required element (message) and one optional (catalog). You can read more about this constructor in Section 2.7, "Mapping for Complex Types" of the C++/Tree Mapping Manual: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.7 > queryResponse (const ::xercesc::DOMElement&, > ::xml_schema::flags = 0, > ::xml_schema::type* = 0); This is the constructor that is responsible for creating an instance from its XML representation. You would normally not use this c-tor directly though you may need to if you choose to interface with some other code that exposes its data model as Xerces-C++ DOM (e.g., the Berkeley DB XML database). > queryResponse (const queryResponse&, > ::xml_schema::flags = 0, > ::xml_schema::type* = 0); This is a copy constructor. > My test code is this: > > contacts::catalog _catalog; > contacts::contact _contact("123456", "name", "email", "888-888-888"); > _catalog.contact().push_back(_contact); > > // ERROR: inappropiate constructor > query::queryResponse myQueryResponse = query::queryResponse( > std::string("message"), _catalog); To make your code work you will need to change your last line like this: query::queryResponse myQueryResponse ("message"); myQueryResponse.catalog (_catalog); In other words you use modifier member functions to set optional members. Also note that your code is not optimal since it does quite a bit of copying which can be avoided. I would rewrite your code like this: query::queryResponse myQueryResponse ("message"); // Set to an empty container. // myQueryResponse.catalog (contacts::catalog ()); // Get a refernce to myQueryResponse's catalog container. // contacts::catalog& cr (myQueryResponse.catalog ().get ()); // Construct contact in-place. // contacts::contact _contact ("123456", "name", "email", "888-888-888"); cr.push_back (_contact); The idea is to add items to myQueryResponse's catalog in-place rather than creating them on the side and then copying to myQueryResponse. HTH, -Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061031/85213ccf/attachment.pgp From pshinpaugh at adelphia.net Tue Oct 31 22:24:07 2006 From: pshinpaugh at adelphia.net (Patrick Shinpaugh) Date: Sun Oct 11 15:33:50 2009 Subject: [xsd-users] Re: Loading URLs In-Reply-To: <1162329923.19732.162.camel@pbslinux01> References: <1161977731.8532.193.camel@pbslinux01> <20061030071209.GA5607@karelia> <1162329923.19732.162.camel@pbslinux01> Message-ID: <1162351447.19732.185.camel@pbslinux01> Hi Boris, Sorry to have sent the first email directly to you - I replied to a previous email without looking. I was able to find the answer to the second question about printing XMLCh* so please ignore that part. If you could just look at the first part concerning loading a file file from a url. Thanks On Tue, 2006-10-31 at 16:25 -0500, Patrick Shinpaugh wrote: > Hi, > I was actually wrong about the root element but the site was useful. I > have it working now except for one possible issue. I was expecting to be > able to pass a url to the root instantiation loader: > > auto_ptr inst (x3d::X3D_ (argv[1], xml_schema::flags::keep_dom > | xml_schema::flags::dont_initialize, props )); > > However, it prepends the current working directory: > > ./x3d https://someserver/file.x3d > :0:0 error: An exception occurred! Type:RuntimeException, Message:The > primary document entity could not be opened. > Id=/home/patrick/projects/x3dosg/sample_implementation/code_synthesis_xsd/cxx-tree/https://someserver/file.x3d > > Any ideas what I may be doing wrong? > > Also, a non-XSD question if you don't mind. I'm using DOMNodes to access > my tree and some of the functions I am using have a XMLCh* type > (getNodeName) - are these wide chars? If so, do you know how I might > print them? > > Thanks for all of your help, > Pat > > > On Mon, 2006-10-30 at 09:12 +0200, Boris Kolpackov wrote: > > Hi Patrick, > > > > Patrick Shinpaugh writes: > > > > > Is it possible to directly load an entire xml document using the > > > generted cxx-tree? It appears as though I would need something similar > > > to: > > > > > > auto_ptr t ( > > > text_ (argv[1], > > > xml_schema::flags::keep_dom | > > > xml_schema::flags::dont_initialize)); > > > > > > but it is using a specific type whereas my xml (X3D) documents contain a > > > multitude of different types and there isn't a single base type for > > > which all others are derived - in the schema at least. > > > > Normally an XML document will have a distinct root element. Some vocabularies > > have a set of possible root elements. I assume that your case is the latter: > > you have an X3D document but its root element can be any element from a > > set of predefined root elements. This is a fairly common scenario and the > > way to handle this is described in the C++/Tree Mapping Wiki FAQ #2.2[1] > > > > > > [1] http://wiki.codesynthesis.com/Tree/FAQ > > > > > > hth, > > -boris