XML Parser in C (Start to Finish)

preview_player
Показать описание
Hello everyone! Thank you for your patience with me. My life has been exceptionally crazy, and I didn't get this out as quickly as I had hoped. But it's here now! Please enjoy, and I hope you learn something!

If you happen to find any errors that I missed, please feel free to drop some comments, or submit a PR on GitHub!

TIMESTAMPS
0:53 Basics, Inner Text
34:57 Attributes
55:57 Children
1:08:35 Comments
1:21:12 XML Declaration
1:37:40 Inline Nodes
1:44:19 More Helper Functions
1:53:26 Write Document Out

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

As everyone said... change your font to for example +4-5 points. And... your video is really amazing. Good format. Continue!

nitroflap
Автор

This is extremely helpful and fantastically explained. Thank you so much.

grengren
Автор

Hi, I found this video very interesting and informative. I needed an xml parser for a project I am working on and used this video for a reference, so thanks for the help! I do think I found a few possible memory leaks that I thought I might point out in case you want to fix them. I put them below.

1. I believe your free_node function should also be freeing the children nodes like how you free the attributes, otherwise you would just be freeing the root node when you call xml. You would also need to free the list the children.data variable and the attribute.data variable in each node.

2. You should also free the version and encoding variables stored in Xml in free_xml.

3. At the start of the xml load function you allocate memory to hold all the chars in the xml file. At the end of the load function you can free the buf variable as you have already copied all the relevant string data.

Overall, I really enjoyed the video and learned a lot. Thanks!

maxdenning
Автор

could you do a json parser next? nobody has made a c json parser from scratch. that would be helpful.

lilyscarlet
Автор

Very interesting. Although couple of things aren't addressed but is moderate xml parser, most importantly written in C and is minimal and robust. I quickly reviewed source on github, it is a very good starting point for the ones willing to build parsers. I tried your provided source with a sample SVG and it did quit parsing at "Value has no key\n".

thank you for sharing, keep up.

Shirani
Автор

Hii sir please post like this things we are waiting for your videos 😊

dhanviakash
Автор

Great video!
But there are lot of memory leaks from Part-2. How do we handle it?

Ranjith
Автор

I make one library just to generate snippets file for visual studio from json file /! I don’t know what json file for in general!/

__hannibaalbarca__
Автор

very good video. But i clone the repository and once i compile it, i had this error:

``` In file included from test.c:1:
lxml.h: In function ‘node_out’:
lxml.h:416:31: warning: '0' flag used with ‘%s’ gnu_printf format [-Wformat=]
416 | fprintf(file, "%0*s", indent * times, " ");
| ^
lxml.h:436:39: warning: '0' flag used with ‘%s’ gnu_printf format [-Wformat=]
436 | fprintf(file, "%0*s", indent * times, " ");
```

any idea?!

fuemedicalcenter
Автор

You should check for comments at the beginning of the document. You should also use if to check for a close tag and else to check for a open tag. if buf ="<" and buf+1 == "/" it is a close tag else it is an open tag. You could even add an error check by adding another and to that if to see if what comes next is not = to the last open tag meaning there is a missing close.

excitedbox
Автор

Please increase the font size probably from next video atleast...

rakshiths.n
Автор

Great video, but lots of memory leaks i suppose...

bloginoobs
Автор

People are like, don't worry, C is so much better than other languages and then they spend 3 years trying to properly allocate memory for a hello world app so there's no memory leaks.

prestonwallitsch
Автор

Please avoid using back themes in video, hurts our eyes if we look at them during daylight

valiobozhinov