From xjtu.yohuang at gmail.com Fri Jul 21 22:18:47 2023 From: xjtu.yohuang at gmail.com (Yongchang Huang) Date: Mon Jul 24 10:38:06 2023 Subject: [xsd-users] Error: incomplete type when compiling cxx generated with --file-per-type Message-ID: Hi xsd developers, I need some help on cxx-tree cxx compilation error. *Problem* I used xsd-4.0.0 to generate cxx-tree files with --file-per-type option, and then tried to compile the .cxx files. g++ reported incomplete type error as shown below. *Error message* */home/utils/gcc-9.3.0/bin/g++ -std=c++11 -c clockDriver.cxx -I ../../../xsd-4.0.0+dep/xsd/libxsd -I /home/utils/xerces-c-3.1.1/include* *In file included from /home/utils/gcc-9.3.0/include/c++/9.3.0/memory:80,* * from ../../../xsd-4.0.0+dep/xsd/libxsd/xsd/cxx/xml/char-utf8.txx:8,* * from ../../../xsd-4.0.0+dep/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx:44,* * from builtin_types/index.hxx:62,* * from clockDriver.hxx:62,* * from clockDriver.cxx:41:* */home/utils/gcc-9.3.0/include/c++/9.3.0/bits/unique_ptr.h: In instantiation of 'void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = ipxact::clockDriverType_clockPeriod]':* */home/utils/gcc-9.3.0/include/c++/9.3.0/bits/unique_ptr.h:292:17: required from 'std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = ipxact::clockDriverType_clockPeriod; _Dp = std::default_delete]'* *clockDriver.cxx:108:21: required from here* */home/utils/gcc-9.3.0/include/c++/9.3.0/bits/unique_ptr.h:79:16: error: invalid application of 'sizeof' to incomplete type 'ipxact::clockDriverType_clockPeriod'* *Xsd Snippet for xs:element clockDriverType* Describes a driven clock port. Indicates the name of the cllock. If not specified the name is assumed to be the name of the containing port. .... Clock period in units defined by the units attribute. Default is nanoseconds. ... *Observations* The clockDriverType contains a sequence of elements, one element is of type clockPeriod. The generated clockDriverType.hxx contains only forward declaration of clockDriverType_clockPeriod and no #include "clockDriverType_clockPeriod.hxx". Is this a bug or am I missing any xsd option to instruct xsd to add the missing #include? *How to reproduce* The attached debug.tar file contains the .xsd files and a run.sh which shows the xsd cxx-tree command and g++ command. You may need to update the g++ or libxsd header path as needed. Thanks, yohuang -------------- next part -------------- A non-text attachment was scrubbed... Name: debug.tar Type: application/x-tar Size: 358400 bytes Desc: not available Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20230722/577d3df3/debug-0001.tar From boris at codesynthesis.com Mon Jul 24 10:54:10 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 24 10:44:46 2023 Subject: [xsd-users] Error: incomplete type when compiling cxx generated with --file-per-type In-Reply-To: References: Message-ID: Yongchang Huang writes: > I used xsd-4.0.0 to generate cxx-tree files with --file-per-type option, > and then tried to compile the .cxx files. g++ reported incomplete type > error as shown below. There were some issues in this area that we've fixed since the 4.0.0 release. Would you be able to re-test this with the latest XSD pre- release and see if it makes any difference? The step-by-step instructions for building the latest pre-release can be found here: https://codesynthesis.com/products/xsd/doc/install-build2.xhtml From boris at codesynthesis.com Mon Jul 24 11:00:20 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 24 10:50:54 2023 Subject: [xsd-users] Error: incomplete type when compiling cxx generated with --file-per-type In-Reply-To: References: Message-ID: Boris Kolpackov writes: > Yongchang Huang writes: > > > I used xsd-4.0.0 to generate cxx-tree files with --file-per-type option, > > and then tried to compile the .cxx files. g++ reported incomplete type > > error as shown below. > > There were some issues in this area that we've fixed since the 4.0.0 > release. Would you be able to re-test this with the latest XSD pre- > release and see if it makes any difference? I had a minute so I tried to check this myself using the reproducer you have provided. But it seems to be missing some schemas: $ ./run.sh busDefinition.xsd: error: 'generator.xsd': unable to open in read mode From xjtu.yohuang at gmail.com Mon Jul 24 11:55:30 2023 From: xjtu.yohuang at gmail.com (Yongchang Huang) Date: Tue Jul 25 10:39:09 2023 Subject: [xsd-users] Error: incomplete type when compiling cxx generated with --file-per-type In-Reply-To: References: Message-ID: Hi Boris, Sorry that I did not check the debug.tar carefully before sending it out. The updated tar is attached. I will also try to use the pre-release version meanwhile. thanks, yohuang Boris Kolpackov ?2023?7?24??? 22:59??? > Boris Kolpackov writes: > > > Yongchang Huang writes: > > > > > I used xsd-4.0.0 to generate cxx-tree files with --file-per-type > option, > > > and then tried to compile the .cxx files. g++ reported incomplete type > > > error as shown below. > > > > There were some issues in this area that we've fixed since the 4.0.0 > > release. Would you be able to re-test this with the latest XSD pre- > > release and see if it makes any difference? > > I had a minute so I tried to check this myself using the reproducer > you have provided. But it seems to be missing some schemas: > > $ ./run.sh > busDefinition.xsd: error: 'generator.xsd': unable to open in read mode > -------------- next part -------------- A non-text attachment was scrubbed... Name: debug.tar Type: application/x-tar Size: 378880 bytes Desc: not available Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20230724/850a8723/debug-0001.tar From xjtu.yohuang at gmail.com Tue Jul 25 23:11:35 2023 From: xjtu.yohuang at gmail.com (Yongchang Huang) Date: Thu Jul 27 01:19:40 2023 Subject: [xsd-users] Error: incomplete type when compiling cxx generated with --file-per-type In-Reply-To: References: Message-ID: Hi Boris, I can build xsd tool from the new released and tried to generate cxx files, and it seems the generated .cxx can compile now. Then I tried to build libxsd library in order to test the generated .cxx files, but I have trouble building libxsd with the new version using build2 tool. *bpkg build libxsd* command reported below error: fetched libxsd/4.2.0-b.4 unpacked libxsd/4.2.0-b.4 configured libxsd/4.2.0-b.4 version libxsd-4.2.0-b.4/xsd/cxx/in{version} -> libxsd-4.2.0-b.4/xsd/cxx/hxx{version} in libxsd-4.2.0-b.4/doc/cxx/tree/reference/in{libxsd} -> libxsd-4.2.0-b.4/doc/cxx/tree/reference/doxygen{libxsd} in libxsd-4.2.0-b.4/doc/cxx/tree/reference/in{footer} -> libxsd-4.2.0-b.4/doc/cxx/tree/reference/html{footer} libxsd-4.2.0-b.4/doc/buildfile:51:7: error: target : not found in diag builtin info: while updating libxsd-4.2.0-b.4/doc/cxx/tree/reference/doxytag{libxsd} info: while updating libxsd-4.2.0-b.4/dir{doc/} info: while updating dir{libxsd-4.2.0-b.4/} info: failed to update dir{libxsd-4.2.0-b.4/} buildfile is hard to understand compared to Makefile, and I tried to understand how buildfile works, and tried to remove doc target in libxsd-4.2.0-b.4/buildfile as shown below: ./: {*/ -build/} doc{INSTALL NEWS README} legal{GPLv2 LICENSE FLOSSE} manifest to ./: {*/ -build/ -doc/} legal{GPLv2 LICENSE FLOSSE} manifest but libxsd so file was not generated somehow. It seems the libxsd-4.2.0-b.4/xsd/buildfile was not used. thanks, yohuang Yongchang Huang ?2023?7?24??? 23:55??? > Hi Boris, > > Sorry that I did not check the debug.tar carefully before sending it out. > > The updated tar is attached. > > I will also try to use the pre-release version meanwhile. > > thanks, > yohuang > > Boris Kolpackov ?2023?7?24??? 22:59??? > >> Boris Kolpackov writes: >> >> > Yongchang Huang writes: >> > >> > > I used xsd-4.0.0 to generate cxx-tree files with --file-per-type >> option, >> > > and then tried to compile the .cxx files. g++ reported incomplete type >> > > error as shown below. >> > >> > There were some issues in this area that we've fixed since the 4.0.0 >> > release. Would you be able to re-test this with the latest XSD pre- >> > release and see if it makes any difference? >> >> I had a minute so I tried to check this myself using the reproducer >> you have provided. But it seems to be missing some schemas: >> >> $ ./run.sh >> busDefinition.xsd: error: 'generator.xsd': unable to open in read mode >> > From xjtu.yohuang at gmail.com Wed Jul 26 03:42:56 2023 From: xjtu.yohuang at gmail.com (Yongchang Huang) Date: Thu Jul 27 01:19:40 2023 Subject: [xsd-users] Error: incomplete type when compiling cxx generated with --file-per-type In-Reply-To: References: Message-ID: I think I need some coffee. libxsd does not provide .so files actually. I ignored the previous libxsd doc build error and linked the objects into executable finally, and successfully parsed a very simple sample xml. I will continue to try more complex xml with multiple namespaces elements and open a new case if needed. Thank you Boris for this new libxsd release! Thanks, yohuang Yongchang Huang ?2023?7?26??? 11:11??? > Hi Boris, > > I can build xsd tool from the new released and tried to generate cxx > files, and it seems the generated .cxx can compile now. > > Then I tried to build libxsd library in order to test the generated .cxx > files, but I have trouble building libxsd with the new version using build2 > tool. > > *bpkg build libxsd* command reported below error: > > fetched libxsd/4.2.0-b.4 > unpacked libxsd/4.2.0-b.4 > configured libxsd/4.2.0-b.4 > version libxsd-4.2.0-b.4/xsd/cxx/in{version} -> > libxsd-4.2.0-b.4/xsd/cxx/hxx{version} > in libxsd-4.2.0-b.4/doc/cxx/tree/reference/in{libxsd} -> > libxsd-4.2.0-b.4/doc/cxx/tree/reference/doxygen{libxsd} > in libxsd-4.2.0-b.4/doc/cxx/tree/reference/in{footer} -> > libxsd-4.2.0-b.4/doc/cxx/tree/reference/html{footer} > libxsd-4.2.0-b.4/doc/buildfile:51:7: error: target : not found in diag > builtin > info: while updating > libxsd-4.2.0-b.4/doc/cxx/tree/reference/doxytag{libxsd} > info: while updating libxsd-4.2.0-b.4/dir{doc/} > > info: while updating dir{libxsd-4.2.0-b.4/} > info: failed to update dir{libxsd-4.2.0-b.4/} > > buildfile is hard to understand compared to Makefile, and I tried to > understand how buildfile works, and tried to remove doc target > in libxsd-4.2.0-b.4/buildfile as shown below: > > ./: {*/ -build/} doc{INSTALL NEWS README} legal{GPLv2 LICENSE FLOSSE} > manifest > > to > > ./: {*/ -build/ -doc/} legal{GPLv2 LICENSE FLOSSE} manifest > > > but libxsd so file was not generated somehow. It seems the > libxsd-4.2.0-b.4/xsd/buildfile was not used. > > thanks, > yohuang > > Yongchang Huang ?2023?7?24??? 23:55??? > >> Hi Boris, >> >> Sorry that I did not check the debug.tar carefully before sending it out. >> >> The updated tar is attached. >> >> I will also try to use the pre-release version meanwhile. >> >> thanks, >> yohuang >> >> Boris Kolpackov ?2023?7?24??? 22:59??? >> >>> Boris Kolpackov writes: >>> >>> > Yongchang Huang writes: >>> > >>> > > I used xsd-4.0.0 to generate cxx-tree files with --file-per-type >>> option, >>> > > and then tried to compile the .cxx files. g++ reported incomplete >>> type >>> > > error as shown below. >>> > >>> > There were some issues in this area that we've fixed since the 4.0.0 >>> > release. Would you be able to re-test this with the latest XSD pre- >>> > release and see if it makes any difference? >>> >>> I had a minute so I tried to check this myself using the reproducer >>> you have provided. But it seems to be missing some schemas: >>> >>> $ ./run.sh >>> busDefinition.xsd: error: 'generator.xsd': unable to open in read mode >>> >> From Mustafa.Ismail at partner.bmw.de Mon Jul 31 06:19:09 2023 From: Mustafa.Ismail at partner.bmw.de (Mustafa.Ismail@partner.bmw.de) Date: Mon Jul 31 07:11:37 2023 Subject: [xsd-users] Looking for a way to disable DTD loading and Validation or provide search path instead Message-ID: <917e069956414099a43442643218f3fb@partner.bmw.de> Hello, I am using libxsd (4.0.0 on windows and linux) to parse .cdfx files that follow a specific standard. Unfortunately, the .cdfx files I am working with all start with a "DOCTYPE" tag and refer to a specific .dtd that is supposed to be in the same directory, which is usually not the case. I have no control over the .cdfx files I receive and in most cases I try to load them remotely or from a different disk space. There is no way I could add the .dtd file to the same directory or change the .cdfx content. Was looking for a way that'd allow me to specify a DTD search path, just like "xml_schema::properties::schema_location" or "xml_schema::properties::no_namespace_schema_location". Otherwise, find a way to set the "fgXercesLoadExternalDTD" or "fgXercesSkipDTDValidation" parameters through libxsd? Any help would be appreciated. Best regards, Mustafa From boris at codesynthesis.com Mon Jul 31 08:05:02 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 31 07:55:32 2023 Subject: [xsd-users] Looking for a way to disable DTD loading and Validation or provide search path instead In-Reply-To: <917e069956414099a43442643218f3fb@partner.bmw.de> References: <917e069956414099a43442643218f3fb@partner.bmw.de> Message-ID: Mustafa.Ismail@partner.bmw.de writes: > Was looking for a way that'd allow me to specify a DTD search path, > just like "xml_schema::properties::schema_location" or > "xml_schema::properties::no_namespace_schema_location". Otherwise, > find a way to set the "fgXercesLoadExternalDTD" or > "fgXercesSkipDTDValidation" parameters through libxsd? libxsd doesn't wrap any DTD-related Xerces-C++ configuration parameters so you will need to do your own XML-to-DOM parsing with one of these parameters and then do DOM-to-C++ (there is a parsing function overload that takes DOM instead of istream, etc). The following FAQ entry has some sample code (you can also find it in the multiroot example): http://wiki.codesynthesis.com/Tree/FAQ#How_do_I_parse_an_XML_document_to_a_Xerces-C.2B.2B_DOM_document.3F