从XSD生成Go结构 [英] generate Go structs from XSD

查看:140
本文介绍了从XSD生成Go结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我打算用Go来做一个项目。我的问题是:给定一个XSD文件
,如何在Go中自动生成结构来表示XML元素。
类似于使用'xjc'从XSD生成Java类。
那么是否有任何工具或软件包可以在Go中执行此操作?



在此先感谢您。

解决方案

看起来它可能需要一些支持1.2的TLC,但还有:
https://github.com/metaleap/go-xsd



其中有一组为不同的常见XML格式生成的示例包:
https://github.com/metaleap/go- xsd-pkg


recently I am planing to do a project using Go. My problem is : given a XSD file, how to auto-generate structs in Go to represent the XML elements. It is similar to using 'xjc' to generate java classes from XSD. So is there any tools or packages to do this in Go?

Thanks in advance.

解决方案

Looks like it might need some TLC for 1.2 support, but there's: https://github.com/metaleap/go-xsd

Which has a set of example packages that have been generated for different common XML formats: https://github.com/metaleap/go-xsd-pkg

这篇关于从XSD生成Go结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆