ReadFromString reads XML from the string 's' into this document.
(s string)
| 399 | |
| 400 | // ReadFromString reads XML from the string 's' into this document. |
| 401 | func (d *Document) ReadFromString(s string) error { |
| 402 | if d.ReadSettings.ValidateInput { |
| 403 | if err := validateXML(strings.NewReader(s), d.ReadSettings); err != nil { |
| 404 | return err |
| 405 | } |
| 406 | } |
| 407 | _, err := d.Element.readFrom(strings.NewReader(s), d.ReadSettings) |
| 408 | return err |
| 409 | } |
| 410 | |
| 411 | // validateXML determines if the data read from the reader 'r' contains |
| 412 | // well-formed XML according to the rules set by the go xml package. |