diff --git a/node_test.go b/node_test.go
index 21a2d31..0c571ef 100644
--- a/node_test.go
+++ b/node_test.go
@@ -658,3 +658,13 @@ func TestDirectiveNode(t *testing.T) {
t.Errorf(`expected "%s", obtained "%s"`, expected, v)
}
}
+
+func TestOutputXMLWithSingleQuotes(t *testing.T) {
+ s := ``
+ expected := ``
+ doc, _ := Parse(strings.NewReader(s))
+ output := doc.OutputXML(false)
+ if expected != output {
+ t.Errorf(`expected "%s", obtained "%s"`, expected, output)
+ }
+}
diff --git a/parse.go b/parse.go
index daf7233..7627f46 100644
--- a/parse.go
+++ b/parse.go
@@ -266,7 +266,7 @@ func (p *parser) parse() (*Node, error) {
for _, pair := range pairs {
pair = strings.TrimSpace(pair)
if i := strings.Index(pair, "="); i > 0 {
- AddAttr(node, pair[:i], strings.Trim(pair[i+1:], `"`))
+ AddAttr(node, pair[:i], strings.Trim(pair[i+1:], `"'`))
}
}
if p.level == p.prev.level {