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

WBXML Tree
[WBXML Library]


Files

file  wbxml_tree.c
 WBXML Tree.

file  wbxml_tree.h
 WBXML Tree.

file  wbxml_tree_clb_wbxml.c
 WBXML Tree Callbacks for WBXML Parser.

file  wbxml_tree_clb_wbxml.h
 WBXML Tree Callbacks for WBXML Parser.

file  wbxml_tree_clb_xml.c
 WBXML Tree Callbacks for XML Parser (Expat).

file  wbxml_tree_clb_xml.h
 WBXML Tree Callbacks for XML Parser (Expat).


Compounds

struct  WBXMLTree_s
 WBXML Tree structure. More...

struct  WBXMLTreeAttribute_s
 WBXML Tree Attribute structure. More...

struct  WBXMLTreeClbCtx_s
struct  WBXMLTreeNode_s
 WBXML Tree Node structure. More...


Typedefs

typedef enum WBXMLTreeNodeType_e WBXMLTreeNodeType
 WBXML Tree Node Type.

typedef WBXMLTreeAttribute_s WBXMLTreeAttribute
 WBXML Tree Attribute structure.

typedef WBXMLTreeNode_s WBXMLTreeNode
 WBXML Tree Node structure.

typedef WBXMLTree_s WBXMLTree
 WBXML Tree structure.

typedef WBXMLTreeClbCtx_s WBXMLTreeClbCtx

Enumerations

enum  WBXMLTreeNodeType_e { WBXML_TREE_ELEMENT_NODE = 0, WBXML_TREE_TEXT_NODE, WBXML_TREE_PI_NODE, WBXML_TREE_TREE_NODE }
 WBXML Tree Node Type. More...


Functions

WBXMLError wbxml_tree_from_wbxml (WB_UTINY *wbxml, WB_ULONG wbxml_len, WBXMLLanguage lang, WBXMLTree **tree)
 Parse a WBXML document, using internal callbacks, and construct a WBXML Tree.

WBXMLError wbxml_tree_from_xml (WB_UTINY *xml, WBXMLTree **tree)
 Parse an XML document, using internal callbacks, and construct a WBXML Tree.

WBXMLTreeAttributewbxml_tree_attribute_create (void)
 Create a Tree Attribute structure.

void wbxml_tree_attribute_destroy (WBXMLTreeAttribute *attr)
 Destroy a Tree Attribute structure.

WBXMLTreeNodewbxml_tree_node_create (WBXMLTreeNodeType type)
 Create a Tree Node structure.

void wbxml_tree_node_destroy (WBXMLTreeNode *node)
 Destroy a Tree Node structure.

WBXMLTreewbxml_tree_create (void)
 Create a Tree structure.

void wbxml_tree_destroy (WBXMLTree *tree)
 Destroy a Tree structure.

WBXMLTreeNodewbxml_tree_get_element_node_from_name (WBXMLTreeNode *node, const char *name, WB_BOOL recurs)
 Get an Element Node, given the Element Name.

void wbxml_tree_clb_wbxml_start_document (void *ctx, WB_LONG charset, const WBXMLLangEntry *lang)
 Start Document Callback.

void wbxml_tree_clb_wbxml_end_document (void *ctx)
 End Document Callback.

void wbxml_tree_clb_wbxml_start_element (void *ctx, WBXMLTag *element, WBXMLAttribute **atts, WB_BOOL empty)
 Start Element Callback.

void wbxml_tree_clb_wbxml_end_element (void *ctx, WBXMLTag *element, WB_BOOL empty)
 End Element Callback.

void wbxml_tree_clb_wbxml_characters (void *ctx, WB_UTINY *ch, WB_ULONG start, WB_ULONG length)
 Characters Callback.

void wbxml_tree_clb_wbxml_pi (void *ctx, const WB_UTINY *target, WB_UTINY *data)
 Processing Instruction Callback.

void wbxml_tree_clb_xml_doctype_decl (void *ctx, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset)
 Doctype Declaration Callback.

void wbxml_tree_clb_xml_start_element (void *ctx, const XML_Char *localName, const XML_Char **attrs)
 Start Element Callback.

void wbxml_tree_clb_xml_end_element (void *ctx, const XML_Char *localName)
 End Element Callback.

void wbxml_tree_clb_xml_start_cdata (void *ctx)
 Start of CDATA Section Callback.

void wbxml_tree_clb_xml_end_cdata (void *ctx)
 End of CDATA Section Callback.

void wbxml_tree_clb_xml_characters (void *ctx, const XML_Char *ch, int len)
 Characters Callback.

void wbxml_tree_clb_xml_pi (void *ctx, const XML_Char *target, const XML_Char *data)
 Processing Instruction Callback.


Typedef Documentation

typedef struct WBXMLTree_s WBXMLTree
 

WBXML Tree structure.

typedef struct WBXMLTreeAttribute_s WBXMLTreeAttribute
 

WBXML Tree Attribute structure.

typedef struct WBXMLTreeClbCtx_s WBXMLTreeClbCtx
 

WBXML Tree Clb Context Structure

Note:
Used by WBXML Tree Callbacks ('wbxml_tree_clb_wbxml.h' and 'wbxml_tree_clb_xml.h')

typedef struct WBXMLTreeNode_s WBXMLTreeNode
 

WBXML Tree Node structure.

typedef enum WBXMLTreeNodeType_e WBXMLTreeNodeType
 

WBXML Tree Node Type.

Referenced by wbxml_tree_node_create().


Enumeration Type Documentation

enum WBXMLTreeNodeType_e
 

WBXML Tree Node Type.

Enumeration values:
WBXML_TREE_ELEMENT_NODE  Element Node
WBXML_TREE_TEXT_NODE  Text Node
WBXML_TREE_PI_NODE  PI Node
WBXML_TREE_TREE_NODE  WBXML Tree

Definition at line 55 of file wbxml_tree.h.


Function Documentation

WBXMLTreeAttribute* wbxml_tree_attribute_create void   
 

Create a Tree Attribute structure.

Returns:
The newly created Tree Attribute, or NULL if not enough memory

Definition at line 191 of file wbxml_tree.c.

References WBXMLTreeAttribute_s::attr, WBXMLTreeAttribute_s::next, NULL, and wbxml_malloc().

void wbxml_tree_attribute_destroy WBXMLTreeAttribute   attr
 

Destroy a Tree Attribute structure.

Parameters:
attr The Tree Attribute structure to destroy

Definition at line 205 of file wbxml_tree.c.

References WBXMLTreeAttribute_s::attr, WBXMLTreeAttribute_s::next, NULL, wbxml_attribute_destroy(), and wbxml_free().

Referenced by wbxml_tree_node_destroy().

void wbxml_tree_clb_wbxml_characters void *    ctx,
WB_UTINY *    ch,
WB_ULONG    start,
WB_ULONG    length
 

Characters Callback.

Parameters:
ctx User data
ch The characters
start The start position in the array
length The number of characters to read from the array

void wbxml_tree_clb_wbxml_end_document void *    ctx
 

End Document Callback.

Parameters:
ctx User data

Definition at line 70 of file wbxml_tree_clb_wbxml.c.

References WBXMLTreeClbCtx_s::error, and WBXML_OK.

void wbxml_tree_clb_wbxml_end_element void *    ctx,
WBXMLTag   element,
WB_BOOL    empty
 

End Element Callback.

Parameters:
ctx User data
element The Tag Element
empty Set to TRUE if this is an empty element

void wbxml_tree_clb_wbxml_pi void *    ctx,
const WB_UTINY *    target,
WB_UTINY *    data
 

Processing Instruction Callback.

Parameters:
ctx User data
target The processing instruction target.
data The processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target

void wbxml_tree_clb_wbxml_start_document void *    ctx,
WB_LONG    charset,
const WBXMLLangEntry   lang
 

Start Document Callback.

Parameters:
ctx User data
charset Charset (IANA code)
lang Language Table for this Document (cf: wbxml_table.[h|c])

void wbxml_tree_clb_wbxml_start_element void *    ctx,
WBXMLTag   element,
WBXMLAttribute **    atts,
WB_BOOL    empty
 

Start Element Callback.

Parameters:
ctx User data
element The Tag Element
atts The attributes attached to the element
empty Set to TRUE if this is an empty element

void wbxml_tree_clb_xml_characters void *    ctx,
const XML_Char *    ch,
int    len
 

Characters Callback.

Parameters:
ctx User data
ch The characters array
len The number of characters to read from the array

Definition at line 282 of file wbxml_tree_clb_xml.c.

References add_node_to_tree(), WBXMLTreeNode_s::content, WBXMLTreeClbCtx_s::current, WBXMLTreeClbCtx_s::error, NULL, WBXMLTreeNode_s::parent, WBXMLTreeClbCtx_s::skip_lvl, wbxml_buffer_create, WBXML_ERROR_NOT_ENOUGH_MEMORY, WBXML_OK, wbxml_tree_node_create(), wbxml_tree_node_destroy(), and WBXML_TREE_TEXT_NODE.

void wbxml_tree_clb_xml_doctype_decl void *    ctx,
const XML_Char *    doctypeName,
const XML_Char *    sysid,
const XML_Char *    pubid,
int    has_internal_subset
 

Doctype Declaration Callback.

Parameters:
ctx User data
doctypeName Doctype Name
sysid System ID
pubid Public ID
has_internal_subset Non-zero if the DOCTYPE declaration has an internal subset

Definition at line 49 of file wbxml_tree_clb_xml.c.

References WBXMLTree_s::lang, NULL, WBXMLTreeClbCtx_s::tree, WB_UTINY, wbxml_tables_get_main(), wbxml_tables_search_table(), and WBXML_WARNING.

void wbxml_tree_clb_xml_end_cdata void *    ctx
 

End of CDATA Section Callback.

Todo:
wbxml_tree_clb_xml_end_cdata()

Definition at line 267 of file wbxml_tree_clb_xml.c.

References WBXMLTreeClbCtx_s::error, WBXMLTreeClbCtx_s::skip_lvl, and WBXML_OK.

void wbxml_tree_clb_xml_end_element void *    ctx,
const XML_Char *    localName
 

End Element Callback.

Parameters:
ctx User data
localName The local tag name

Definition at line 163 of file wbxml_tree_clb_xml.c.

References add_node_to_tree(), WBXMLTreeClbCtx_s::current, WBXMLTreeClbCtx_s::error, WBXMLTreeClbCtx_s::input_buff, NULL, WBXMLTreeNode_s::parent, WBXMLTree_s::root, WBXMLTreeClbCtx_s::skip_lvl, WBXMLTreeClbCtx_s::skip_start, WBXMLTreeNode_s::tree, WBXMLTreeClbCtx_s::tree, wbxml_buffer_append_cstr, wbxml_buffer_create, wbxml_buffer_destroy(), wbxml_buffer_get_cstr(), WBXML_DEBUG, WBXML_ERROR_INTERNAL, WBXML_ERROR_NOT_ENOUGH_MEMORY, WBXML_OK, WBXML_STRCMP, wbxml_tree_destroy(), wbxml_tree_from_xml(), wbxml_tree_node_create(), WBXML_TREE_TREE_NODE, WBXMLError, and WBXMLTreeClbCtx_s::xml_parser.

void wbxml_tree_clb_xml_pi void *    ctx,
const XML_Char *    target,
const XML_Char *    data
 

Processing Instruction Callback.

Todo:
wbxml2xml_clb_pi()

Definition at line 316 of file wbxml_tree_clb_xml.c.

References WBXMLTreeClbCtx_s::error, WBXMLTreeClbCtx_s::skip_lvl, and WBXML_OK.

void wbxml_tree_clb_xml_start_cdata void *    ctx
 

Start of CDATA Section Callback.

Todo:
wbxml_tree_clb_xml_start_cdata()

Definition at line 251 of file wbxml_tree_clb_xml.c.

References WBXMLTreeClbCtx_s::error, WBXMLTreeClbCtx_s::skip_lvl, and WBXML_OK.

void wbxml_tree_clb_xml_start_element void *    ctx,
const XML_Char *    localName,
const XML_Char **    attrs
 

Start Element Callback.

Parameters:
ctx User data
localName The local tag name
attrs The attributes attached to the element

Definition at line 73 of file wbxml_tree_clb_xml.c.

References add_node_to_tree(), WBXMLTreeNode_s::attrs, construct_attribute_list(), WBXMLTreeClbCtx_s::current, WBXMLTreeClbCtx_s::error, WBXMLTree_s::lang, WBXMLTreeNode_s::name, NULL, WBXMLTreeClbCtx_s::skip_lvl, WBXMLTreeClbCtx_s::skip_start, WBXMLTreeClbCtx_s::tree, WB_UTINY, WBXML_ERROR_NOT_ENOUGH_MEMORY, WBXML_ERROR_UNKNOWN_XML_LANGUAGE, WBXML_OK, WBXML_STRCMP, wbxml_tables_get_main(), wbxml_tables_get_tag_from_xml(), wbxml_tables_search_table(), wbxml_tag_create_literal(), wbxml_tag_create_token(), wbxml_tag_destroy(), WBXML_TREE_ELEMENT_NODE, wbxml_tree_node_create(), wbxml_tree_node_destroy(), and WBXMLTreeClbCtx_s::xml_parser.

WBXMLTree* wbxml_tree_create void   
 

Create a Tree structure.

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

Definition at line 261 of file wbxml_tree.c.

References WBXMLTree_s::lang, NULL, WBXMLTree_s::root, and wbxml_malloc().

Referenced by wbxml_tree_from_wbxml(), and wbxml_tree_from_xml().

void wbxml_tree_destroy WBXMLTree   tree
 

Destroy a Tree structure.

Parameters:
tree The Tree structure to destroy

Definition at line 275 of file wbxml_tree.c.

References WBXMLTreeNode_s::children, FALSE, WBXMLTreeNode_s::next, NULL, WBXMLTreeNode_s::parent, WBXMLTree_s::root, TRUE, WB_BOOL, wbxml_free(), and wbxml_tree_node_destroy().

Referenced by wbxml_conv_wbxml2xml(), wbxml_conv_xml2wbxml(), wbxml_tree_clb_wbxml_characters(), wbxml_tree_clb_xml_end_element(), wbxml_tree_from_wbxml(), wbxml_tree_from_xml(), and wbxml_tree_node_destroy().

WBXMLError wbxml_tree_from_wbxml WB_UTINY *    wbxml,
WB_ULONG    wbxml_len,
WBXMLLanguage    lang,
WBXMLTree **    tree
 

Parse a WBXML document, using internal callbacks, and construct a WBXML Tree.

Parameters:
wbxml The WBXML document to parse
wbxml_len The WBXML document length
lang Can be used to force parsing of a given Language (set it to WBXML_LANG_UNKNOWN if you don't want to force anything)
tree [out] The resulting WBXML Tree
Returns:
Return WBXML_OK if no error, an error code otherwise

Referenced by wbxml_conv_wbxml2xml(), and wbxml_tree_clb_wbxml_characters().

WBXMLError wbxml_tree_from_xml WB_UTINY *    xml,
WBXMLTree **    tree
 

Parse an XML document, using internal callbacks, and construct a WBXML Tree.

Parameters:
xml The XML document to parse
tree [out] The resulting WBXML Tree
Returns:
Return WBXML_OK if no error, an error code otherwise
Note:
Needs 'HAVE_EXPAT' compile flag

Referenced by wbxml_conv_xml2wbxml(), and wbxml_tree_clb_xml_end_element().

WBXMLTreeNode* wbxml_tree_get_element_node_from_name WBXMLTreeNode   node,
const char *    name,
WB_BOOL    recurs
 

Get an Element Node, given the Element Name.

Parameters:
node The Tree Node where to start searching
name The Element Name we are searching
recurs If FALSE, only search into direct childs of 'node'
Returns:
The found Tree Node, or NULL if not found
Todo:
Handle 'recurs' TRUE

WBXMLTreeNode* wbxml_tree_node_create WBXMLTreeNodeType    type
 

Create a Tree Node structure.

Parameters:
type Node type
Returns:
The newly created Tree Node, or NULL if not enough memory

Definition at line 223 of file wbxml_tree.c.

References WBXMLTreeNode_s::attrs, WBXMLTreeNode_s::children, WBXMLTreeNode_s::content, WBXMLTreeNode_s::name, WBXMLTreeNode_s::next, NULL, WBXMLTreeNode_s::parent, WBXMLTreeNode_s::prev, WBXMLTreeNode_s::tree, WBXMLTreeNode_s::type, wbxml_malloc(), and WBXMLTreeNodeType.

Referenced by wbxml_tree_clb_wbxml_characters(), wbxml_tree_clb_wbxml_start_element(), wbxml_tree_clb_xml_characters(), wbxml_tree_clb_xml_end_element(), and wbxml_tree_clb_xml_start_element().

void wbxml_tree_node_destroy WBXMLTreeNode   node
 

Destroy a Tree Node structure.

Parameters:
node The Tree Node structure to destroy

Definition at line 245 of file wbxml_tree.c.

References WBXMLTreeNode_s::attrs, WBXMLTreeNode_s::content, WBXMLTreeNode_s::name, NULL, WBXMLTreeNode_s::tree, wbxml_buffer_destroy(), wbxml_free(), wbxml_tag_destroy(), wbxml_tree_attribute_destroy(), and wbxml_tree_destroy().

Referenced by wbxml_tree_clb_wbxml_characters(), wbxml_tree_clb_wbxml_start_element(), wbxml_tree_clb_xml_characters(), wbxml_tree_clb_xml_start_element(), and wbxml_tree_destroy().


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