Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get matched node names #17

Open
gaubert opened this issue Oct 29, 2015 · 1 comment
Open

How to get matched node names #17

gaubert opened this issue Oct 29, 2015 · 1 comment

Comments

@gaubert
Copy link

gaubert commented Oct 29, 2015

First I am a newbe in golang but I am trying to pass the XML test which is one of the most difficult one for a new language (Who wants to use XML anyway :-) ).

Is there a way to just print the node names that have been matched ?
See below in the iterator for each Node I would like to get only the node name by when I stringify it I get the complete node content.

capability_path := xmlpath.MustCompile("//Capability/Request/*")

root, err := xmlpath.Parse(reader)
if err != nil {
        log.Fatal(err)
}
iter := capability_path.Iter(root)
for iter.Next() {
         elem := iter.Node()
         fmt.Println("Found:[", elem.String(),"]")
    }

Thank in advance

@gaubert
Copy link
Author

gaubert commented Nov 11, 2015

@niemeyer any news on that one ?
Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant