From b9064fb13287c49ba978715af6da797428dcb77d Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Tue, 13 Dec 2011 13:52:47 +1100 Subject: html: a first step at parsing foreign content (MathML, SVG). Nodes now have a Namespace field. Pass adoption01.dat, test 12:
| | | | | | | The other adoption01.dat tests already passed. R=andybalholm CC=golang-dev https://golang.org/cl/5467075 --- src/pkg/html/parse_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/pkg/html/parse_test.go') diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index 8f8787886c..0eba283b98 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -98,7 +98,11 @@ func dumpLevel(w io.Writer, n *Node, level int) error { case DocumentNode: return errors.New("unexpected DocumentNode") case ElementNode: - fmt.Fprintf(w, "<%s>", n.Data) + if n.Namespace != "" { + fmt.Fprintf(w, "<%s %s>", n.Namespace, n.Data) + } else { + fmt.Fprintf(w, "<%s>", n.Data) + } for _, a := range n.Attr { io.WriteString(w, "\n") dumpIndent(w, level+1) @@ -161,6 +165,7 @@ func TestParser(t *testing.T) { n int }{ // TODO(nigeltao): Process all the test cases from all the .dat files. + {"adoption01.dat", -1}, {"doctype01.dat", -1}, {"tests1.dat", -1}, {"tests2.dat", -1}, -- cgit v1.3