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 (
|
require (
|
||||||
|
git.pyer.club/kingecg/goxml v1.0.1 // indirect
|
||||||
github.com/bytedance/sonic v1.11.6 // indirect
|
github.com/bytedance/sonic v1.11.6 // indirect
|
||||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||||
github.com/cloudwego/base64x v0.1.4 // 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 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
|
||||||
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
|
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
|
||||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package onvif
|
package onvif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
|
||||||
"errors"
|
"errors"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -10,6 +9,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
xml "git.pyer.club/kingecg/goxml"
|
||||||
|
|
||||||
"git.pyer.club/kingecg/goonvif/onvif/device"
|
"git.pyer.club/kingecg/goonvif/onvif/device"
|
||||||
"git.pyer.club/kingecg/goonvif/onvif/gosoap"
|
"git.pyer.club/kingecg/goonvif/onvif/gosoap"
|
||||||
"git.pyer.club/kingecg/goonvif/onvif/networking"
|
"git.pyer.club/kingecg/goonvif/onvif/networking"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package gosoap
|
package gosoap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
xml "git.pyer.club/kingecg/goxml"
|
||||||
|
|
||||||
"github.com/beevik/etree"
|
"github.com/beevik/etree"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package gosoap
|
package gosoap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
xml "git.pyer.club/kingecg/goxml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Xlmns XML Scheam
|
// Xlmns XML Scheam
|
||||||
|
|
|
@ -3,15 +3,20 @@ package gosoap
|
||||||
import (
|
import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/xml"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
xml "git.pyer.club/kingecg/goxml"
|
||||||
|
|
||||||
"github.com/elgs/gostrgen"
|
"github.com/elgs/gostrgen"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*************************
|
/*
|
||||||
|
************************
|
||||||
|
|
||||||
WS-Security types
|
WS-Security types
|
||||||
*************************/
|
|
||||||
|
************************
|
||||||
|
*/
|
||||||
const (
|
const (
|
||||||
passwordType = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"
|
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"
|
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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/xml"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
xml "git.pyer.club/kingecg/goxml"
|
||||||
|
|
||||||
"github.com/beevik/etree"
|
"github.com/beevik/etree"
|
||||||
"github.com/juju/errors"
|
"github.com/juju/errors"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
|
|
|
@ -358,7 +358,7 @@ type Profile struct {
|
||||||
type VideoSourceConfiguration struct {
|
type VideoSourceConfiguration struct {
|
||||||
ConfigurationEntity
|
ConfigurationEntity
|
||||||
ViewMode string `xml:"ViewMode,attr"`
|
ViewMode string `xml:"ViewMode,attr"`
|
||||||
SourceToken ReferenceToken `xml:"onvif:SourceToken"`
|
SourceToken ReferenceToken `xml:"tt:SourceToken"`
|
||||||
Bounds IntRectangle `xml:"onvif:Bounds"`
|
Bounds IntRectangle `xml:"onvif:Bounds"`
|
||||||
Extension *VideoSourceConfigurationExtension `xml:"onvif:Extension"`
|
Extension *VideoSourceConfigurationExtension `xml:"onvif:Extension"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package search
|
package search
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
xml "git.pyer.club/kingecg/goxml"
|
||||||
|
|
||||||
xsd "git.pyer.club/kingecg/goonvif/onvif/xsd"
|
xsd "git.pyer.club/kingecg/goonvif/onvif/xsd"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue