升级xml解析
This commit is contained in:
7
xml.go
7
xml.go
@ -10,6 +10,7 @@ package serialize
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/xml"
|
||||
"github.com/sbabiv/xml2map"
|
||||
"io"
|
||||
)
|
||||
|
||||
@ -20,7 +21,11 @@ var (
|
||||
type ownXml struct{}
|
||||
|
||||
func (o *ownXml) UnmarshalWithNumber(byteData []byte, receiver any) error {
|
||||
return xml.NewDecoder(bytes.NewReader(byteData)).Decode(receiver)
|
||||
res, err := xml2map.NewDecoder(bytes.NewReader(byteData)).Decode()
|
||||
if nil != err {
|
||||
return err
|
||||
}
|
||||
return JSON.Transition(res, receiver)
|
||||
}
|
||||
|
||||
func (o *ownXml) UnmarshalWithNumberIgnoreError(byteData []byte, receiver any) {
|
||||
|
Reference in New Issue
Block a user