开发者

Is it possible to generate a C++ class from a xsd using Qt (without the XSD tool)?

开发者 https://www.devze.com 2023-03-07 08:27 出处:网络
I get several Datasets listed in a single xml File. I have to extract each dataset and do some operations depending on their values (not changing the content of the xml file).

I get several Datasets listed in a single xml File. I have to extract each dataset and do some operations depending on their values (not changing the content of the xml file). So I have to parse that file.

With the .Net Framework I would simply use the XSD tool to generate a matching class avoiding to write a parser myself. Unfortunately that project has to be done using Qt and mingw and I'm not sure if there is sim开发者_如何学Cilar tool.

Is it possible to (auto)generate a c++/qt class from xsd?

If it is: how?


Nice question! You should not worry if Qt has such a feature. You can use CodeSynthesisXSD which is open source. The you can combine the generated classes to your Qt project.


You may want to check CodeSynthesis XSD see this


You can also use xsd.exe to generate C++ code. It goes with Visual Studio and xsd /language will show which languages do xsd.exe support which includes CPP also.


I think with xmlpatterns module in qt it should be really easy and qt way to parse the xsd and make the corresponding qt c++ representation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号