Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool print_xml(Printer *p, XML_Node *node)
- {
- bool success;
- success =
- print(p, '<') &&
- print(p, node->tag);
- if (!success) return false;
- for (U32 i = 0; i < node->attribute_count; i++) {
- XML_Attribute attr = node->attributes[i];
- success =
- print(p, ' ') &&
- print(p, attr.key) &&
- print(p, "=\"") &&
- print(p, attr.value) &&
- print(p, '"');
- if (!success) return false;
- }
- if (!print(&p, '>')) return false;
- for (XML_Node *child = node->children; child; child = child->next) {
- if (!print_xml(p, node)) return false;
- }
- success =
- print(p, "</") &&
- print(p, node->tag) &&
- print(p, '>');
- if (!success) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement