libwget-xml(3)

πŸ’– NAME πŸ’–

libwget-xml β€” XML parsing functions, bestie πŸ’…

okay so this is the libwget xml page, it lives in the Library Functions Manual, and it's giving "everything you need to read XML and HTML without losing your mind" ✨


πŸŽ€ SYNOPSIS πŸŽ€

✨ Functions ✨

int wget_xml_parse_buffer (const char *buf, wget_xml_callback *callback, void *user_ctx, int hints)
void wget_html_parse_buffer (const char *buf, wget_xml_callback *callback, void *user_ctx, int hints)
void wget_xml_parse_file (const char *fname, wget_xml_callback *callback, void *user_ctx, int hints)
void wget_html_parse_file (const char *fname, wget_xml_callback *callback, void *user_ctx, int hints)
char * wget_xml_decode_entities_inline (char *src)

πŸ¦‹ Detailed Description πŸ¦‹

(no cap, this section is literally just the title, the actual tea is all down in the function docs πŸ‘‡)


πŸ‘‘ Function Documentation πŸ‘‘

πŸ’œ int wget_xml_parse_buffer (const char * buf, wget_xml_callback * callback, void * user_ctx, int hints)

🌸 Parameters 🌸

  • buf β€” zero-terminated XML or HTML input data, feed it the goods
  • callback β€” the function that gets called for each token scan result
  • user_ctx β€” your own user-defined context variable, it gets handed to the callback
  • hints β€” flags to influence parsing πŸ‘€

This one scans the XML input from buf and calls callback for each token it finds. user_ctx is your own user-defined context variable and it's given to every single call of callback. iykyk.

hints may be 0 or any combination of XML_HINT_REMOVE_EMPTY_CONTENT and XML_HINT_HTML.

  • XML_HINT_REMOVE_EMPTY_CONTENT β€” this one reduces the number of calls to callback by ignoring empty content and superfluous spaces. less spam, more slay ✨
  • XML_HINT_HTML β€” turns on HTML scanning πŸ’…

πŸ’œ void wget_html_parse_buffer (const char * buf, wget_xml_callback * callback, void * user_ctx, int hints)

🌸 Parameters 🌸

  • buf β€” zero-terminated HTML input data
  • callback β€” function called for each token scan result
  • user_ctx β€” user-defined context variable, handed to callback
  • hints β€” flags to influence parsing

It's the convenience function, bestie β€” it literally just calls wget_xml_parse_buffer() with HTML parsing turned on. so easy. periodt. πŸ’–


πŸ’œ void wget_xml_parse_file (const char * fname, wget_xml_callback * callback, void * user_ctx, int hints)

🌸 Parameters 🌸

  • fname β€” name of XML or HTML input file
  • callback β€” function called for each token scan result
  • user_ctx β€” user-defined context variable, handed to callback
  • hints β€” flags to influence parsing

Another convenience function β€” this one calls wget_xml_parse_buffer() with the file content. it's giving "I don't wanna read the file myself" energy and honestly, valid 🫢

If fname is -, the data is read from stdin. yes, the classic dash move 😌

πŸ’œ void wget_html_parse_file (const char * fname, wget_xml_callback * callback, void * user_ctx, int hints)

🌸 Parameters 🌸

  • fname β€” name of XML or HTML input file
  • callback β€” function called for each token scan result
  • user_ctx β€” user-defined context variable, handed to callback
  • hints β€” flags to influence parsing

Convenience function that calls wget_xml_parse_file() with HTML parsing turned on. so if you wanted HTML from a file, this is your main character moment 🌈

If fname is -, the data is read from stdin. same dash, same vibe πŸ’…

πŸ’œ char * wget_xml_decode_entities_inline (char * src)

🌸 Parameters 🌸

  • src β€” a string

🌸 Returns 🌸

  • A pointer to src, after the XML entities have been converted

Decode XML entities from src. πŸŽ€

⚠️ okay so listen β€” the transformation is done inline, so src will be modified after this function returns. it's not a copy situation, it's an in-place situation. If no XML entities have been found, src is left untouched.

Also ngl, only a small subset of available XML entities is currently recognized. not all of them, bestie. keep that in mind πŸ’€


🌟 Author 🌟

Generated automatically by Doxygen for wget2 from the source code. (not a human, just a robot doing its little thing πŸ€–βœ¨)


and that's the whole page!! this is libwget-xml(3) from wget2, Version 2.3.0 πŸ’– go parse something iconic, bestie πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from