update canonical string replacers
diff --git a/etree.go b/etree.go
index 218c633..fb09323 100644
--- a/etree.go
+++ b/etree.go
@@ -696,12 +696,16 @@
"&", "&",
"<", "<",
">", ">",
+ "\r", "
",
)
var xmlReplacerCanonicalAttrVal = strings.NewReplacer(
"&", "&",
"<", "<",
`"`, """,
+ "\t", "	",
+ "\n", "
",
+ "\r", "
",
)
// writeTo serializes the attribute to the writer.
diff --git a/etree_test.go b/etree_test.go
index e206e3b..d8b4d3f 100644
--- a/etree_test.go
+++ b/etree_test.go
@@ -173,11 +173,11 @@
jon := people.CreateElement("Person")
jon.CreateAttr("name", "Jon O'Reilly")
- jon.SetText("<'\">&")
+ jon.SetText("\r<'\">&")
sally := people.CreateElement("Person")
sally.CreateAttr("name", "Sally")
- sally.CreateAttr("escape", "<'\">&")
+ sally.CreateAttr("escape", "\r\n\t<'\">&")
doc.Indent(2)
s, err := doc.WriteToString()
@@ -188,8 +188,8 @@
expected := BOM + `<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<People>
<!--These are all known people-->
- <Person name="Jon O'Reilly"><'">&</Person>
- <Person name="Sally" escape="<'">&"></Person>
+ <Person name="Jon O'Reilly">
<'">&</Person>
+ <Person name="Sally" escape="
	<'">&"></Person>
</People>
`
checkEq(t, s, expected)