From 828dc48199d0c745ad1b54be655feef1d2c73e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Sat, 30 Jul 2022 10:45:47 +0800 Subject: [PATCH] - update --- LICENSE | 21 +++++++++++++++++++++ README.md | 17 +++++++++++++++++ goxml.go | 6 +++--- version.go | 2 +- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ff84bbf --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 李光春 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e107e1 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +

+Golang Xml +

+ +📦 Golang Xml + +[comment]: <> (go) +[![godoc](https://pkg.go.dev/badge/go.dtapp.net/goxml?status.svg)](https://pkg.go.dev/go.dtapp.net/goxml) +[![goproxy.cn](https://goproxy.cn/stats/go.dtapp.net/goxml/badges/download-count.svg)](https://goproxy.cn/stats/go.dtapp.net/goxml) +[![goreportcard.com](https://goreportcard.com/badge/go.dtapp.net/goxml)](https://goreportcard.com/report/go.dtapp.net/goxml) +[![deps.dev](https://img.shields.io/badge/deps-go-red.svg)](https://deps.dev/go/go.dtapp.net%2Fgoxml) + +#### 安装 + +```shell +go get -v -u go.dtapp.net/goxml +``` diff --git a/goxml.go b/goxml.go index d8d169b..5ee0ba5 100644 --- a/goxml.go +++ b/goxml.go @@ -20,7 +20,7 @@ func XmlDecode(data string) map[string]string { } switch tp := token.(type) { //读取的TOKEN可以是以下三种类型:StartElement起始标签,EndElement结束标签,CharData文本内容 case xml.StartElement: - se := xml.StartElement(tp) //强制类型转换 + se := tp //强制类型转换 if se.Name.Local != "xml" { key = se.Name.Local } @@ -28,12 +28,12 @@ func XmlDecode(data string) map[string]string { //读取标签属性 } case xml.EndElement: - ee := xml.EndElement(tp) + ee := tp if ee.Name.Local == "xml" { return result } case xml.CharData: //文本数据,注意一个结束标签和另一个起始标签之间可能有空格 - cd := xml.CharData(tp) + cd := tp data := strings.TrimSpace(string(cd)) if len(data) != 0 { result[key] = data diff --git a/version.go b/version.go index 00857b7..a210a35 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package goxml -const Version = "1.0.0" +const Version = "1.0.1"