@@ -29,9 +29,7 @@ import (
2929)
3030
3131// Properties wraps any number of custom properties
32- type Properties struct {
33- Property []* Property `xml:"property"`
34- }
32+ type Properties []* Property
3533
3634// Property is used for custom properties
3735type Property struct {
@@ -49,7 +47,7 @@ type Property struct {
4947// Get finds all properties by specified name
5048func (p Properties ) Get (name string ) []string {
5149 var values []string
52- for _ , property := range p . Property {
50+ for _ , property := range p {
5351 if property .Name == name {
5452 values = append (values , property .Value )
5553 }
@@ -60,7 +58,7 @@ func (p Properties) Get(name string) []string {
6058// GetString finds first string property by specified name
6159func (p Properties ) GetString (name string ) string {
6260 var v string
63- for _ , property := range p . Property {
61+ for _ , property := range p {
6462 if property .Name == name {
6563 if property .Type == "" {
6664 return property .Value
@@ -74,7 +72,7 @@ func (p Properties) GetString(name string) string {
7472
7573// GetBool finds first bool property by specified name
7674func (p Properties ) GetBool (name string ) bool {
77- for _ , property := range p . Property {
75+ for _ , property := range p {
7876 if property .Name == name && property .Type == "boolean" {
7977 return property .Value == "true"
8078 }
@@ -84,7 +82,7 @@ func (p Properties) GetBool(name string) bool {
8482
8583// GetInt finds first int property by specified name
8684func (p Properties ) GetInt (name string ) int {
87- for _ , property := range p . Property {
85+ for _ , property := range p {
8886 if property .Name == name && property .Type == "int" {
8987 v , err := strconv .Atoi (property .Value )
9088 if err != nil {
@@ -98,7 +96,7 @@ func (p Properties) GetInt(name string) int {
9896
9997// GetFloat finds first float property by specified name
10098func (p Properties ) GetFloat (name string ) float64 {
101- for _ , property := range p . Property {
99+ for _ , property := range p {
102100 if property .Name == name && property .Type == "float" {
103101 v , err := strconv .ParseFloat (property .Value , 64 )
104102 if err != nil {
0 commit comments