Difference between revisions of "Xml (filter)"
From Mailutils
Jump to navigationJump to searchLine 18: | Line 18: | ||
mu_stream_t input; /* Input stream */ | mu_stream_t input; /* Input stream */ | ||
− | initialize_input_stream (& | + | initialize_input_stream (&input); |
rc = mu_filter_stream_create (&flt, input, "xml", MU_FILTER_DECODE, MU_STREAM_READ); | rc = mu_filter_stream_create (&flt, input, "xml", MU_FILTER_DECODE, MU_STREAM_READ); | ||
</source> | </source> |
Revision as of 18:48, 7 July 2014
In encode mode, the xml filter converts input stream (which must contain valid UTF-8 characters) into a form suitable for inclusion into a XML or HTML document, i.e. it replaces <, >, and & with <, >, and &, correspondingly, and replaces invalid characters with their numeric character reference representation.
In decode mode, a reverse operation is performed.
The filter does not take arguments.
The following object, declared in mailutils/filter.h describes the filter:
extern mu_filter_record_t mu_xml_filter;
The example below shows how to create an instance of this filter in encode mode for reading:
int rc; /* Return code */
mu_stream_t flt; /* Filter stream */
mu_stream_t input; /* Input stream */
initialize_input_stream (&input);
rc = mu_filter_stream_create (&flt, input, "xml", MU_FILTER_DECODE, MU_STREAM_READ);