#include <apr.h>
#include <apr_pools.h>
#include <apr_hash.h>
#include "svn_error.h"
#include "svn_string.h"
Go to the source code of this file.
Defines | |
#define | SVN_XML_NAMESPACE "svn:" |
The namespace all Subversion XML uses. | |
Typedefs | |
typedef svn_xml_parser_t | svn_xml_parser_t |
A generalized Subversion XML parser object. | |
typedef void(* | svn_xml_start_elem )(void *baton, const char *name, const char **atts) |
typedef void(* | svn_xml_end_elem )(void *baton, const char *name) |
typedef void(* | svn_xml_char_data )(void *baton, const char *data, apr_size_t len) |
Enumerations | |
enum | svn_xml_open_tag_style { svn_xml_normal = 1, svn_xml_protect_pcdata, svn_xml_self_closing } |
Used as style argument to svn_xml_make_open_tag() and friends. More... | |
Functions | |
svn_boolean_t | svn_xml_is_xml_safe (const char *data, apr_size_t len) |
Determine if a string of character data of length len is a safe bet for use with the svn_xml_escape_* functions found in this header. | |
void | svn_xml_escape_cdata_stringbuf (svn_stringbuf_t **outstr, const svn_stringbuf_t *string, apr_pool_t *pool) |
Create or append in *outstr an xml-escaped version of string, suitable for output as character data. | |
void | svn_xml_escape_cdata_string (svn_stringbuf_t **outstr, const svn_string_t *string, apr_pool_t *pool) |
Same as svn_xml_escape_cdata_stringbuf(), but string is an svn_string_t . | |
void | svn_xml_escape_cdata_cstring (svn_stringbuf_t **outstr, const char *string, apr_pool_t *pool) |
Same as svn_xml_escape_cdata_stringbuf(), but string is a null-terminated C string. | |
void | svn_xml_escape_attr_stringbuf (svn_stringbuf_t **outstr, const svn_stringbuf_t *string, apr_pool_t *pool) |
Create or append in *outstr an xml-escaped version of string, suitable for output as an attribute value. | |
void | svn_xml_escape_attr_string (svn_stringbuf_t **outstr, const svn_string_t *string, apr_pool_t *pool) |
Same as svn_xml_escape_attr_stringbuf(), but string is an svn_string_t . | |
void | svn_xml_escape_attr_cstring (svn_stringbuf_t **outstr, const char *string, apr_pool_t *pool) |
Same as svn_xml_escape_attr_stringbuf(), but string is a null-terminated C string. | |
const char * | svn_xml_fuzzy_escape (const char *string, apr_pool_t *pool) |
Return UTF-8 string string if it contains no characters that are unrepresentable in XML. | |
svn_xml_parser_t * | svn_xml_make_parser (void *baton, svn_xml_start_elem start_handler, svn_xml_end_elem end_handler, svn_xml_char_data data_handler, apr_pool_t *pool) |
Create a general Subversion XML parser. | |
void | svn_xml_free_parser (svn_xml_parser_t *svn_parser) |
Free a general Subversion XML parser. | |
svn_error_t * | svn_xml_parse (svn_xml_parser_t *parser, const char *buf, apr_size_t len, svn_boolean_t is_final) |
Push len bytes of xml data in buf at svn_parser. | |
void | svn_xml_signal_bailout (svn_error_t *error, svn_xml_parser_t *svn_parser) |
The way to officially bail out of xml parsing. | |
const char * | svn_xml_get_attr_value (const char *name, const char **atts) |
Return the value associated with name in expat attribute array atts, else return NULL . | |
apr_hash_t * | svn_xml_ap_to_hash (va_list ap, apr_pool_t *pool) |
Create an attribute hash from va_list ap. | |
apr_hash_t * | svn_xml_make_att_hash (const char **atts, apr_pool_t *pool) |
Create a hash that corresponds to Expat xml attribute list atts. | |
void | svn_xml_hash_atts_preserving (const char **atts, apr_hash_t *ht, apr_pool_t *pool) |
Like svn_xml_make_att_hash(), but takes a hash and preserves any key/value pairs already in it. | |
void | svn_xml_hash_atts_overlaying (const char **atts, apr_hash_t *ht, apr_pool_t *pool) |
Like svn_xml_make_att_hash(), but takes a hash and overwrites key/value pairs already in it that also appear in atts. | |
void | svn_xml_make_header (svn_stringbuf_t **str, apr_pool_t *pool) |
Create an XML header and return it in *str. | |
void | svn_xml_make_open_tag (svn_stringbuf_t **str, apr_pool_t *pool, enum svn_xml_open_tag_style style, const char *tagname,...) |
Store a new xml tag tagname in *str. | |
void | svn_xml_make_open_tag_v (svn_stringbuf_t **str, apr_pool_t *pool, enum svn_xml_open_tag_style style, const char *tagname, va_list ap) |
Like svn_xml_make_open_tag(), but takes a va_list instead of being variadic. | |
void | svn_xml_make_open_tag_hash (svn_stringbuf_t **str, apr_pool_t *pool, enum svn_xml_open_tag_style style, const char *tagname, apr_hash_t *attributes) |
Like svn_xml_make_open_tag(), but takes a hash table of attributes (char * keys mapping to char * values). | |
void | svn_xml_make_close_tag (svn_stringbuf_t **str, apr_pool_t *pool, const char *tagname) |
Makes a close tag. |
Definition in file svn_xml.h.
|
Used as style argument to svn_xml_make_open_tag() and friends.
|
|
Create an attribute hash from
The contents of ap are alternating |
|
Create or append in *outstr an xml-escaped version of string, suitable for output as an attribute value.
If *outstr is |
|
Create or append in *outstr an xml-escaped version of string, suitable for output as character data.
If *outstr is |
|
Return UTF-8 string string if it contains no characters that are unrepresentable in XML. Else, return a copy of string, allocated in pool, with each unrepresentable character replaced by "?\uuu", where "uuu" is the three-digit unsigned decimal value of that character. Neither the input nor the output need be valid XML; however, the output can always be safely XML-escaped.
|
|
Return the value associated with name in expat attribute array atts, else return
(There could never be a
atts is an array of c-strings: even-numbered indexes are names, odd-numbers hold values. If all is right, it should end on an even-numbered index pointing to |
|
Determine if a string of character data of length len is a safe bet for use with the svn_xml_escape_* functions found in this header.
Return Essentially, this function exists to determine whether or not simply running a string of bytes through the Subversion XML escape routines will produce legitimate XML. It should only be necessary for data which might contain bytes that cannot be safely encoded into XML (certain control characters, for example). |
|
Create a hash that corresponds to Expat xml attribute list atts.
The hash's keys and values are atts may be null, in which case you just get an empty hash back (this makes life more convenient for some callers). |
|
Create an XML header and return it in *str. Fully-formed XML documents should start out with a header, something like <?xml version="1.0" encoding="utf-8"?>
This function returns such a header. *str must either be |
|
Store a new xml tag tagname in *str.
If str is
Take the tag's attributes from varargs, a null-terminated list of alternating
style is one of the enumerated styles in |
|
Like svn_xml_make_open_tag(), but takes a hash table of attributes ( You might ask, why not just provide svn_xml_make_tag_atts()?
The reason is that a hash table is the most natural interface to an attribute list; the fact that Expat uses See conversion functions svn_xml_make_att_hash() and svn_xml_make_att_hash_overlaying(). Callers should use those to convert Expat attr lists into hashes when necessary. |
|
Push len bytes of xml data in buf at svn_parser. If this is the final push, is_final must be set. An error will be returned if there was a syntax problem in the XML, or if any of the callbacks set an error using svn_xml_signal_bailout().
If an error is returned, the |
|
The way to officially bail out of xml parsing.
Store error in svn_parser and set all expat callbacks to |