void element_print(scew_element const* element, FILE* out, unsigned int indent) { unsigned int closed = 0; XML_Char const* contents; scew_element* child = NULL; scew_attribute* attribute = NULL; if (element == NULL) { return; } indent_print(out, indent); scew_fprintf(out, _XT("<%s"), scew_element_name(element)); attribute = NULL; while ((attribute = scew_attribute_next(element, attribute)) != NULL) { attribute_print(attribute, out); } contents = scew_element_contents(element); if ((contents == NULL) && (element->child == NULL) && (element->parent != NULL)) { scew_fprintf(out, _XT("/>\n")); closed = 1; } else { scew_fprintf(out, _XT(">")); if (contents == NULL) { scew_fprintf(out, _XT("\n")); } } child = NULL; while ((child = scew_element_next(element, child)) != NULL) { element_print(child, out, indent + 1); } if (contents != NULL) { scew_fprintf(out, _XT("%s"), contents); } else if (!closed) { indent_print(out, indent); } if (!closed) { scew_fprintf(out, _XT("</%s>\n"), scew_element_name(element)); } }
DLLIMPORT void *Attribute_Next( void *_parent, void *_attribute ) { return scew_attribute_next( (scew_element*)_parent, (scew_attribute*)_attribute ); }