From isharp at atis.org Thu Feb 1 08:39:31 2018 From: isharp at atis.org (Iain Sharp) Date: Thu Feb 1 08:40:45 2018 Subject: [xsd-users] Relating XSD identifiers to C++ identifiers Message-ID: Hi Folks, I am working on a committee-defined set of XSDs that have a complicated structure which means that various special cases occur when CodeSynthesis Tree chooses the identifiers to use in its object model. So I can automate some higher layer code generation I would like to have a machine readable map between the elements and identifiers used in the XSD and the corresponding identifiers in the C++ object model. Is there an easy way to generate this information? At the moment it looks like parsing the DOXYGEN comments in the output .hxx files might be the simplest approach. Regards Iain From boris at codesynthesis.com Fri Feb 2 09:29:24 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 2 09:30:22 2018 Subject: [xsd-users] Relating XSD identifiers to C++ identifiers In-Reply-To: References: Message-ID: Iain Sharp writes: > I am working on a committee-defined set of XSDs that have a complicated > structure which means that various special cases occur when CodeSynthesis > Tree chooses the identifiers to use in its object model. So I can automate > some higher layer code generation I would like to have a machine readable > map between the elements and identifiers used in the XSD and the > corresponding identifiers in the C++ object model. > > Is there an easy way to generate this information? You could probably extract this information from the --name-regex-trace option output. See the NAMING CONVENTION section in the xsd man page for details. Boris From isharp at atis.org Fri Feb 9 06:24:15 2018 From: isharp at atis.org (Iain Sharp) Date: Fri Feb 9 06:25:49 2018 Subject: [xsd-users] Relating XSD identifiers to C++ identifiers In-Reply-To: References: Message-ID: One thing I do note in this context - some of the doxygen comments generated by CS are rather misleading. For example, I have a class called "announcedAttribute1", with the description "Class corresponding to the announcedAttribute1 schema type.", but there is no schema type "announcedAttribute1", this is a name assigned by CS to a schema type called "announcedAttribute". I also have a similar description for "announcedAttribute1_base" which appears because "announcedAttribute1" is a list. Regards Iain -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 02 February 2018 14:29 To: Iain Sharp Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Relating XSD identifiers to C++ identifiers Iain Sharp writes: > I am working on a committee-defined set of XSDs that have a > complicated structure which means that various special cases occur > when CodeSynthesis Tree chooses the identifiers to use in its object > model. So I can automate some higher layer code generation I would > like to have a machine readable map between the elements and > identifiers used in the XSD and the corresponding identifiers in the C++ object model. > > Is there an easy way to generate this information? You could probably extract this information from the --name-regex-trace option output. See the NAMING CONVENTION section in the xsd man page for details. Boris From boris at codesynthesis.com Fri Feb 9 08:25:44 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 9 08:27:04 2018 Subject: [xsd-users] Relating XSD identifiers to C++ identifiers In-Reply-To: References: Message-ID: Iain Sharp writes: > One thing I do note in this context - some of the doxygen comments > generated by CS are rather misleading. For example, I have a class > called "announcedAttribute1", with the description "Class corresponding > to the announcedAttribute1 schema type.", but there is no schema type > "announcedAttribute1", this is a name assigned by CS to a schema type > called "announcedAttribute". Are you sure it is not a name assigned to an anonymous type of attribute announcedAttribute that was clashing with real/another announcedAttribute? If the answer is "no", then can you send a small test schema that reproduces the problem? Boris From jumdeharsha72 at gmail.com Fri Feb 9 07:28:54 2018 From: jumdeharsha72 at gmail.com (Harsha Jumde) Date: Fri Feb 9 08:28:19 2018 Subject: [xsd-users] Xsd to c++ conversion giving error Message-ID: Hi, I am trying to execute xsd cxx-tree command to convert xsd to c++ classes. But it is giving error "error: 'xml.xsd': unable to open in read mode" Please help me to resolve error. Thanks From isharp at atis.org Fri Feb 9 08:33:33 2018 From: isharp at atis.org (Iain Sharp) Date: Fri Feb 9 08:34:57 2018 Subject: [xsd-users] Relating XSD identifiers to C++ identifiers In-Reply-To: References: Message-ID: Yes, this is exactly what it is. The code and naming is correct (according to the defined behaviour of CS), but my point is that the description in doxygen says something different from what CS has actually done, especially in terms of how it relates to the original schema. A more accurate description of the class would be: "Class corresponding to the instance of an anonymous type of attribute announcedAttribute in schema type blahBlahBlah." Regards Iain -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 09 February 2018 13:26 To: Iain Sharp Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Relating XSD identifiers to C++ identifiers Iain Sharp writes: > One thing I do note in this context - some of the doxygen comments > generated by CS are rather misleading. For example, I have a class > called "announcedAttribute1", with the description "Class > corresponding to the announcedAttribute1 schema type.", but there is > no schema type "announcedAttribute1", this is a name assigned by CS to > a schema type called "announcedAttribute". Are you sure it is not a name assigned to an anonymous type of attribute announcedAttribute that was clashing with real/another announcedAttribute? If the answer is "no", then can you send a small test schema that reproduces the problem? Boris From ben at nebland.com Sun Feb 11 20:47:00 2018 From: ben at nebland.com (Benjamin DuPont) Date: Sun Feb 11 20:48:38 2018 Subject: [xsd-users] substitution groups in Windows Message-ID: Using code generated from the OpenADR xml schemas, I'm seeing different results on Windows and Linux when in elements where substitution groups are used. In Windows, the following is generated: In Linux, the following is generated: The substitution group is named itemBase. Changing the substitution group to a choice fixes the issue, but I'd rather not modify the XSDs.? I suspect that both are valid but the XML must match the second form. -- Ben DuPont Owner/Operator nebland software, LLC ben@nebland.com | (920)328-5236 www.nebland.com From boris at codesynthesis.com Tue Feb 13 08:54:16 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 13 08:55:49 2018 Subject: [xsd-users] substitution groups in Windows In-Reply-To: References: Message-ID: Benjamin DuPont writes: > In Windows, the following is generated: > > xmlns:p7="http://docs.oasis-open.org/ns/emix/2011/06/siscale" > xsi:type="p6:EnergyRealType"> > > In Linux, the following is generated: > > xmlns:p6="http://docs.oasis-open.org/ns/emix/2011/06/siscale"> It looks like the substitution group map in the generated code is for some reason not linked into your Windows build (and so the generated code falls back to xsi:type). Can you check that all the generated source files are included into your Windows build? Also, if you are using static libraries, take a look at this post: http://www.codesynthesis.com/pipermail/odb-users/2013-May/001289.html Boris From boris at codesynthesis.com Tue Feb 13 09:02:10 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 13 09:03:42 2018 Subject: [xsd-users] Relating XSD identifiers to C++ identifiers In-Reply-To: References: Message-ID: Iain Sharp writes: > Yes, this is exactly what it is. The code and naming is correct (according > to the defined behaviour of CS), but my point is that the description in > doxygen says something different from what CS has actually done, especially > in terms of how it relates to the original schema. > > A more accurate description of the class would be: > > "Class corresponding to the instance of an anonymous type of attribute > announcedAttribute in schema type blahBlahBlah." Yes, and it would have been even better if there were no schemas with anonymous types. But some people believe such schemas are "good enough". For such schemas (and such people) we do a transformation pass before code generation and assign names to all anonymous types. While this looses the information that you are looking for, we call it "good enough". And I think that's fair. Boris From micder74 at gmail.com Fri Feb 16 08:16:03 2018 From: micder74 at gmail.com (Michele de Rosa) Date: Fri Feb 16 10:00:33 2018 Subject: [xsd-users] Problem using --hxx-regex and --cxx-regex options Message-ID: Hi all, I'm trying to modify the output filenames (headers and sources) produced by xsd cxx parser by default, but I didn't understand how to use the --hxx-regex and --cxx-regex options. Where can I find examples of usage? Kind Regards Michele de Rosa From jnw at xs4all.nl Sun Feb 18 02:52:47 2018 From: jnw at xs4all.nl (Jeroen N. Witmond) Date: Sun Feb 18 02:54:43 2018 Subject: [xsd-users] Problem using --hxx-regex and --cxx-regex options In-Reply-To: References: Message-ID: <0f077a2b6d548577eea9e5da6dd72147@xs4all.nl> On 2018-02-16 14:16, Michele de Rosa wrote: > I'm trying to modify the output filenames (headers and sources) > produced by > xsd cxx parser by default, but I didn't understand how to use the > --hxx-regex and --cxx-regex options. Where can I find examples of > usage? I also could not find anything, so I experimented a bit, with the following results: 1, You do well to put the --*-regex options in an --options-file to keep the shell and the make utility from clobbering it. 2. The --*-regex option in the -options-file must start with --. 3. When you make a mistake and the result of the regexp is the name of the input .xsd file, this file is quietly overwritten. 4. The option --hxx-regex-trace is unknown. 5. The following options.file >>> --hxx-regex %([^.]*)[.](.*)%$1.hpp% <<< will change the extension of the created header file to .hpp. This example regex is stupid in the sense that everything following the first dot in the name is regarded as the extension. 6. You use this options.file with a command line like: >>> xsdcxx cxx-tree --options-file options.file test-000.xsd <<< 7. When the file name on the command line starts with a directory name, for instance subdir/test-000.xsd, this directory name will not the passed to the regex, only the filename is. You can add a directory in the replacement part of the regex, for instance if you want the source file to be created in a directory different from the header file. I have not experimented with the --cxx-regex option, but I assume identical behavior. Neither have I experimented with multiple --hxx-regexp options. HTH, Jeroen. From micder74 at gmail.com Mon Feb 19 03:25:08 2018 From: micder74 at gmail.com (Michele de Rosa) Date: Mon Feb 19 03:27:30 2018 Subject: [xsd-users] Problem using --hxx-regex and --cxx-regex options In-Reply-To: <0f077a2b6d548577eea9e5da6dd72147@xs4all.nl> References: <0f077a2b6d548577eea9e5da6dd72147@xs4all.nl> Message-ID: Dear Jerome, thank you very much. You was helpful. Kind Regards Michele 2018-02-18 8:52 GMT+01:00 Jeroen N. Witmond : > On 2018-02-16 14:16, Michele de Rosa wrote: > > I'm trying to modify the output filenames (headers and sources) produced by >> xsd cxx parser by default, but I didn't understand how to use the >> --hxx-regex and --cxx-regex options. Where can I find examples of usage? >> > > I also could not find anything, so I experimented a bit, with the > following results: > > 1, You do well to put the --*-regex options in an --options-file to keep > the shell and the make utility from clobbering it. > > 2. The --*-regex option in the -options-file must start with --. > > 3. When you make a mistake and the result of the regexp is the name of the > input .xsd file, this file is quietly overwritten. > > 4. The option --hxx-regex-trace is unknown. > > 5. The following options.file > > >>>> --hxx-regex %([^.]*)[.](.*)%$1.hpp% > <<< > > will change the extension of the created header file to .hpp. This example > regex is stupid in the sense that everything following the first dot in the > name is regarded as the extension. > > 6. You use this options.file with a command line like: > > >>>> xsdcxx cxx-tree --options-file options.file test-000.xsd > <<< > > 7. When the file name on the command line starts with a directory name, > for instance subdir/test-000.xsd, this directory name will not the passed > to the regex, only the filename is. You can add a directory in the > replacement part of the regex, for instance if you want the source file to > be created in a directory different from the header file. > > I have not experimented with the --cxx-regex option, but I assume > identical behavior. Neither have I experimented with multiple --hxx-regexp > options. > > HTH, > > Jeroen. > > From damon.southworth at uk.bosch.com Wed Feb 21 10:47:56 2018 From: damon.southworth at uk.bosch.com (Southworth Damon (AA-AS/EOS32)) Date: Wed Feb 21 10:50:05 2018 Subject: [xsd-users] XSD Generated Class Customization Message-ID: Hi, Boris, In our project we have many customized classes with methods to perform operations on the data model. Is there a mechanism where extra external information can be presented (e.g. an extra parameter) to the constructors of all these custom classes that they can use during construction? We have external data that we would like these classes to be able to access during construction. Thanks, Damon From gfrontera at ucm.es Wed Feb 21 12:24:39 2018 From: gfrontera at ucm.es (Guillermo Frontera) Date: Thu Feb 22 11:47:27 2018 Subject: [xsd-users] Missing includes in code generated from AIXM 5.1 Message-ID: Hello, I am generating C++ code from the AIXM 5.1 XML Schema , but the code generated fails to compile due to some includes that appear to be missing. I tried using the latest stable version of CodeSynthesis XSD as well as the latest pre-release binaries I could find (4.1.0a11). The C++ code was generated by typing the following commands into a terminal (I used Ubuntu 17.10): $ wget http://aixm.aero/sites/aixm.aero/files/imce/AIXM51/aixm-5-1-20100201-xsd.zip $ unzip aixm-5-1-20100201-xsd.zip $ mkdir gen $ xsd cxx-tree --std c++11 --output-dir gen --generate-polymorphic --polymorphic-type-all --file-per-type --namespace-map http://www.opengis.net/gml/3.2=gml xsd/ISO_19136_Schemas/gml.xsd Once generated, the code was compiled using a very standard CMake script that is attached. Best regards, Guillermo -------------- next part -------------- cmake_minimum_required(VERSION 3.6) project(aixm CXX) file(GLOB_RECURSE SOURCE_FILES ${PROJECT_SOURCE_DIR}/gen/*.cxx) add_library(aixm SHARED ${SOURCE_FILES}) set_property(TARGET aixm PROPERTY CXX_STANDARD 11) find_package(XercesC REQUIRED) target_link_libraries(aixm ${XercesC_LIBRARIES}) From boris at codesynthesis.com Thu Feb 22 11:53:56 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 22 11:55:59 2018 Subject: [xsd-users] XSD Generated Class Customization In-Reply-To: References: Message-ID: Southworth Damon (AA-AS/EOS32) writes: > In our project we have many customized classes with methods to perform > operations on the data model. I assume you are talking about XSD-generated classes that you have customized using the mechanisms described here: http://wiki.codesynthesis.com/Tree/Customization_guide > Is there a mechanism where extra external information can be > presented (e.g. an extra parameter) to the constructors of all > these custom classes that they can use during construction? Hm, since you have customized them, don't you have full control over all the constructors that you define in them? I am not sure I understand what the problem is. Or is the problem in passing that extra parameter along to member's constructors? Boris From damon.southworth at uk.bosch.com Thu Feb 22 12:13:23 2018 From: damon.southworth at uk.bosch.com (Southworth Damon (AA-AS/EOS32)) Date: Thu Feb 22 12:15:34 2018 Subject: [xsd-users] XSD Generated Class Customization In-Reply-To: References: Message-ID: <0D6F52F1-F96D-45AD-9864-F2507BA74EC4@uk.bosch.com> Hi, > On 22 Feb 2018, at 16:53, Boris Kolpackov wrote: > > I assume you are talking about XSD-generated classes that you have > customized using the mechanisms described here: > > http://wiki.codesynthesis.com/Tree/Customization_guide > Yes, that is correct, we use the C++11 complex pattern. > Hm, since you have customized them, don't you have full control > over all the constructors that you define in them? I am not sure > I understand what the problem is. Yes, we can generate custom constructors where required and perform custom operations within them but is there any mechanism that I can use to add extra parameters to these custom constructors that I have control over when when the object is instantiated? > Or is the problem in passing that extra parameter along to > member's constructors? > Yes, how would I pass and assign custom parameters to the custom constructors? Currently the parameters are the same as the parent class and these are passed down. I?d like to add an additional parameter that the custom constructor can use but I can?t see how we can add custom parameters as the objects are instantiated and the constructors called when the XML data is being parsed. I don?t see any mechanism to get extra constructor parameters that we can control and assign into the autogenerated XML parsing code. Damon. From boris at codesynthesis.com Fri Feb 23 09:41:05 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 23 09:43:11 2018 Subject: [xsd-users] XSD Generated Class Customization In-Reply-To: <0D6F52F1-F96D-45AD-9864-F2507BA74EC4@uk.bosch.com> References: <0D6F52F1-F96D-45AD-9864-F2507BA74EC4@uk.bosch.com> Message-ID: Southworth Damon (AA-AS/EOS32) writes: > Yes, how would I pass and assign custom parameters to the custom > constructors? Currently the parameters are the same as the parent class and > these are passed down. I?d like to add an additional parameter that the > custom constructor can use but I can?t see how we can add custom parameters > as the objects are instantiated and the constructors called when the XML > data is being parsed. I don?t see any mechanism to get extra constructor > parameters that we can control and assign into the autogenerated XML parsing > code. Yeah, I don't think there is a clean way to do it. The two approaches that I can think of: 1. Use a global (potentially thread-local) variable. 2. In case of parsing constructors, I think you can attach custom data to the Xerces-C++ DOM. Boris From damon.southworth at uk.bosch.com Fri Feb 23 09:59:35 2018 From: damon.southworth at uk.bosch.com (Southworth Damon (AA-AS/EOS32)) Date: Fri Feb 23 10:01:41 2018 Subject: [xsd-users] XSD Generated Class Customization In-Reply-To: References: <0D6F52F1-F96D-45AD-9864-F2507BA74EC4@uk.bosch.com> Message-ID: <6257BF5E-5C85-4202-88E2-8CF85CD0B600@uk.bosch.com> > >> Yes, how would I pass and assign custom parameters to the custom >> constructors? Currently the parameters are the same as the parent class and >> these are passed down. I?d like to add an additional parameter that the >> custom constructor can use but I can?t see how we can add custom parameters >> as the objects are instantiated and the constructors called when the XML >> data is being parsed. I don?t see any mechanism to get extra constructor >> parameters that we can control and assign into the autogenerated XML parsing >> code. > > On 23 Feb 2018, at 14:41, Boris Kolpackov wrote: > Yeah, I don't think there is a clean way to do it. The two approaches that > I can think of: > > 1. Use a global (potentially thread-local) variable. Okay, yes, that?s where I ended up too. Thanks. Damon. From isharp at atis.org Tue Feb 27 08:45:24 2018 From: isharp at atis.org (Iain Sharp) Date: Tue Feb 27 08:47:54 2018 Subject: [xsd-users] Question on Tree FAQ Message-ID: Hi Folks, A bit off topic, but can I raise a question on the tree FAQ (http://wiki.codesynthesis.com/Tree/FAQ)? In the example routine to create an xerces Doc the code gets a raw (non-smart) pointer to a DOMImplementation with the line: DOMImplementation* impl ( DOMImplementationRegistry::getDOMImplementation (ls_id)) However, this pointer is not explicitly released in the code. For a real application where this might be called multiple times does that pointer need to be released somewhere to avoid a memory leak? The Xerces documentation seems unclear as to whether this is a newly created instance or just a pointer to a static instance. Regards Iain From boris at codesynthesis.com Wed Feb 28 08:06:24 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 28 08:08:46 2018 Subject: [xsd-users] Question on Tree FAQ In-Reply-To: References: Message-ID: Iain Sharp writes: > DOMImplementation* impl ( > DOMImplementationRegistry::getDOMImplementation (ls_id)) > > However, this pointer is not explicitly released in the code. It is a "reference" to the registered implementation that's one per process (it could have been a real reference if not for the need to signal the "not available" condition). Thus it should not be freed. Boris