Skip to content

Commit 5c51c3a

Browse files
author
lilang
committed
支持xml
1 parent caaca46 commit 5c51c3a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ci_doc.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"context"
66
"encoding/json"
77
"encoding/xml"
8-
"fmt"
98
"io"
109
"net/http"
1110
"net/url"
@@ -305,17 +304,17 @@ type CIDocCompareOptions struct {
305304
}
306305

307306
type CIDocCompareResult struct {
308-
Code string `xml:"Code,omitempty" json:"code,omitempty"`
309-
ETag string `xml:"ETag,omitempty" json:"eTag,omitempty"`
310-
Msg string `xml:"Msg,omitempty" json:"msg,omitempty"`
311-
ResultPath string `xml:"ResultPath,omitempty" json:"resultPath,omitempty"`
307+
XMLName xml.Name `xml:"Response"`
308+
Code string `xml:"Code,omitempty" json:"code,omitempty"`
309+
ETag string `xml:"ETag,omitempty" json:"eTag,omitempty"`
310+
Msg string `xml:"Msg,omitempty" json:"msg,omitempty"`
311+
ResultPath string `xml:"ResultPath,omitempty" json:"resultPath,omitempty"`
312312
}
313313

314314
// 优先 json
315315
func (w *CIDocCompareResult) Write(p []byte) (n int, err error) {
316316
err = json.Unmarshal(p, w)
317317
if err != nil {
318-
fmt.Println(err.Error())
319318
err = xml.NewDecoder(bytes.NewReader(p)).Decode(w)
320319
if err == nil {
321320
return len(p), nil

0 commit comments

Comments
 (0)