Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

wbxml_encoder.c File Reference

WBXML Encoder - Encodes a WBXML Tree to WBXML or to XML. More...

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "wbxml.h"

Include dependency graph for wbxml_encoder.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct  WBXMLEncoder_s
struct  WBXMLValueElement_t
 WBXML Value Element Structure. More...


Defines

#define WBXML_HEADER_MAX_LEN   16
#define WBXML_ENCODER_XML_DOC_MALLOC_BLOCK   5000
#define WBXML_ENCODER_WBXML_DOC_MALLOC_BLOCK   1000
#define WBXML_ENCODER_XML_HEADER_MALLOC_BLOCK   250
#define WBXML_ENCODER_WBXML_HEADER_MALLOC_BLOCK   WBXML_HEADER_MAX_LEN
#define WBXML_ENCODER_DEFAULT_CHARSET   0x6a
#define WBXML_STR_END   '\0'
#define WBXML_ENCODER_STRING_TABLE_MIN   3
#define WBXML_ENCODER_XML_NEW_LINE   ((WB_UTINY *)"\n")
#define WBXML_ENCODER_XML_HEADER   "<?xml version=\"1.0\"?>"
#define WBXML_ENCODER_XML_DOCTYPE   "<!DOCTYPE "
#define WBXML_ENCODER_XML_PUBLIC   " PUBLIC \""
#define WBXML_ENCODER_XML_DTD   "\" \""
#define WBXML_ENCODER_XML_END_DTD   "\">"

Typedefs

typedef enum WBXMLEncoderOutputType_e WBXMLEncoderOutputType
 WBXML Encoder Output Type.

typedef enum WBXMLValueElementCtx_e WBXMLValueElementCtx
 WBXML Value Element Context: In Content or in Attribute Value.

typedef enum WBXMLValueElementType_e WBXMLValueElementType
 WBXML Value Element Type: string / tableref / extension / opaque.

typedef WBXMLValueElement_t WBXMLValueElement
 WBXML Value Element Structure.


Enumerations

enum  WBXMLEncoderOutputType_e { WBXML_ENCODER_OUTPUT_WBXML = 0, WBXML_ENCODER_OUTPUT_XML }
 WBXML Encoder Output Type. More...

enum  WBXMLValueElementCtx_e { WBXML_VALUE_ELEMENT_CTX_CONTENT = 0, WBXML_VALUE_ELEMENT_CTX_ATTR }
 WBXML Value Element Context: In Content or in Attribute Value. More...

enum  WBXMLValueElementType_e { WBXML_VALUE_ELEMENT_STRING = 0, WBXML_VALUE_ELEMENT_EXTENSION, WBXML_VALUE_ELEMENT_OPAQUE, WBXML_VALUE_ELEMENT_ATTR_TOKEN }
 WBXML Value Element Type: string / tableref / extension / opaque. More...


Functions

unsigned char convert_char_to_ucs4 (unsigned char ch, unsigned int *result)
 Convert a char to UCS-4.

WBXMLEncoderwbxml_encoder_duplicate (WBXMLEncoder *encoder)
 Duplicate a WBXML Enocder.

WBXMLError parse_node (WBXMLEncoder *encoder, WBXMLTreeNode *node)
 Parse an XML Node.

WBXMLError parse_element (WBXMLEncoder *encoder, WBXMLTreeNode *node)
 Parse an XML Element.

WBXMLError parse_attribute (WBXMLEncoder *encoder, WBXMLAttribute *attribute)
 Parse an XML Attribute.

WBXMLError parse_text (WBXMLEncoder *encoder, WBXMLTreeNode *node)
 Parse an XML Text.

WBXMLError parse_cdata (WBXMLEncoder *encoder, WBXMLTreeNode *node)
 Parse an XML CDATA.

WBXMLError parse_pi (WBXMLEncoder *encoder, WBXMLTreeNode *node)
 Parse an XML PI.

WBXMLError parse_tree (WBXMLEncoder *encoder, WBXMLTreeNode *node)
 Parse a WBXML Tree.

WBXMLError wbxml_build_result (WBXMLEncoder *encoder, unsigned char **wbxml, unsigned int *wbxml_len)
 Build WBXML Result.

WBXMLError wbxml_encode_end (WBXMLEncoder *encoder)
 Encode a WBXML End Token.

WBXMLError wbxml_encode_tag (WBXMLEncoder *encoer, WBXMLTreeNode *node)
 Encode a WBXML Tag.

WBXMLError wbxml_encode_tag_literal (WBXMLEncoder *encoder, unsigned char *tag, unsigned char mask)
 Encode a WBXML Literal Token.

WBXMLError wbxml_encode_tag_token (WBXMLEncoder *encoder, unsigned char token, unsigned char page)
 Encode a WBXML Tag Token.

WBXMLError wbxml_encode_attr (WBXMLEncoder *encoder, WBXMLAttribute *attribute)
 Encode a WBXML Attribute.

WBXMLError wbxml_encode_attr_start (WBXMLEncoder *encoder, WBXMLAttribute *attribute, unsigned char **value)
 Encode a WBXML Attribute Start.

WBXMLError wbxml_encode_value_element_buffer (WBXMLEncoder *encoder, unsigned char *value, WBXMLValueElementCtx ctx)
 Encode a WBXML Attribute Value.

WBXMLError wbxml_encode_value_element_list (WBXMLEncoder *encoder, WBXMLList *list)
 Encode a WBXML Value Element List.

WBXMLError wbxml_encode_attr_start_literal (WBXMLEncoder *encoder, const unsigned char *attr)
 Encode a WBXML Literal Attribute Start.

WBXMLError wbxml_encode_attr_token (WBXMLEncoder *encoder, unsigned char token, unsigned char page)
 Encode a WBXML Attribute Token.

WBXMLError wbxml_encode_inline_string (WBXMLEncoder *encoder, WBXMLBuffer *str)
 Encode a WBXML Inline String.

WBXMLError wbxml_encode_inline_integer_extension_token (WBXMLEncoder *encoder, unsigned char ext, unsigned char value)
 Encode a WBXML Inline Integer Extension Token.

WBXMLError wbxml_encode_entity (WBXMLEncoder *encoder, unsigned int value)
 Encode a WBXML Entity.

WBXMLError wbxml_encode_opaque (WBXMLEncoder *encoder, WBXMLBuffer *buff)
 Encode a WBXML Opaque.

WBXMLValueElementwbxml_value_element_create (void)
 Create a WBXMLValueElement structure.

void wbxml_value_element_destroy (WBXMLValueElement *elt)
 Destroy a WBXMLValueElement structure.

void wbxml_value_element_destroy_item (void *elt)
 Destroy a WBXMLValueElement structure (for wbxml_list_destroy() function).

WBXMLError wbxml_encode_tree (WBXMLEncoder *encoder, WBXMLTree *tree)
 Encode an encapsulated WBXML Tree to WBXML.

WBXMLError xml_build_result (WBXMLEncoder *encoder, unsigned char **xml)
 Build XML Result.

unsigned char xml_fill_header (WBXMLEncoder *encoder, WBXMLBuffer *header)
 Fill the XML Header.

WBXMLError xml_encode_tag (WBXMLEncoder *encoer, WBXMLTreeNode *node)
 Encode an XML Tag.

WBXMLError xml_encode_end_tag (WBXMLEncoder *encoder, WBXMLTreeNode *node)
 Encode an XML End Tag.

WBXMLError xml_encode_attr (WBXMLEncoder *encoder, WBXMLAttribute *attribute)
 Encode a XML Attribute.

WBXMLError xml_encode_end_attrs (WBXMLEncoder *encoder)
 Encode a End of XML Attributes List.

WBXMLError xml_encode_text (WBXMLEncoder *encoder, WBXMLBuffer *str)
 Encode an XML Text.

unsigned char xml_encode_new_line (WBXMLBuffer *buff)
 Append a New Line to a Buffer.

unsigned char xml_normalize (WBXMLBuffer *buff)
 Normalize an XML Buffer.

WBXMLError xml_encode_tree (WBXMLEncoder *encoder, WBXMLTree *tree)
 Encode an encapsulated WBXML Tree to XML.

WBXMLEncoderwbxml_encoder_create_real (void)
 Create a WBXML Encoder
Returns:
Return the newly created WBXMLEncoder, or NULL if not enough memory.


void wbxml_encoder_destroy (WBXMLEncoder *encoder)
 Destroy a WBXML Encoder.

void wbxml_encoder_set_ignore_empty_text (WBXMLEncoder *encoder, unsigned char set_ignore)
void wbxml_encoder_set_remove_text_blanks (WBXMLEncoder *encoder, unsigned char set_remove)
void wbxml_encoder_set_use_strtbl (WBXMLEncoder *encoder, unsigned char use_strtbl)
void wbxml_encoder_set_wbxml_version (WBXMLEncoder *encoder, WBXMLVersion version)
 Set the WBXML Version of the output document, when generating WBXML [Default: 'WBXML_VERSION_TOKEN_13' (1.3)].

void wbxml_encoder_set_xml_gen_type (WBXMLEncoder *encoder, WBXMLEncoderXMLGenType gen_type)
 Set the WBXML Encoder XML Generation Type, when generating XML [Default: WBXML_ENCODER_XML_GEN_COMPACT].

void wbxml_encoder_set_indent (WBXMLEncoder *encoder, unsigned char indent)
void wbxml_encoder_set_tree (WBXMLEncoder *encoder, WBXMLTree *tree)
 Set the WBXML Tree to encode.

WBXMLError wbxml_encoder_encode_to_wbxml (WBXMLEncoder *encoder, unsigned char **wbxml, unsigned int *wbxml_len)
WBXMLError wbxml_encoder_encode_to_xml (WBXMLEncoder *encoder, unsigned char **xml)

Variables

const unsigned char xml_lt [5] = "&lt;"
const unsigned char xml_gt [5] = "&gt;"
const unsigned char xml_amp [6] = "&amp;"
const unsigned char xml_quot [7] = "&quot;"
const unsigned char xml_slashr [6] = "&#13;"
const unsigned char xml_slashn [6] = "&#10;"
const unsigned char xml_tab [5] = "&#9;"


Detailed Description

WBXML Encoder - Encodes a WBXML Tree to WBXML or to XML.

Author:
Aymerick Jéhanne <libwbxml@jehanne.org>
Date:
11/11/02

Note:
Inspired from kannel WML Encoder (http://www.kannel.org)

[OMA WV 1.1] : OMA-WV-CSP_WBXML-V1_1-20021001-A.pdf

Todo:
Parse CDDATA

Parse PI

Handle Charsets Encoding

Really generate ENTITY tokens

Handle Namespaces !

For canonical XML output: Sort the Attributes

When adding string to String Table, check that this is not a Content Text that will be tokenized

For Wireless-Village CSP : -Encode "Date and Time" in OPAQUE (OMA-WV-CSP_WBXML-V1_1-20021001-A.pdf - 6.6)

Definition in file wbxml_encoder.c.


Define Documentation

#define WBXML_ENCODER_DEFAULT_CHARSET   0x6a
 

Definition at line 76 of file wbxml_encoder.c.

#define WBXML_ENCODER_STRING_TABLE_MIN   3
 

Definition at line 82 of file wbxml_encoder.c.

#define WBXML_ENCODER_WBXML_DOC_MALLOC_BLOCK   1000
 

Definition at line 70 of file wbxml_encoder.c.

Referenced by wbxml_encoder_encode_to_wbxml().

#define WBXML_ENCODER_WBXML_HEADER_MALLOC_BLOCK   WBXML_HEADER_MAX_LEN
 

Definition at line 73 of file wbxml_encoder.c.

#define WBXML_ENCODER_XML_DOC_MALLOC_BLOCK   5000
 

Definition at line 69 of file wbxml_encoder.c.

Referenced by wbxml_encoder_encode_to_xml().

#define WBXML_ENCODER_XML_DOCTYPE   "<!DOCTYPE "
 

Definition at line 268 of file wbxml_encoder.c.

#define WBXML_ENCODER_XML_DTD   "\" \""
 

Definition at line 270 of file wbxml_encoder.c.

#define WBXML_ENCODER_XML_END_DTD   "\">"
 

Definition at line 271 of file wbxml_encoder.c.

#define WBXML_ENCODER_XML_HEADER   "<?xml version=\"1.0\"?>"
 

Definition at line 267 of file wbxml_encoder.c.

#define WBXML_ENCODER_XML_HEADER_MALLOC_BLOCK   250
 

Definition at line 72 of file wbxml_encoder.c.

#define WBXML_ENCODER_XML_NEW_LINE   ((WB_UTINY *)"\n")
 

New Line

Definition at line 264 of file wbxml_encoder.c.

#define WBXML_ENCODER_XML_PUBLIC   " PUBLIC \""
 

Definition at line 269 of file wbxml_encoder.c.

#define WBXML_HEADER_MAX_LEN   16
 

Compilation Flag: WBXML_ENCODER_USE_STRTBL ----------------- Do We Use String Table when Encoding to WBXML ? (NOTE: We still use String Table for Unknown Public ID, even if this flag is not set)

Definition at line 66 of file wbxml_encoder.c.

#define WBXML_STR_END   '\0'
 

Definition at line 79 of file wbxml_encoder.c.


Typedef Documentation

typedef enum WBXMLEncoderOutputType_e WBXMLEncoderOutputType
 

WBXML Encoder Output Type.

typedef struct WBXMLValueElement_t WBXMLValueElement
 

WBXML Value Element Structure.

typedef enum WBXMLValueElementCtx_e WBXMLValueElementCtx
 

WBXML Value Element Context: In Content or in Attribute Value.

typedef enum WBXMLValueElementType_e WBXMLValueElementType
 

WBXML Value Element Type: string / tableref / extension / opaque.


Enumeration Type Documentation

enum WBXMLEncoderOutputType_e
 

WBXML Encoder Output Type.

Enumeration values:
WBXML_ENCODER_OUTPUT_WBXML 
WBXML_ENCODER_OUTPUT_XML 

Definition at line 87 of file wbxml_encoder.c.

enum WBXMLValueElementCtx_e
 

WBXML Value Element Context: In Content or in Attribute Value.

Enumeration values:
WBXML_VALUE_ELEMENT_CTX_CONTENT  Text Content
WBXML_VALUE_ELEMENT_CTX_ATTR  Attribute Value

Definition at line 135 of file wbxml_encoder.c.

enum WBXMLValueElementType_e
 

WBXML Value Element Type: string / tableref / extension / opaque.

Enumeration values:
WBXML_VALUE_ELEMENT_STRING  Inline String
WBXML_VALUE_ELEMENT_EXTENSION  Extension Token
WBXML_VALUE_ELEMENT_OPAQUE  Opaque Buffer
WBXML_VALUE_ELEMENT_ATTR_TOKEN  Attribute Value Token

Definition at line 143 of file wbxml_encoder.c.


Function Documentation

unsigned char convert_char_to_ucs4 unsigned char    ch,
unsigned int *    result
[static]
 

Convert a char to UCS-4.

Parameters:
ch [in] The character to convert
result [out] The UCS-4 code
Returns:
TRUE if convertion succeeded, FALSE otherwise
Todo:
convert_char_to_ucs4()

Definition at line 543 of file wbxml_encoder.c.

WBXMLError parse_attribute WBXMLEncoder   encoder,
WBXMLAttribute   attribute
[static]
 

Parse an XML Attribute.

Parameters:
encoder The WBXML Encoder
attribute The XML Attribute to parse
Returns:
WBXML_OK if parsing is OK, an error code otherwise

Definition at line 729 of file wbxml_encoder.c.

WBXMLError parse_cdata WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Parse an XML CDATA.

Parameters:
encoder The WBXML Encoder
node The CDATA to parse
Returns:
WBXML_OK if parsing is OK, an error code otherwise
Todo:
parse_cdata()

Definition at line 794 of file wbxml_encoder.c.

WBXMLError parse_element WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Parse an XML Element.

Parameters:
encoder The WBXML Encoder
node The element to parse
Returns:
WBXML_OK if parsing is OK, an error code otherwise
Todo:
Check handling of Namespaces

For Canonical XML Output: Attributes MUST be sorted

Check if the attributes will really be tokenized. There can be ignored attributes, and so NO attribute tokenized at all.

Fast patch for SyncML (change this)

Definition at line 663 of file wbxml_encoder.c.

WBXMLError parse_node WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Parse an XML Node.

Parameters:
encoder The WBXML Encoder
node The node to parse
Returns:
WBXML_OK if parsing is OK, an error code otherwise
Note:
We have recurrency in this function

Definition at line 595 of file wbxml_encoder.c.

Referenced by wbxml_encoder_encode_to_wbxml(), and wbxml_encoder_encode_to_xml().

WBXMLError parse_pi WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Parse an XML PI.

Parameters:
encoder The WBXML Encoder
node The PI to parse
Returns:
WBXML_OK if parsing is OK, an error code otherwise
Todo:
parse_pi()

Definition at line 808 of file wbxml_encoder.c.

WBXMLError parse_text WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Parse an XML Text.

Parameters:
encoder The WBXML Encoder
node The text to parse
Returns:
WBXML_OK if parsing is OK, an error code otherwise

Definition at line 761 of file wbxml_encoder.c.

WBXMLError parse_tree WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Parse a WBXML Tree.

Parameters:
encoder The WBXML Encoder
node The WBXML Tree to parse
Returns:
WBXML_OK if parsing is OK, an error code otherwise

Definition at line 822 of file wbxml_encoder.c.

WBXMLError wbxml_build_result WBXMLEncoder   encoder,
unsigned char **    wbxml,
unsigned int *    wbxml_len
[static]
 

Build WBXML Result.

Parameters:
encoder [in] The WBXML Encoder
wbxml [out] Resulting WBXML document
wbxml_len [out] The resulting WBXML document length
Returns:
WBXML_OK if built is OK, an error code otherwise
Note:
WBXML Header = version publicid charset length
Todo:
Handle correctly the charset

Definition at line 852 of file wbxml_encoder.c.

Referenced by wbxml_encoder_encode_to_wbxml().

WBXMLError wbxml_encode_attr WBXMLEncoder   encoder,
WBXMLAttribute   attribute
[static]
 

Encode a WBXML Attribute.

Parameters:
encoder [in] The WBXML Encoder
attribute [in] The Attribute to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
attribute = attrStart *attrValue

Definition at line 1150 of file wbxml_encoder.c.

WBXMLError wbxml_encode_attr_start WBXMLEncoder   encoder,
WBXMLAttribute   attribute,
unsigned char **    value
[static]
 

Encode a WBXML Attribute Start.

Parameters:
encoder [in] The WBXML Encoder
attribute [in] The Attribute
value [out] Pointer to the value to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
The 'value' result correspond to the value there is still to encode For example, in Wireless-Village, to encode: xmlns="http://www.wireless-village.org/CSP1.1" We first encode: xmlns="http://www.wireless-village.org/CSP (start token: 0x05) Then: "1.1" as an inline string
Todo:
Should we stop everything and generate an error ?

Definition at line 1186 of file wbxml_encoder.c.

WBXMLError wbxml_encode_attr_start_literal WBXMLEncoder   encoder,
const unsigned char *    attr
[static]
 

Encode a WBXML Literal Attribute Start.

Parameters:
encoder The WBXML Encoder
attr The literal attr name to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
attrStart = (LITERAL index) index = mb_u_int32

Definition at line 1711 of file wbxml_encoder.c.

WBXMLError wbxml_encode_attr_token WBXMLEncoder   encoder,
unsigned char    token,
unsigned char    page
[static]
 

Encode a WBXML Attribute Token.

Parameters:
encoder The WBXML Encoder
token The WBXML Attribute Token to encode
page The WBXML CodePage for this Token
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
attrStart = ([switchPage] ATTRSTART) switchPage = SWITCH_PAGE pageindex pageindex = u_int8
And: attrValue = ([switchPage] ATTRVALUE)

Definition at line 1764 of file wbxml_encoder.c.

WBXMLError wbxml_encode_end WBXMLEncoder   encoder [static]
 

Encode a WBXML End Token.

Parameters:
encoder The WBXML Encoder
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 998 of file wbxml_encoder.c.

WBXMLError wbxml_encode_entity WBXMLEncoder   encoder,
unsigned int    value
[static]
 

Encode a WBXML Entity.

Parameters:
encoder The WBXML Encoder
value The Entity to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
(WBXML 1.3 - 5.8.4.3) entity = ENTITY entcode entcode = mb_u_int32

Definition at line 1840 of file wbxml_encoder.c.

WBXMLError wbxml_encode_inline_integer_extension_token WBXMLEncoder   encoder,
unsigned char    ext,
unsigned char    value
[static]
 

Encode a WBXML Inline Integer Extension Token.

Parameters:
encoder The WBXML Encoder
ext Extension Type (WBXML_EXT_T_0, WBXML_EXT_T_1 or WBXML_EXT_T_2)
value The Extension Token Value
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
(WBXML 1.3 - 5.8.4.2) Inline integrer extension token = EXT_T* mb_u_int32

Definition at line 1818 of file wbxml_encoder.c.

WBXMLError wbxml_encode_inline_string WBXMLEncoder   encoder,
WBXMLBuffer   str
[static]
 

Encode a WBXML Inline String.

Parameters:
encoder The WBXML Encoder
str The String to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 1792 of file wbxml_encoder.c.

WBXMLError wbxml_encode_opaque WBXMLEncoder   encoder,
WBXMLBuffer   buff
[static]
 

Encode a WBXML Opaque.

Parameters:
encoder The WBXML Encoder
buff The Buffer to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
opaque = OPAQUE length *byte length = mb_u_int32

Definition at line 1862 of file wbxml_encoder.c.

WBXMLError wbxml_encode_tag WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Encode a WBXML Tag.

Parameters:
encoder The WBXML Encoder
node The element to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Todo:
Check if the attributes will really be tokenized. There can be ignored attributes, and so NO attribute tokenized at all.

Fast patch for SyncML (change this)

Definition at line 1014 of file wbxml_encoder.c.

WBXMLError wbxml_encode_tag_literal WBXMLEncoder   encoder,
unsigned char *    tag,
unsigned char    mask
[static]
 

Encode a WBXML Literal Token.

Parameters:
encoder The WBXML Encoder
tag The literal tag to encode
mask The WBXML Mask for this tag
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
stag = (literalTag index) literalTag = LITERAL | LITERAL_A | LITERAL_C | LITERAL_AC index = mb_u_int32

Definition at line 1069 of file wbxml_encoder.c.

WBXMLError wbxml_encode_tag_token WBXMLEncoder   encoder,
unsigned char    token,
unsigned char    page
[static]
 

Encode a WBXML Tag Token.

Parameters:
encoder The WBXML Encoder
token The WBXML Tag Token to encode
page The WBXML CodePage for this Token
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
element = ([switchPage] stag) switchPage = SWITCH_PAGE pageindex stag = TAG pageindex = u_int8

Definition at line 1121 of file wbxml_encoder.c.

WBXMLError wbxml_encode_tree WBXMLEncoder   encoder,
WBXMLTree   tree
[static]
 

Encode an encapsulated WBXML Tree to WBXML.

Parameters:
encoder [in] The WBXML Encoder
tree [in] The WBXML Tree to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 1962 of file wbxml_encoder.c.

WBXMLError wbxml_encode_value_element_buffer WBXMLEncoder   encoder,
unsigned char *    buffer,
WBXMLValueElementCtx    ctx
[static]
 

Encode a WBXML Attribute Value.

Parameters:
encoder The WBXML Encoder
buffer The Value Element Buffer to encode
ctx Value Element Context (Attribute Value or Content)
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Note:
attrStart = *attrValue attrValue = string | extension | entity | opaque
AND: element = *content content = string | extension | entity | opaque

Todo:
Finish Extension Tokens Search

Definition at line 1276 of file wbxml_encoder.c.

WBXMLError wbxml_encode_value_element_list WBXMLEncoder   encoder,
WBXMLList   list
[static]
 

Encode a WBXML Value Element List.

Parameters:
encoder The WBXML Encoder
list The Value Element list
Returns:
WBXML_OK if encoding is OK, an error code otherwise
Todo:
Opaque

Definition at line 1645 of file wbxml_encoder.c.

WBXMLEncoder * wbxml_encoder_duplicate WBXMLEncoder   encoder [static]
 

Duplicate a WBXML Enocder.

Parameters:
encoder [in] The WBXML Encoder to Duplicate
Returns:
The duplicated WBXML Encoder, or NULL if error
Note:
Only options (parameters) fields are duplicated, others are reset

Definition at line 557 of file wbxml_encoder.c.

WBXMLError wbxml_encoder_encode_to_wbxml WBXMLEncoder   encoder,
unsigned char **    wbxml,
unsigned int *    wbxml_len
 

Definition at line 441 of file wbxml_encoder.c.

References FALSE, WBXMLTree_s::lang, WBXMLLangEntry_s::langID, NULL, WBXMLEncoder_s::output, WBXMLEncoder_s::output_type, parse_node(), WBXMLTree_s::root, WBXMLEncoder_s::tree, WB_ULONG, WB_UTINY, wbxml_buffer_create, wbxml_build_result(), wbxml_encoder_destroy(), WBXML_ENCODER_OUTPUT_WBXML, WBXML_ENCODER_WBXML_DOC_MALLOC_BLOCK, WBXML_ERROR_BAD_PARAMETER, WBXML_ERROR_NOT_ENOUGH_MEMORY, WBXML_OK, and WBXMLError.

WBXMLError wbxml_encoder_encode_to_xml WBXMLEncoder   encoder,
unsigned char **    xml
 

Definition at line 498 of file wbxml_encoder.c.

References WBXMLTree_s::lang, NULL, WBXMLEncoder_s::output, WBXMLEncoder_s::output_type, parse_node(), WBXMLTree_s::root, WBXMLEncoder_s::tree, WB_UTINY, wbxml_buffer_create, wbxml_encoder_destroy(), WBXML_ENCODER_OUTPUT_XML, WBXML_ENCODER_XML_DOC_MALLOC_BLOCK, WBXML_ERROR_BAD_PARAMETER, WBXML_ERROR_NOT_ENOUGH_MEMORY, WBXML_OK, WBXMLError, and xml_build_result().

void wbxml_encoder_set_ignore_empty_text WBXMLEncoder   encoder,
unsigned char    set_ignore
 

Definition at line 369 of file wbxml_encoder.c.

References WBXMLEncoder_s::ignore_empty_text, NULL, and WB_BOOL.

void wbxml_encoder_set_indent WBXMLEncoder   encoder,
unsigned char    indent
 

Definition at line 421 of file wbxml_encoder.c.

References WBXMLEncoder_s::indent_delta, NULL, and WB_UTINY.

void wbxml_encoder_set_remove_text_blanks WBXMLEncoder   encoder,
unsigned char    set_remove
 

Definition at line 378 of file wbxml_encoder.c.

References NULL, WBXMLEncoder_s::remove_text_blanks, and WB_BOOL.

void wbxml_encoder_set_use_strtbl WBXMLEncoder   encoder,
unsigned char    use_strtbl
 

Definition at line 389 of file wbxml_encoder.c.

References NULL, and WB_BOOL.

WBXMLValueElement * wbxml_value_element_create void    [static]
 

Create a WBXMLValueElement structure.

Returns:
The newly created WBXMLValueElement structure, or NULL if not enough memory

Definition at line 1907 of file wbxml_encoder.c.

void wbxml_value_element_destroy WBXMLValueElement   elt [static]
 

Destroy a WBXMLValueElement structure.

Parameters:
elt The WBXMLValueElement structure to destroy

Definition at line 1925 of file wbxml_encoder.c.

void wbxml_value_element_destroy_item void *    elt [static]
 

Destroy a WBXMLValueElement structure (for wbxml_list_destroy() function).

Parameters:
elt The WBXMLValueElement structure to destroy

Definition at line 1950 of file wbxml_encoder.c.

WBXMLError xml_build_result WBXMLEncoder   encoder,
unsigned char **    xml
[static]
 

Build XML Result.

Parameters:
encoder [in] The WBXML Encoder
xml [out] Resulting XML document
Returns:
WBXML_OK if built is OK, an error code otherwise

Definition at line 3025 of file wbxml_encoder.c.

Referenced by wbxml_encoder_encode_to_xml().

WBXMLError xml_encode_attr WBXMLEncoder   encoder,
WBXMLAttribute   attribute
[static]
 

Encode a XML Attribute.

Parameters:
encoder [in] The WBXML Encoder
attribute [in] The Attribute to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 3252 of file wbxml_encoder.c.

WBXMLError xml_encode_end_attrs WBXMLEncoder   encoder [static]
 

Encode a End of XML Attributes List.

Parameters:
encoder [in] The WBXML Encoder
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 3306 of file wbxml_encoder.c.

WBXMLError xml_encode_end_tag WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Encode an XML End Tag.

Parameters:
encoder The WBXML Encoder
node Tag
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 3199 of file wbxml_encoder.c.

unsigned char xml_encode_new_line WBXMLBuffer   buff [static]
 

Append a New Line to a Buffer.

Parameters:
buff The Buffer
Returns:
TRUE if added, FALSE otherwise

Definition at line 3393 of file wbxml_encoder.c.

WBXMLError xml_encode_tag WBXMLEncoder   encoder,
WBXMLTreeNode   node
[static]
 

Encode an XML Tag.

Parameters:
encoder The WBXML Encoder
node The element to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 3137 of file wbxml_encoder.c.

WBXMLError xml_encode_text WBXMLEncoder   encoder,
WBXMLBuffer   str
[static]
 

Encode an XML Text.

Parameters:
encoder The WBXML Encoder
str The XML to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 3330 of file wbxml_encoder.c.

WBXMLError xml_encode_tree WBXMLEncoder   encoder,
WBXMLTree   tree
[static]
 

Encode an encapsulated WBXML Tree to XML.

Parameters:
encoder [in] The WBXML Encoder
tree [in] The WBXML Tree to encode
Returns:
WBXML_OK if encoding is OK, an error code otherwise

Definition at line 3504 of file wbxml_encoder.c.

unsigned char xml_fill_header WBXMLEncoder   encoder,
WBXMLBuffer   header
[static]
 

Fill the XML Header.

Parameters:
encoder The WBXML Encoder
header The Buffer to Fill
Returns:
WBXML_OK if built is OK, an error code otherwise

Definition at line 3074 of file wbxml_encoder.c.

unsigned char xml_normalize WBXMLBuffer   buff [static]
 

Normalize an XML Buffer.

Parameters:
buff The Buffer
Returns:
WBXML_OK if ok, an Error Code otherwise

Definition at line 3408 of file wbxml_encoder.c.


Variable Documentation

const unsigned char xml_amp[6] = "&amp;"
 

&

Definition at line 276 of file wbxml_encoder.c.

const unsigned char xml_gt[5] = "&gt;"
 

>

Definition at line 275 of file wbxml_encoder.c.

const unsigned char xml_lt[5] = "&lt;"
 

<

Definition at line 274 of file wbxml_encoder.c.

const unsigned char xml_quot[7] = "&quot;"
 

"

Definition at line 277 of file wbxml_encoder.c.

const unsigned char xml_slashn[6] = "&#10;"
 

&#10;

Definition at line 279 of file wbxml_encoder.c.

const unsigned char xml_slashr[6] = "&#13;"
 

&#13;

Definition at line 278 of file wbxml_encoder.c.

const unsigned char xml_tab[5] = "&#9;"
 

&#9;

Definition at line 280 of file wbxml_encoder.c.


Generated on Mon Nov 24 20:09:44 2003 for WBXML Library by doxygen1.3-rc1