(start *xml.StartElement)
| 186 | } |
| 187 | |
| 188 | func (xe *XMLEncoder) WriteStart(start *xml.StartElement) error { |
| 189 | if start.Name.Local == "" { |
| 190 | return fmt.Errorf("xml: start tag with no name") |
| 191 | } |
| 192 | if xe.CurStart != "" { |
| 193 | xe.WriteString(">") |
| 194 | xe.WriteEOL() |
| 195 | } |
| 196 | xe.WriteIndent() |
| 197 | xe.WriteString("<") |
| 198 | xe.WriteString(start.Name.Local) |
| 199 | xe.CurIndent++ |
| 200 | |
| 201 | xe.CurStart = start.Name.Local |
| 202 | |
| 203 | // Attributes |
| 204 | for _, attr := range start.Attr { |
| 205 | name := attr.Name |
| 206 | if name.Local == "" { |
| 207 | continue |
| 208 | } |
| 209 | xe.WriteEOL() |
| 210 | xe.WriteIndent() |
| 211 | xe.WriteString(name.Local) |
| 212 | xe.WriteString(`="`) |
| 213 | xe.EscapeString(attr.Value, false) |
| 214 | xe.WriteString(`"`) |
| 215 | } |
| 216 | return nil |
| 217 | } |
| 218 | |
| 219 | func (xe *XMLEncoder) WriteEnd(name string) error { |
| 220 | xe.CurIndent-- |
no test coverage detected