Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-25 Thread Matt Harden
When you leave the namespace out, it will match that tag in *any* namespace (or none). On Mon, Jul 24, 2017 at 11:56 PM Konstantin Khomoutov wrote: > On Mon, Jul 24, 2017 at 07:44:33PM -0700, emartinez1...@gmail.com wrote: > > [...] > >>> So I'm trying to unmarshal an XML with

Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-25 Thread Konstantin Khomoutov
On Mon, Jul 24, 2017 at 07:44:33PM -0700, emartinez1...@gmail.com wrote: [...] >>> So I'm trying to unmarshal an XML with namespaces in go but i just can't >>> find the right parser to do so. [...] >> type Root struct { >> XMLName struct{} `xml:"urn:MNResultsResults MNResultsResults"`

Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-24 Thread Tamás Gulácsi
No, you don't declare the namespace, but specify that which namespace the tag you're searching for is in. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-24 Thread emartinez1847
Thanks!. XMLName struct{} `xml:"urn:MNResultsResults MNResultsResults"` Cpcs []float64 `xml:"urn:MNResultsResults ssResultSet>ssResult>cpc"` Is there any reason to declare the namespace 2 times? At first we declare XMLName (which doesn't seem to be used) and then we use

Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-24 Thread Konstantin Khomoutov
On Sun, Jul 23, 2017 at 01:51:41PM -0700, emartinez1...@gmail.com wrote: Hi! > So I'm trying to unmarshal an XML with namespaces in go but i just can't > find the right parser to do so. [...] This (elided for brewity) 8< package main import ( "fmt"

[go-nuts] Parsing XML with namespaces in golang

2017-07-23 Thread emartinez1847
Hello, So I'm trying to unmarshal an XML with namespaces in go but i just can't find the right parser to do so. My code: package main import "fmt" import "encoding/xml" type Root struct { MNResultsResults []ls `xml:"xmlns ls, MNResultsResults>ssResultSet>ssResult"` } type ls struct {