Implement text nodes / content escaping
This removes the support for re-indenting XML, but allows to faithfully parse / stringify a document. Beautification could be added again later on if desired.
This commit is contained in:
parent
08c0943149
commit
b3124cf4a7
4 changed files with 57 additions and 39 deletions
|
@ -117,7 +117,9 @@ func (this *Document) LoadStream(r io.Reader, charset CharsetFunc) (err error) {
|
|||
case xml.SyntaxError:
|
||||
return errors.New(tt.Error())
|
||||
case xml.CharData:
|
||||
ct.Value = ct.Value + strings.TrimSpace(string([]byte(tt)))
|
||||
t := NewNode(NT_TEXT)
|
||||
t.Value = string([]byte(tt))
|
||||
ct.AddChild(t)
|
||||
case xml.Comment:
|
||||
t := NewNode(NT_COMMENT)
|
||||
t.Value = strings.TrimSpace(string([]byte(tt)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue