DecodeElement works like xml.Unmarshal except that it takes a pointer to the start XML element to decode into v. It is useful when a client reads some raw XML tokens itself but also wants to defer to Unmarshal for some elements.
(v interface{}, start *StartElement)
| 125 | // It is useful when a client reads some raw XML tokens itself |
| 126 | // but also wants to defer to Unmarshal for some elements. |
| 127 | func (d *Decoder) DecodeElement(v interface{}, start *StartElement) error { |
| 128 | val := reflect.ValueOf(v) |
| 129 | if val.Kind() != reflect.Ptr { |
| 130 | return errors.New("non-pointer passed to Unmarshal") |
| 131 | } |
| 132 | return d.unmarshal(val.Elem(), start) |
| 133 | } |
| 134 | |
| 135 | // An UnmarshalError represents an error in the unmarshalling process. |
| 136 | type UnmarshalError string |
no test coverage detected