Skip to content

Commit

Permalink
init go module and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri committed Mar 1, 2020
1 parent bb08b9b commit 3a2f519
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 7 deletions.
19 changes: 12 additions & 7 deletions README.md
@@ -1,16 +1,21 @@
<p align="center"><img width="450" src="./xgen.svg" alt="xgen logo"></p>

# xgen
<br>

<p align="center">
<a href="https://github.com/xuri/xgen/actions?workflow=Go"><img src="https://github.com/xuri/xgen/workflows/Go/badge.svg?branch=master" alt="Build Status"></a>
<a href="https://codecov.io/gh/xuri/xgen"><img src="https://codecov.io/gh/xuri/xgen/branch/master/graph/badge.svg" alt="Code Coverage"></a>
<a href="https://goreportcard.com/report/github.com/xuri/xgen"><img src="https://goreportcard.com/badge/github.com/xuri/xgen" alt="Go Report Card"></a>
<a href="https://pkg.go.dev/github.com/xuri/xgen?tab=doc"><img src="https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white" alt="go.dev"></a>
<a href="https://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-bsd-orange.svg" alt="Licenses"></a>
<a href="https://www.paypal.me/xuri"><img src="https://img.shields.io/badge/Donate-PayPal-green.svg" alt="Donate"></a>
</p>

[![Build Status](https://github.com/xuri/xgen/workflows/Go/badge.svg)](https://github.com/xuri/xgen/actions?workflow=Go)
[![Code Coverage](https://codecov.io/gh/xuri/xgen/branch/master/graph/badge.svg)](https://codecov.io/gh/xuri/xgen)
[![Go Report Card](https://goreportcard.com/badge/github.com/xuri/xgen)](https://goreportcard.com/report/github.com/xuri/xgen)
[![GoDoc](https://godoc.org/github.com/xuri/xgen?status.svg)](https://godoc.org/github.com/xuri/xgen)
[![Licenses](https://img.shields.io/badge/license-bsd-orange.svg)](https://opensource.org/licenses/BSD-3-Clause)
# xgen

## Introduction

xgen is a library written in pure Go providing a set of functions that allow you to parse XSD (XML schema definition) files. This library needs Go version 1.10 or later. The full API docs can be seen using go's built-in documentation tool, or online at [godoc.org](https://godoc.org/github.com/xuri/xgen).
xgen is a library written in pure Go providing a set of functions that allow you to parse XSD (XML schema definition) files. This library needs Go version 1.10 or later. The full API docs can be seen using go's built-in documentation tool, or online at [go.dev](https://pkg.go.dev/github.com/xuri/xgen?tab=doc).

`xgen` commands automatically compiles XML schema files into the multi-language type or class declarations code.

Expand Down
60 changes: 60 additions & 0 deletions README_zh.md
@@ -0,0 +1,60 @@
<p align="center"><img width="450" src="./xgen.svg" alt="xgen logo"></p>

<br>

<p align="center">
<a href="https://github.com/xuri/xgen/actions?workflow=Go"><img src="https://github.com/xuri/xgen/workflows/Go/badge.svg?branch=master" alt="Build Status"></a>
<a href="https://codecov.io/gh/xuri/xgen"><img src="https://codecov.io/gh/xuri/xgen/branch/master/graph/badge.svg" alt="Code Coverage"></a>
<a href="https://goreportcard.com/report/github.com/xuri/xgen"><img src="https://goreportcard.com/badge/github.com/xuri/xgen" alt="Go Report Card"></a>
<a href="https://pkg.go.dev/github.com/xuri/xgen?tab=doc"><img src="https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white" alt="go.dev"></a>
<a href="https://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-bsd-orange.svg" alt="Licenses"></a>
<a href="https://www.paypal.me/xuri"><img src="https://img.shields.io/badge/Donate-PayPal-green.svg" alt="Donate"></a>
</p>

# xgen

## Introduction

xgen 是 Go 语言编写的 XSD (XML Schema Definition) 工具基础库。使用本基础库要求使用的 Go 语言为 1.10 或更高版本,完整的 API 使用文档请访问 [go.dev](https://pkg.go.dev/github.com/xuri/xgen?tab=doc)

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

首先安装命令行工具:

```text
go get github.com/xuri/xgen
```

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

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

Usage:

```text
$ 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](https://www.w3.org)) 推荐的标准,它指定了在可扩展标记语言 ([XML](https://www.w3.org/TR/xml/)) 文档中描述元素的规范。开发者可以使用它来验证文档中的每个项目内容,并可以检查它是否符合放置元素的说明。

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

## 社区合作

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

## 开源许可

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

Logo 由 [xuri](https://xuri.me) 创作,遵循 [Creative Commons 3.0 Attributions license](http://creativecommons.org/licenses/by/3.0/) 创作共用授权条款。
3 changes: 3 additions & 0 deletions go.mod
@@ -0,0 +1,3 @@
module github.com/xuri/xgen

go 1.14

0 comments on commit 3a2f519

Please sign in to comment.