[xsd-users] Split generated hxx into smaller ones

Antoine Villeret antoine.villeret at gmail.com
Thu Feb 6 15:55:12 EST 2020


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 <boris at codesynthesis.com> a
écrit :

> Antoine Villeret <antoine.villeret at gmail.com> 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
>


More information about the xsd-users mailing list