- update
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

master v1.0.1
李光春 2 years ago
parent 6470d250fb
commit 828dc48199

@ -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.

@ -0,0 +1,17 @@
<h1>
<a href="https://www.dtapp.net/">Golang Xml</a>
</h1>
📦 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
```

@ -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

@ -1,3 +1,3 @@
package goxml
const Version = "1.0.0"
const Version = "1.0.1"

Loading…
Cancel
Save