diff options
| author | Amrut Joshi <amrut.joshi@gmail.com> | 2010-02-18 23:32:55 -0800 |
|---|---|---|
| committer | Amrut Joshi <amrut.joshi@gmail.com> | 2010-02-18 23:32:55 -0800 |
| commit | 8644a7179ce64f0ffc827eb0991f3064b11efb4d (patch) | |
| tree | 4309d21eeea4de79b2926c3c50b81caf64a640bb /src/pkg/xml/xml_test.go | |
| parent | e1bc70d1ddfb8a925aa0f572081b6f681e3dee96 (diff) | |
| download | golang-8644a7179ce64f0ffc827eb0991f3064b11efb4d.tar.gz | |
xml: allow unquoted attribute values in non-Strict mode
HTML4 standard supports unquoted attibute values in certain cases
(http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2).
R=rsc
CC=golang-dev
http://codereview.appspot.com/207095
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/xml/xml_test.go')
| -rw-r--r-- | src/pkg/xml/xml_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pkg/xml/xml_test.go b/src/pkg/xml/xml_test.go index fa1949500..a4c55b73d 100644 --- a/src/pkg/xml/xml_test.go +++ b/src/pkg/xml/xml_test.go @@ -298,3 +298,23 @@ func TestIssue569(t *testing.T) { t.Fatalf("Expecting abcd") } } + +func TestUnquotedAttrs(t *testing.T) { + data := "<tag attr=azAZ09:-_\t>" + p := NewParser(StringReader(data)) + p.Strict = false + token, err := p.Token() + if _, ok := err.(SyntaxError); ok { + t.Errorf("Unexpected error: %v", err) + } + if token.(StartElement).Name.Local != "tag" { + t.Errorf("Unexpected tag name: %v", token.(StartElement).Name.Local) + } + attr := token.(StartElement).Attr[0] + if attr.Value != "azAZ09:-_" { + t.Errorf("Unexpected attribute value: %v", attr.Value) + } + if attr.Name.Local != "attr" { + t.Errorf("Unexpected attribute name: %v", attr.Name.Local) + } +} |
