| 115 | } |
| 116 | |
| 117 | func TestDefaultNamespace_2(t *testing.T) { |
| 118 | s := `<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 119 | <svg |
| 120 | xmlns="http://www.w3.org/2000/svg" |
| 121 | xmlns:svg="http://www.w3.org/2000/svg" |
| 122 | > |
| 123 | <text xml:space="preserve"> |
| 124 | <tspan>Multiline</tspan> |
| 125 | <tspan>Multiline text</tspan> |
| 126 | </text> |
| 127 | </svg>` |
| 128 | |
| 129 | doc, err := Parse(strings.NewReader(s)) |
| 130 | if err != nil { |
| 131 | t.Fatal(err) |
| 132 | } |
| 133 | if n := FindOne(doc, "//svg"); n == nil { |
| 134 | t.Fatal("should find a `svg` but got nil") |
| 135 | } |
| 136 | list := Find(doc, "//tspan") |
| 137 | if found, expected := len(list), 2; found != expected { |
| 138 | t.Fatalf("should found %d tspan but found %d", expected, found) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | func TestDefaultNamespace_3(t *testing.T) { |
| 143 | // https://github.com/antchfx/xmlquery/issues/67 |