[xsd-users] Require info on using the CodeSynthesis to generate CPP
code using multiple XSD files.
Badari Prasad
badari.hp at gmail.com
Wed Apr 22 21:13:09 EDT 2020
Hi
We have a use case to generate CPP code from multiple XSD files:
XSD files can be found in link :
https://www.etsi.org/deliver/etsi_ts/103200_103299/10322101/01.06.01_60/ts_10322101v010601p0.zip
and this depends on XSD in link
https://www.etsi.org/deliver/etsi_ts/103200_103299/103280/02.04.01_60/ts_103280v020401p0.zip
I am are not sure of the proper commands to use to generate the CPP code
and Driver code for cxx-tree option.
Commands I used :
1) xsd cxx-tree --generate-default-ctor --namespace-map
http://uri.etsi.org/03280/common/2017/07=CommonData --namespace-map
http://uri.etsi.org/03221/X1/2017/10=LIX1 --location-map
http://uri.etsi.org/03280/common/2017/07/TS_103_280_v020401.xsd=TS_103_280_v020401.xsd
--generate-forward --generate-serialization --generate-ostream
--generate-comparison --generate-polymorphic --std c++11
TS_103_280_v020401.xsd TS_103_221_01_v010601.xsd
With this command XSD complains about schemaLocation
TS_103_221_01_v010601.xsd: error: unable to guess which schema to open
TS_103_221_01_v010601.xsd: info: did you forget to specify schemaLocation
for import/include?
To fix this I had to edit TS_103_221_01_v010601.xsd to add schemaLocation.
2) I did follow the steps out lined in
http://wiki.codesynthesis.com/Schemas/RailML , my use case is similar to
the problem in the mail thread
https://www.codesynthesis.com/pipermail/xsd-users/2010-May/002807.html.
xsd cxx-tree --generate-xml-schema --output-dir gen TS_103_280_v020401.xsd
xsd cxx-tree --file-per-type --options-file options --output-dir gen/280
--extern-xml-schema TS_103_280_v020401.xsd
xsd cxx-tree --options-file options --output-dir gen --extern-xml-schema
TS_103_280_v020401.xsd TS_103_221_01_v010601.xsd
Options file content :
--generate-default-ctor
--location-map
http://uri.etsi.org/03280/common/2017/07/TS_103_280_v020401.xsd=TS_103_280_v020401.xsd
--namespace-map http://uri.etsi.org/03280/common/2017/07=CommonData
--namespace-map http://uri.etsi.org/03221/X1/2017/10=LIX1
--generate-forward
--generate-serialization
--generate-ostream
--generate-comparison
--generate-polymorphic
--std c++11
In this procedure step 2 complains about "error: no input file specified"
Kindly let me know proper procedure to generate the C++ code from these 2
XSD files.
I have attached XSD files and example xml files with this mail as well.
Thanks
badari
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ActivateTaskRequest_example.xml
Type: text/xml
Size: 990 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20200423/8fbe01d6/ActivateTaskRequest_example-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TS_103_280_v020401.xsd
Type: text/xml
Size: 9431 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20200423/8fbe01d6/TS_103_280_v020401-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TS_103_221_01_v010601.xsd
Type: text/xml
Size: 28409 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20200423/8fbe01d6/TS_103_221_01_v010601-0001.bin
More information about the xsd-users
mailing list