Replace xml lib
This commit is contained in:
parent
21548f76b6
commit
afe338f3d8
|
@ -0,0 +1,28 @@
|
|||
package goonvif
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.pyer.club/kingecg/goonvif/onvif/media"
|
||||
"git.pyer.club/kingecg/goxml"
|
||||
)
|
||||
|
||||
func TestDecodeGetProfile(t *testing.T) {
|
||||
type Envelope struct {
|
||||
Header struct{}
|
||||
Body struct {
|
||||
GetProfilesResponse media.GetProfilesResponse
|
||||
}
|
||||
}
|
||||
data, err := os.ReadFile("result.xml")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
e := Envelope{}
|
||||
de := goxml.Unmarshal(data, &e)
|
||||
if de != nil {
|
||||
t.Fatal(de)
|
||||
}
|
||||
t.Log(e.Body.GetProfilesResponse)
|
||||
}
|
1
go.mod
1
go.mod
|
@ -12,6 +12,7 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
git.pyer.club/kingecg/goxml v1.0.1 // indirect
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,3 +1,7 @@
|
|||
git.pyer.club/kingecg/goxml v1.0.0 h1:csJ+gcWjTvMTy2pR4XpYLoevTro8hT7l1kpoUt4Xmpw=
|
||||
git.pyer.club/kingecg/goxml v1.0.0/go.mod h1:w/5zeL8crK/Be3k+RxEn4NNzQ/ybqZuU3uplw86mTt4=
|
||||
git.pyer.club/kingecg/goxml v1.0.1 h1:V2PbUSDkoq4gQUqkFO4zud+41GtSKq28A24lDeLkXaM=
|
||||
git.pyer.club/kingecg/goxml v1.0.1/go.mod h1:w/5zeL8crK/Be3k+RxEn4NNzQ/ybqZuU3uplw86mTt4=
|
||||
github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
|
||||
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package onvif
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
@ -10,6 +9,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
xml "git.pyer.club/kingecg/goxml"
|
||||
|
||||
"git.pyer.club/kingecg/goonvif/onvif/device"
|
||||
"git.pyer.club/kingecg/goonvif/onvif/gosoap"
|
||||
"git.pyer.club/kingecg/goonvif/onvif/networking"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package gosoap
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"log"
|
||||
|
||||
xml "git.pyer.club/kingecg/goxml"
|
||||
|
||||
"github.com/beevik/etree"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package gosoap
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
xml "git.pyer.club/kingecg/goxml"
|
||||
)
|
||||
|
||||
// Xlmns XML Scheam
|
||||
|
|
|
@ -3,15 +3,20 @@ package gosoap
|
|||
import (
|
||||
"crypto/sha1"
|
||||
"encoding/base64"
|
||||
"encoding/xml"
|
||||
"time"
|
||||
|
||||
xml "git.pyer.club/kingecg/goxml"
|
||||
|
||||
"github.com/elgs/gostrgen"
|
||||
)
|
||||
|
||||
/*************************
|
||||
/*
|
||||
************************
|
||||
|
||||
WS-Security types
|
||||
*************************/
|
||||
|
||||
************************
|
||||
*/
|
||||
const (
|
||||
passwordType = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"
|
||||
encodingType = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
|
||||
|
|
|
@ -2,12 +2,13 @@ package sdk
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
xml "git.pyer.club/kingecg/goxml"
|
||||
|
||||
"github.com/beevik/etree"
|
||||
"github.com/juju/errors"
|
||||
"github.com/rs/zerolog"
|
||||
|
|
|
@ -358,7 +358,7 @@ type Profile struct {
|
|||
type VideoSourceConfiguration struct {
|
||||
ConfigurationEntity
|
||||
ViewMode string `xml:"ViewMode,attr"`
|
||||
SourceToken ReferenceToken `xml:"onvif:SourceToken"`
|
||||
SourceToken ReferenceToken `xml:"tt:SourceToken"`
|
||||
Bounds IntRectangle `xml:"onvif:Bounds"`
|
||||
Extension *VideoSourceConfigurationExtension `xml:"onvif:Extension"`
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package search
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"testing"
|
||||
|
||||
xml "git.pyer.club/kingecg/goxml"
|
||||
|
||||
xsd "git.pyer.club/kingecg/goonvif/onvif/xsd"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue