Add wildcard support for node names. Allows selecting of all child nodes with a specific namespace (See issue #4).
This commit is contained in:
parent
29e84b1aeb
commit
2a2a591c08
5 changed files with 46 additions and 10 deletions
18
xmlx_test.go
18
xmlx_test.go
|
@ -20,7 +20,23 @@ func TestLoadLocal(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestLoadRemote(t *testing.T) {
|
||||
func TestWildcard(t *testing.T) {
|
||||
doc := New()
|
||||
|
||||
if err := doc.LoadFile("test2.xml"); err != nil {
|
||||
t.Error(err.String())
|
||||
return
|
||||
}
|
||||
|
||||
list := doc.SelectNodes("xdc", "*")
|
||||
|
||||
if len(list) != 8 {
|
||||
t.Errorf("Wrong number of child elements. Expected 4, got %d.", len(list))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func _TestLoadRemote(t *testing.T) {
|
||||
doc := New()
|
||||
|
||||
if err := doc.LoadUri("http://blog.golang.org/feeds/posts/default"); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue