Parsing XML - Go Lang Practical Programming Tutorial p.11

preview_player
Показать описание
Welcome to part 11 of the Go programming tutorial series. In this tutorial, we're going to cover how we can go about parsing this XML document.

Рекомендации по теме
Комментарии
Автор

In computer science, marshalling or marshaling is the process of transforming the memory representation of an object to a data format suitable for storage or transmission, and it is typically used when data must be moved between different parts of a computer program or from one program to another.

VipinBalakrishnan
Автор

I don't get it bro. We defined the method String() on the location struct but we never called it the way we did in the previous tutorial when we called a_car.kmh and a_car.mph. Can you please explain?

djsamke
Автор

I was using GORM, didn't know that we had to give capital names. Was stuck on it for 2 hours. Somehow this video helped. Thanks. :)

rahulmysore
Автор

Hi. Where did you called a method in main function (6:30)? Best

zmajew
Автор

Hi! How come the curly braces disappear even though the String() method, created at 6:30, isn't called? Thx

jims
Автор

Dude!!! You saved my life. Thank you so much

alihejazi
Автор

For others who may have same difficulty. I think it somewhat works like css selectors.
Take notice that he copied the result and commented it into the file and the xml tags are `xml:"sitemap"` and `xml:"loc"` respectively <sitemap> and <loc> from the response.

hoodedwarrior
Автор

Where did we call the string method, I did define the method but I still receive objects

hendrykhoza
Автор

I really don't understand how the String function created works without calling it. Any explanation anyone?

olasunkanmiolayinka
Автор

Any chance you can do a video on decoding JSON as well?

niprjct
Автор

How would you get the attributes from xml tags at a specific node or something?

findjonmoses
Автор

Thanks sent for these lovely tutorials

aniltheblogger
Автор

It's not clear to me at all what is happening here. Until I started learning Go, I had never ever heard the term "marshal" or "unmarshal" used in this context, so I'm not sure what that means, although I can guess from context. I also do not understand what `xml: "loc"` in the Location struct, or the similar line in the SiteMapIndex struct. Without know those things, this video doesn't make any sense.

jneiberger
Автор

Are there any good resources explaining marshalling / unmarshalling as general terms not related to any one particular language? There are a few Wiki pages, but I couldn't find anything else with a quick search.

rypiv
Автор

I'm having trouble understanding the struct constructions here. For example, when you define Locations []string `xml:"sitemap>loc"` in the SitemapIndex struct, how does the description `xml:"sitemap>loc"` actually work? Is that some sort of regular expression? I'll really appreciate it if someone could reply!

sedonaslullabies
Автор

All I get back is [ ] and it is empty?

nigelpallatt
Автор

Why did the String() method work without being called ??

tansvideos
Автор

Does anyone have the latest link for the index as of 2021?

nonelanyongo
Автор

Another thing I don't understand that you just kind of blew through: If I understand correctly, adding a String() method to a struct is essentially the method that gets called anytime you want to print the struct?

jneiberger
Автор

Since l.Loc is already a string, why cant you just return l.Loc. Why do we need to use fmt.Sprintf ?

jacobenders