5 Star 15 Fork 2

xuri / xgen

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

xgen logo


Build Status Code Coverage Go Report Card go.dev Licenses Donate

xgen

Introduction

xgen 是 Go 语言编写的 XSD (XML Schema Definition) 工具基础库。使用本基础库要求使用的 Go 语言为 1.10 或更高版本,完整的 API 使用文档请访问 go.dev

xgen 命令可将 XML 模式定义文件编译为多语言类型或类声明的代码。

首先安装命令行工具:

如果您使用的是 Go 1.17 及更高版本,请使用 go install 安装可执行文件

去安装 github.com/xuri/xgen/cmd/xgen@latest

如果您使用的是 Go 1.16 及更早版本,请使用 go get 安装可执行文件

去获取-u -v github.com/xuri/xgen/cmd/...

下面的命令将遍历 xsd 目录中的 XML 模式定义文件,并在 output 目录中生成 Go 语言结构体声明代码。

$ xgen -i /path/to/your/xsd -o /path/to/your/output -l Go

Usage:

$ xgen [<flag> ...] <XSD file or directory> ...
   -i <path> 指定存放 XML 模式代码文件的输入路径
   -o <path> 指定输出代码目录
   -p        指定生成代码所属包名称
   -l        指定生成类型或类声明代码语言类型 (Go/C/Java/Rust/TypeScript)
   -h        查看此帮助信息并退出
   -v        查看版本号并退出

XSD (XML Schema Definition)

XSD 是万维网联盟 (W3C) 推荐的标准,它指定了在可扩展标记语言 (XML) 文档中描述元素的规范。开发者可以使用它来验证文档中的每个项目内容,并可以检查它是否符合放置元素的说明。

XSD 是一种分离于 XML 本身的模式语言,可用于表示 XML 文档所必须遵循的一组规则,并可根据该规则进行模式有效性验证。

社区合作

欢迎您为此项目贡献代码,提出建议或问题、修复 Bug 以及参与讨论对新功能的想法。XML 符合标准:XML Schema Part 1: Structures Second Edition.

开源许可

本项目遵循 BSD 3-Clause 开源许可协议,访问 https://opensource.org/licenses/BSD-3-Clause 查看许可协议文件。

Logo 由 xuri 创作,遵循 Creative Commons 3.0 Attributions license 创作共用授权条款。

BSD 3-Clause License Copyright (c) 2020 - 2021, xuri All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

Go 语言编写的 XSD (XML Schema Definition) 工具基础库,可将 XML 模式定义文件编译为多语言类型或类声明的代码 展开 收起
Go 等 5 种语言
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/xurime/xgen.git
git@gitee.com:xurime/xgen.git
xurime
xgen
xgen
master

搜索帮助