WriteTo writes the XML representation of the text to the provided writer.
(w TokenWriter)
| 202 | |
| 203 | // WriteTo writes the XML representation of the text to the provided writer. |
| 204 | func (t *Text) WriteTo(w TokenWriter) error { |
| 205 | if t.CData { |
| 206 | if _, err := w.WriteString("<![CDATA["); err != nil { |
| 207 | return err |
| 208 | } |
| 209 | } |
| 210 | if _, err := w.Write(t.Data); err != nil { |
| 211 | return err |
| 212 | } |
| 213 | if t.CData { |
| 214 | if _, err := w.WriteString("]]>"); err != nil { |
| 215 | return err |
| 216 | } |
| 217 | } |
| 218 | return nil |
| 219 | } |