#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "wbxml.h"
Include dependency graph for wbxml_encoder.c:
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. | |
WBXMLEncoder * | wbxml_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. | |
WBXMLValueElement * | wbxml_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. | |
WBXMLEncoder * | wbxml_encoder_create_real (void) |
Create a WBXML Encoder
| |
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] = "<" |
const unsigned char | xml_gt [5] = ">" |
const unsigned char | xml_amp [6] = "&" |
const unsigned char | xml_quot [7] = """ |
const unsigned char | xml_slashr [6] = " " |
const unsigned char | xml_slashn [6] = " " |
const unsigned char | xml_tab [5] = "	" |
[OMA WV 1.1] : OMA-WV-CSP_WBXML-V1_1-20021001-A.pdf
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.
|
Definition at line 76 of file wbxml_encoder.c. |
|
Definition at line 82 of file wbxml_encoder.c. |
|
Definition at line 70 of file wbxml_encoder.c. Referenced by wbxml_encoder_encode_to_wbxml(). |
|
Definition at line 73 of file wbxml_encoder.c. |
|
Definition at line 69 of file wbxml_encoder.c. Referenced by wbxml_encoder_encode_to_xml(). |
|
Definition at line 268 of file wbxml_encoder.c. |
|
Definition at line 270 of file wbxml_encoder.c. |
|
Definition at line 271 of file wbxml_encoder.c. |
|
Definition at line 267 of file wbxml_encoder.c. |
|
Definition at line 72 of file wbxml_encoder.c. |
|
New Line Definition at line 264 of file wbxml_encoder.c. |
|
Definition at line 269 of file wbxml_encoder.c. |
|
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. |
|
Definition at line 79 of file wbxml_encoder.c. |
|
WBXML Encoder Output Type.
|
|
WBXML Value Element Structure.
|
|
WBXML Value Element Context: In Content or in Attribute Value.
|
|
WBXML Value Element Type: string / tableref / extension / opaque.
|
|
WBXML Encoder Output Type.
Definition at line 87 of file wbxml_encoder.c. |
|
WBXML Value Element Context: In Content or in Attribute Value.
Definition at line 135 of file wbxml_encoder.c. |
|
WBXML Value Element Type: string / tableref / extension / opaque.
Definition at line 143 of file wbxml_encoder.c. |
|
Convert a char to UCS-4.
Definition at line 543 of file wbxml_encoder.c. |
|
Parse an XML Attribute.
Definition at line 729 of file wbxml_encoder.c. |
|
Parse an XML CDATA.
Definition at line 794 of file wbxml_encoder.c. |
|
Parse an XML Element.
Definition at line 663 of file wbxml_encoder.c. |
|
Parse an XML Node.
Definition at line 595 of file wbxml_encoder.c. Referenced by wbxml_encoder_encode_to_wbxml(), and wbxml_encoder_encode_to_xml(). |
|
Parse an XML PI.
Definition at line 808 of file wbxml_encoder.c. |
|
Parse an XML Text.
Definition at line 761 of file wbxml_encoder.c. |
|
Parse a WBXML Tree.
Definition at line 822 of file wbxml_encoder.c. |
|
Build WBXML Result.
Definition at line 852 of file wbxml_encoder.c. Referenced by wbxml_encoder_encode_to_wbxml(). |
|
Encode a WBXML Attribute.
Definition at line 1150 of file wbxml_encoder.c. |
|
Encode a WBXML Attribute Start.
Definition at line 1186 of file wbxml_encoder.c. |
|
Encode a WBXML Literal Attribute Start.
Definition at line 1711 of file wbxml_encoder.c. |
|
Encode a WBXML Attribute Token.
Definition at line 1764 of file wbxml_encoder.c. |
|
Encode a WBXML End Token.
Definition at line 998 of file wbxml_encoder.c. |
|
Encode a WBXML Entity.
Definition at line 1840 of file wbxml_encoder.c. |
|
Encode a WBXML Inline Integer Extension Token.
Definition at line 1818 of file wbxml_encoder.c. |
|
Encode a WBXML Inline String.
Definition at line 1792 of file wbxml_encoder.c. |
|
Encode a WBXML Opaque.
Definition at line 1862 of file wbxml_encoder.c. |
|
Encode a WBXML Tag.
Definition at line 1014 of file wbxml_encoder.c. |
|
Encode a WBXML Literal Token.
Definition at line 1069 of file wbxml_encoder.c. |
|
Encode a WBXML Tag Token.
Definition at line 1121 of file wbxml_encoder.c. |
|
Encode an encapsulated WBXML Tree to WBXML.
Definition at line 1962 of file wbxml_encoder.c. |
|
Encode a WBXML Attribute Value.
Definition at line 1276 of file wbxml_encoder.c. |
|
Encode a WBXML Value Element List.
Definition at line 1645 of file wbxml_encoder.c. |
|
Duplicate a WBXML Enocder.
Definition at line 557 of file wbxml_encoder.c. |
|
|
|
Definition at line 369 of file wbxml_encoder.c. References WBXMLEncoder_s::ignore_empty_text, NULL, and WB_BOOL. |
|
Definition at line 421 of file wbxml_encoder.c. References WBXMLEncoder_s::indent_delta, NULL, and WB_UTINY. |
|
Definition at line 378 of file wbxml_encoder.c. References NULL, WBXMLEncoder_s::remove_text_blanks, and WB_BOOL. |
|
Definition at line 389 of file wbxml_encoder.c. |
|
Create a WBXMLValueElement structure.
Definition at line 1907 of file wbxml_encoder.c. |
|
Destroy a WBXMLValueElement structure.
Definition at line 1925 of file wbxml_encoder.c. |
|
Destroy a WBXMLValueElement structure (for wbxml_list_destroy() function).
Definition at line 1950 of file wbxml_encoder.c. |
|
Build XML Result.
Definition at line 3025 of file wbxml_encoder.c. Referenced by wbxml_encoder_encode_to_xml(). |
|
Encode a XML Attribute.
Definition at line 3252 of file wbxml_encoder.c. |
|
Encode a End of XML Attributes List.
Definition at line 3306 of file wbxml_encoder.c. |
|
Encode an XML End Tag.
Definition at line 3199 of file wbxml_encoder.c. |
|
Append a New Line to a Buffer.
Definition at line 3393 of file wbxml_encoder.c. |
|
Encode an XML Tag.
Definition at line 3137 of file wbxml_encoder.c. |
|
Encode an XML Text.
Definition at line 3330 of file wbxml_encoder.c. |
|
Encode an encapsulated WBXML Tree to XML.
Definition at line 3504 of file wbxml_encoder.c. |
|
Fill the XML Header.
Definition at line 3074 of file wbxml_encoder.c. |
|
Normalize an XML Buffer.
Definition at line 3408 of file wbxml_encoder.c. |
|
& Definition at line 276 of file wbxml_encoder.c. |
|
> Definition at line 275 of file wbxml_encoder.c. |
|
< Definition at line 274 of file wbxml_encoder.c. |
|
" Definition at line 277 of file wbxml_encoder.c. |
|
Definition at line 279 of file wbxml_encoder.c. |
|
Definition at line 278 of file wbxml_encoder.c. |
|
	 Definition at line 280 of file wbxml_encoder.c. |