From antoine.villeret at gmail.com Tue Feb 4 09:10:30 2020 From: antoine.villeret at gmail.com (Antoine Villeret) Date: Tue Feb 4 09:16:48 2020 Subject: [xsd-users] Split generated hxx into smaller ones Message-ID: Dear list, I used xsdcxx with the following command line : xsdcxx cxx-tree --std c++11 --output-dir ${DEST_DIR}/common --generate-serialization --generate-any-type ./schemas_2_1/common/UBL-CommonAggregateComponents-2.1.xsd and the generated header is huge (6.4MB) and hard to parse by my IDE (QtCreator, I also tried with CLion with even worse result). I'm wondering if there is a way to split this header into smaller files to make code navigation faster ? Kind regards Antoine From bernhard.rapp at student.tugraz.at Tue Feb 4 11:32:38 2020 From: bernhard.rapp at student.tugraz.at (Bernhard Rapp) Date: Tue Feb 4 11:38:37 2020 Subject: [xsd-users] Split generated hxx into smaller ones In-Reply-To: References: Message-ID: <78d79a34-caed-efeb-56de-3db193f61326@student.tugraz.at> Dear Antoine, ist the option "--file-per-type" what you are looking for? Best regards, Bernhard On 04.02.20 15:10, Antoine Villeret wrote: > Dear list, > > I used xsdcxx with the following command line : > > xsdcxx cxx-tree --std c++11 --output-dir ${DEST_DIR}/common > --generate-serialization --generate-any-type > ./schemas_2_1/common/UBL-CommonAggregateComponents-2.1.xsd > > and the generated header is huge (6.4MB) and hard to parse by my IDE > (QtCreator, I also tried with CLion with even worse result). > > I'm wondering if there is a way to split this header into smaller files to > make code navigation faster ? > > Kind regards > Antoine From boris at codesynthesis.com Wed Feb 5 08:00:10 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 5 08:06:04 2020 Subject: [xsd-users] Split generated hxx into smaller ones In-Reply-To: References: Message-ID: Antoine Villeret writes: > xsdcxx cxx-tree --std c++11 --output-dir ${DEST_DIR}/common > --generate-serialization --generate-any-type > ./schemas_2_1/common/UBL-CommonAggregateComponents-2.1.xsd > > I'm wondering if there is a way to split this header into smaller files to > make code navigation faster ? As Benhard has suggested, one option would be to use the file-per-type mode (--file-per-type). This will cause the generation of a separate header file for each schema type. While this will most likely solve your problem, for a large schema this can result in thousands of header files which poses its own problems. Another approach would be to try to minimize the amount of unneeded code. XSD normally issues warning when this could be happening. The most common culprit are the global elements that are not actually valid document roots. You can suppress generating parsing/serialization code for such elements using the --root-element* option. See the XSD compiler command line manual for details: https://codesynthesis.com/projects/xsd/documentation/xsd.xhtml From antoine.villeret at gmail.com Thu Feb 6 15:55:12 2020 From: antoine.villeret at gmail.com (Antoine Villeret) Date: Thu Feb 6 16:01:34 2020 Subject: [xsd-users] Split generated hxx into smaller ones In-Reply-To: References: Message-ID: Hi, thanks for your quick responses. The --file-per-type option generates a lot more files (2466 vs 26) but some of them are still huge (142419 lines vs 169940). Moreover with this option I have some undefined type that I tried to fix with --extern-xml-schema and --generate-xml-schema options without success. I have to admit that I'm new to XML Schema and sometimes the documentation is not clear to my eyes due to my lack of experience. That's why I'll stay with the first version I have. It's quite annoying that my IDE can't parse huge header files easily but at least it works. And I think it will be faster to live with that instead of trying to reduce file size. Sometimes the better is the enemy of the good... Thanks anyway for your support. Antoine Le mer. 5 f?vr. 2020 ? 14:00, Boris Kolpackov a ?crit : > Antoine Villeret writes: > > > xsdcxx cxx-tree --std c++11 --output-dir ${DEST_DIR}/common > > --generate-serialization --generate-any-type > > ./schemas_2_1/common/UBL-CommonAggregateComponents-2.1.xsd > > > > I'm wondering if there is a way to split this header into smaller files > to > > make code navigation faster ? > > As Benhard has suggested, one option would be to use the file-per-type > mode (--file-per-type). This will cause the generation of a separate > header file for each schema type. While this will most likely solve > your problem, for a large schema this can result in thousands of header > files which poses its own problems. > > Another approach would be to try to minimize the amount of unneeded code. > XSD normally issues warning when this could be happening. The most > common culprit are the global elements that are not actually valid > document roots. You can suppress generating parsing/serialization code > for such elements using the --root-element* option. See the XSD compiler > command line manual for details: > > https://codesynthesis.com/projects/xsd/documentation/xsd.xhtml > From seav-er-externe.huy at edf.fr Wed Feb 19 05:33:11 2020 From: seav-er-externe.huy at edf.fr (HUY Seav-Er - partenaire) Date: Wed Feb 19 08:36:04 2020 Subject: [xsd-users] Parsing float value Message-ID: <1582108391114.89884@edf.fr> Hi Boris, In my XSD file, I defined a value with xs:float and the parsing of XML file is done with cxx-tree. For example, in my XML, the value is 1.49451193e-06, I get with 16 digits printing, 1.49451193465211e-06. To do the same exercise, I change in the XSD file the type to xs:double and the output is as it is in the XML. Moreover, when I cast this output to float, I get the same result 1.49451193465211e-06 as xs:float defintion. My question is whether the parsing is always done with double precision and convert to float in case of xs:flot in XSD definition. Thanks beforehand for your help, Seav-Er Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. From boris at codesynthesis.com Wed Feb 19 09:09:25 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 19 09:16:02 2020 Subject: [xsd-users] Re: Parsing float value In-Reply-To: <1582108391114.89884@edf.fr> References: <1582108391114.89884@edf.fr> Message-ID: HUY Seav-Er - partenaire writes: > In my XSD file, I defined a value with xs:float and the parsing of XML > file is done with cxx-tree. > > For example, in my XML, the value is 1.49451193e-06, I get with 16 > digits printing, 1.49451193465211e-06. To do the same exercise, I > change in the XSD file the type to xs:double and the output is as > it is in the XML. Moreover, when I cast this output to float, I > get the same result 1.49451193465211e-06 as xs:float defintion. > > My question is whether the parsing is always done with double > precision and convert to float in case of xs:flot in XSD definition. Parsing is done as float/double respectively. You can see the code in libxsd/xsd/cxx/tree/parsing/{float,double}.hxx. As you are probably aware, floating-point numbers do not represent all possible values and the exact set of values depends on the representation (float, double, etc). So I think what happens in your case is the value in question is exactly representable as double but not as float. Also see the serialization side, which is another messy story with some macros that may help you get what you want. See the code in libxsd/xsd/cxx/tree/serialization/{float,double}.hxx.