XML
[APR Utility Functions]


Namespaces

namespace  Apache

Data Structures

struct  apr_text
struct  apr_text_header
struct  apr_xml_attr
struct  apr_xml_elem
struct  apr_xml_doc

Defines

#define APR_XML_NS_DAV_ID   0
#define APR_XML_NS_NONE   -10
#define APR_XML_NS_ERROR_BASE   -100
#define APR_XML_NS_IS_ERROR(e)   ((e) <= APR_XML_NS_ERROR_BASE)
#define APR_XML_ELEM_IS_EMPTY(e)
#define APR_XML_X2T_FULL   0
#define APR_XML_X2T_INNER   1
#define APR_XML_X2T_LANG_INNER   2
#define APR_XML_X2T_FULL_NS_LANG   3
#define APR_XML_GET_URI_ITEM(ary, i)   (((const char * const *)(ary)->elts)[i])

Typedefs

typedef struct apr_text apr_text
typedef struct apr_text_header apr_text_header
typedef struct apr_xml_attr apr_xml_attr
typedef struct apr_xml_elem apr_xml_elem
typedef struct apr_xml_doc apr_xml_doc
typedef struct apr_xml_parser apr_xml_parser

Functions

void apr_text_append (apr_pool_t *p, apr_text_header *hdr, const char *text)
apr_xml_parserapr_xml_parser_create (apr_pool_t *pool)
apr_status_t apr_xml_parse_file (apr_pool_t *p, apr_xml_parser **parser, apr_xml_doc **ppdoc, apr_file_t *xmlfd, apr_size_t buffer_length)
apr_status_t apr_xml_parser_feed (apr_xml_parser *parser, const char *data, apr_size_t len)
apr_status_t apr_xml_parser_done (apr_xml_parser *parser, apr_xml_doc **pdoc)
char * apr_xml_parser_geterror (apr_xml_parser *parser, char *errbuf, apr_size_t errbufsize)
void apr_xml_to_text (apr_pool_t *p, const apr_xml_elem *elem, int style, apr_array_header_t *namespaces, int *ns_map, const char **pbuf, apr_size_t *psize)
const char * apr_xml_empty_elem (apr_pool_t *p, const apr_xml_elem *elem)
const char * apr_xml_quote_string (apr_pool_t *p, const char *s, int quotes)
void apr_xml_quote_elem (apr_pool_t *p, apr_xml_elem *elem)
int apr_xml_insert_uri (apr_array_header_t *uri_array, const char *uri)

Define Documentation

#define APR_XML_ELEM_IS_EMPTY (  ) 

Value:

((e)->first_child == NULL && \
                                  (e)->first_cdata.first == NULL)
Is this XML element empty?

#define APR_XML_GET_URI_ITEM ( ary,
 )     (((const char * const *)(ary)->elts)[i])

Get the URI item for this XML element

#define APR_XML_NS_DAV_ID   0

namespace ID for "DAV:"

#define APR_XML_NS_ERROR_BASE   -100

used only during processing

#define APR_XML_NS_IS_ERROR (  )     ((e) <= APR_XML_NS_ERROR_BASE)

Is this namespace an error?

#define APR_XML_NS_NONE   -10

no namespace for this elem/attr

#define APR_XML_X2T_FULL   0

start tag, contents, end tag

#define APR_XML_X2T_FULL_NS_LANG   3

FULL + ns defns + xml:lang

#define APR_XML_X2T_INNER   1

contents only

#define APR_XML_X2T_LANG_INNER   2

xml:lang + inner contents


Typedef Documentation

typedef struct apr_text apr_text

See also:
apr_text

See also:
apr_text_header

typedef struct apr_xml_attr apr_xml_attr

See also:
apr_xml_attr

typedef struct apr_xml_doc apr_xml_doc

See also:
apr_xml_doc

typedef struct apr_xml_elem apr_xml_elem

See also:
apr_xml_elem

Opaque XML parser structure


Function Documentation

void apr_text_append ( apr_pool_t *  p,
apr_text_header hdr,
const char *  text 
)

Append a piece of text to the end of a list

Parameters:
p The pool to allocate out of
hdr The text header to append to
text The new text to append

const char* apr_xml_empty_elem ( apr_pool_t *  p,
const apr_xml_elem elem 
)

empty XML element

Parameters:
p The pool to allocate out of
elem The XML element to empty
Returns:
the string that was stored in the XML element

int apr_xml_insert_uri ( apr_array_header_t *  uri_array,
const char *  uri 
)

return the URI's (existing) index, or insert it and return a new index

Parameters:
uri_array array to insert into
uri The uri to insert
Returns:
int The uri's index

apr_status_t apr_xml_parse_file ( apr_pool_t *  p,
apr_xml_parser **  parser,
apr_xml_doc **  ppdoc,
apr_file_t *  xmlfd,
apr_size_t  buffer_length 
)

Parse a File, producing a xml_doc

Parameters:
p The pool for allocating the parse results.
parser A pointer to *parser (needed so calling function can get errors), will be set to NULL on successfull completion.
ppdoc A pointer to *apr_xml_doc (which has the parsed results in it)
xmlfd A file to read from.
buffer_length Buffer length which would be suitable
Returns:
Any errors found during parsing.

apr_xml_parser* apr_xml_parser_create ( apr_pool_t *  pool  ) 

Create an XML parser

Parameters:
pool The pool for allocating the parser and the parse results.
Returns:
The new parser.

apr_status_t apr_xml_parser_done ( apr_xml_parser parser,
apr_xml_doc **  pdoc 
)

Terminate the parsing and return the result

Parameters:
parser The XML parser for parsing this data.
pdoc The resulting parse information. May be NULL to simply terminate the parsing without fetching the info.
Returns:
Any errors found during the final stage of parsing.
Remarks:
Use apr_xml_parser_geterror() to get more error information.

apr_status_t apr_xml_parser_feed ( apr_xml_parser parser,
const char *  data,
apr_size_t  len 
)

Feed input into the parser

Parameters:
parser The XML parser for parsing this data.
data The data to parse.
len The length of the data.
Returns:
Any errors found during parsing.
Remarks:
Use apr_xml_parser_geterror() to get more error information.

char* apr_xml_parser_geterror ( apr_xml_parser parser,
char *  errbuf,
apr_size_t  errbufsize 
)

Fetch additional error information from the parser.

Parameters:
parser The XML parser to query for errors.
errbuf A buffer for storing error text.
errbufsize The length of the error text buffer.
Returns:
The error buffer

void apr_xml_quote_elem ( apr_pool_t *  p,
apr_xml_elem elem 
)

Quote an XML element

Parameters:
p The pool to allocate out of
elem The element to quote

const char* apr_xml_quote_string ( apr_pool_t *  p,
const char *  s,
int  quotes 
)

quote an XML string Replace '<', '>', and '&' with '<', '>', and '&'.

Parameters:
p The pool to allocate out of
s The string to quote
quotes If quotes is true, then replace '"' with '"'.
Returns:
The quoted string
Note:
If the string does not contain special characters, it is not duplicated into the pool and the original string is returned.

void apr_xml_to_text ( apr_pool_t *  p,
const apr_xml_elem elem,
int  style,
apr_array_header_t *  namespaces,
int *  ns_map,
const char **  pbuf,
apr_size_t *  psize 
)

Converts an XML element tree to flat text

Parameters:
p The pool to allocate out of
elem The XML element to convert
style How to covert the XML. One of:
     APR_XML_X2T_FULL                start tag, contents, end tag 
     APR_XML_X2T_INNER               contents only 
     APR_XML_X2T_LANG_INNER          xml:lang + inner contents 
     APR_XML_X2T_FULL_NS_LANG        FULL + ns defns + xml:lang 
 
namespaces The namespace of the current XML element
ns_map Namespace mapping
pbuf Buffer to put the converted text into
psize Size of the converted text


Generated on Sat Aug 16 19:14:10 2008 for Apache Portable Runtime Utility Library by  doxygen 1.5.6