WriteTo writes the XML representation of the processing instruction to the provided writer.
(w TokenWriter)
| 164 | |
| 165 | // WriteTo writes the XML representation of the processing instruction to the provided writer. |
| 166 | func (p *ProcInst) WriteTo(w TokenWriter) error { |
| 167 | if _, err := w.WriteString("<?"); err != nil { |
| 168 | return err |
| 169 | } |
| 170 | if _, err := w.Write(p.Target); err != nil { |
| 171 | return err |
| 172 | } |
| 173 | if len(p.Inst) > 0 { |
| 174 | if !isSpace(p.Inst[0]) { |
| 175 | if err := w.WriteByte(' '); err != nil { |
| 176 | return err |
| 177 | } |
| 178 | } |
| 179 | if _, err := w.Write(p.Inst); err != nil { |
| 180 | return err |
| 181 | } |
| 182 | } |
| 183 | if _, err := w.WriteString("?>"); err != nil { |
| 184 | return err |
| 185 | } |
| 186 | return nil |
| 187 | } |
| 188 | |
| 189 | // Text represents a text token. |
| 190 | // CData indicates whether the text is a CDATA section. |