checking in- needs some refinement then done
This commit is contained in:
47
netsplit/funcs_ianabool.go
Normal file
47
netsplit/funcs_ianabool.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package netsplit
|
||||
|
||||
import (
|
||||
`encoding/xml`
|
||||
`errors`
|
||||
`io`
|
||||
`strings`
|
||||
)
|
||||
|
||||
func (i *IANABool) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error) {
|
||||
|
||||
var tok xml.Token
|
||||
|
||||
for {
|
||||
if tok, err = d.Token(); err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
err = nil
|
||||
break
|
||||
}
|
||||
return
|
||||
}
|
||||
switch t := tok.(type) {
|
||||
case xml.CharData:
|
||||
switch strings.TrimSpace(string(t)) {
|
||||
case ianaTrue:
|
||||
i.Evaluated = new(bool)
|
||||
*i.Evaluated = true
|
||||
case ianaFalse:
|
||||
i.Evaluated = new(bool)
|
||||
*i.Evaluated = false
|
||||
case ianaNA:
|
||||
i.Applicable = new(bool)
|
||||
*i.Applicable = false
|
||||
/*
|
||||
default:
|
||||
fmt.Printf("Unknown bool: %s\n", tok)
|
||||
*/
|
||||
}
|
||||
/*
|
||||
default:
|
||||
spew.Dump(t)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user