/* * Internal header */ #ifndef TREE_TRANSFORM_H #define TREE_TRANSFORM_H typedef apr_status_t(*xml2_tree_transform) (void *tctx, xmlDocPtr doc); /** * Create a filter for a given tree transformation. * @param f - The current filter. The newly created filter will pass its buckets * to f->next. * @param sax - The sax context that will be used to create a sax context * to use for the buckets that are * created after the tree transformation. If NULL is passed here, * this can be set before the filter is run using * transform_filter_set_sax. * @param transform - The function used for the tree transformation. * @param param - Will be passed to each transform call. * @return The filter that has been created. */ ap_filter_t *transform_filter_create(ap_filter_t * f, sax_ctx *sax, xml2_tree_transform transform, void *param); /** * Set the SAX context for a given tree transformation filter. * @param f - he transform filter. * @param sax - The sax context that will be used to create a sax context * to use for the buckets that are * created after the tree transformation. */ void transform_filter_set_sax(ap_filter_t * f, sax_ctx *sax); /** * Make shure the y chain is set up correct. */ void transform_filter_y_connect(ap_filter_t * trans_filter, ap_filter_t *f); /** * Create leading buckets for a document. * @param sax - The SAX context to use * @param bb_out - The outgoing brigade to append buckets * @param b_xml_decl - An XML_DECL bucket that is copied to use. * @param namespaces - The namespaces in use. * @return APR_SUCCESS on success. */ apr_status_t transform_start_faked_doc(sax_ctx * sax, apr_bucket_brigade * bb_out, apr_bucket * b_xml_decl, apr_array_header_t * namespaces); /** * Create trailing buckets for a document. * @param sax - The SAX context to use * @param bb_out - The outgoing brigade to append buckets * @param namespaces - The namespaces in use. * @return APR_SUCCESS on success. */ apr_status_t transform_end_faked_doc(sax_ctx * sax, apr_bucket_brigade * bb_out, apr_array_header_t * namespaces); /** * Dump a libxml2 document to the log. * @param file - the current source file (usually from APLOG_MARK) * @param line - the current source line * @param r - the request * @param doc - will be dumped */ void xml2_tree_log_filter_chain(const char *file, int line, ap_filter_t *f); // internal, no need to call these int xml2_tree_filter_init(ap_filter_t * f); int xml2_tree_filter(ap_filter_t * f, apr_bucket_brigade * bb); #endif