#include #include #define ASSERT assert #define IMXML_SIMD_DEFAULT SSE2 #define IMXML_IMPLEMENTATION #include "imxml.h" int main (void) { ImxmlCharSequence const xml = "Hello, World!"IMXML_LIT_PAD; XmlParser p = { .head = xml, }; assert(xml_tag_expect(&p, "msg")); assert(xml_attr_expect(&p, "from")); ImxmlString const from = xml_value(&p); assert(xml_attr_expect(&p, "to")); ImxmlString const to = xml_value(&p); XmlContent content = xml_content(&p); assert(content.type == XML_CONTENT_TEXT); ImxmlString msg = content.data; assert(xml_content(&p).type == XML_CONTENT_TAG); printf("%.*s->%.*s: '%.*s'\n", (int)from.count, from.items, (int)to.count, to.items, (int)msg.count, msg.items); }