NetSurf
|
libdom utilities (implementation). More...
#include <assert.h>
#include <string.h>
#include <dom/dom.h>
#include "utils/config.h"
#include "utils/log.h"
#include "utils/libdom.h"
Go to the source code of this file.
Macros | |
#define | BUF_SIZE 512 |
Functions | |
dom_node * | libdom_find_first_element (dom_node *parent, lwc_string *element_name) |
Search children of a node for first named element. More... | |
nserror | libdom_iterate_child_elements (dom_node *parent, libdom_iterate_cb cb, void *ctx) |
nserror | libdom_hubbub_error_to_nserror (dom_hubbub_error error) |
Convert libdom hubbub binding errors to nserrors. More... | |
static void | ignore_dom_msg (uint32_t severity, void *ctx, const char *msg,...) |
static bool | dump_dom_element_attribute (dom_node *node, FILE *f, const char *attribute) |
Dump attribute/value for an element node. More... | |
static bool | dump_dom_element (dom_node *node, FILE *f, int depth) |
Print a line in a DOM structure dump for an element. More... | |
nserror | libdom_dump_structure (dom_node *node, FILE *f, int depth) |
Walk though a DOM (sub)tree, in depth first order, printing DOM structure. More... | |
nserror | libdom_parse_file (const char *filename, const char *encoding, dom_document **doc) |
libdom utilities (implementation).
Definition in file libdom.c.
#define BUF_SIZE 512 |
|
static |
Print a line in a DOM structure dump for an element.
node | The node to dump |
f | file handle to dump to. |
depth | The node's depth |
Definition at line 261 of file libdom.c.
References dump_dom_element_attribute(), node_name(), and type.
Referenced by libdom_dump_structure().
|
static |
Dump attribute/value for an element node.
node | The element node to dump attribute details for |
f | file handle to dump to. |
attribute | The attribute to dump |
Definition at line 199 of file libdom.c.
References type.
Referenced by dump_dom_element().
|
static |
Definition at line 185 of file libdom.c.
Referenced by libdom_parse_file().
nserror libdom_dump_structure | ( | dom_node * | node, |
FILE * | f, | ||
int | depth | ||
) |
Walk though a DOM (sub)tree, in depth first order, printing DOM structure.
node | The root node to start from. |
f | The file to write output into. |
depth | The depth of 'node' in the (sub)tree. |
Definition at line 331 of file libdom.c.
References dump_dom_element(), libdom_dump_structure(), NSERROR_DOM, and NSERROR_OK.
Referenced by html_debug_dump(), and libdom_dump_structure().
dom_node * libdom_find_first_element | ( | dom_node * | parent, |
lwc_string * | element_name | ||
) |
Search children of a node for first named element.
parent | dom_node to search children of, or NULL |
element_name | name of element to find |
Definition at line 33 of file libdom.c.
References next_node(), node_name(), and parent.
Referenced by hotlist_load(), and hotlist_load_entry().
nserror libdom_hubbub_error_to_nserror | ( | dom_hubbub_error | error | ) |
Convert libdom hubbub binding errors to nserrors.
error | The hubbub binding error to convert |
Definition at line 122 of file libdom.c.
References NSERROR_BAD_ENCODING, NSERROR_BAD_PARAMETER, NSERROR_DOM, NSERROR_ENCODING_CHANGE, NSERROR_INVALID, NSERROR_NEED_DATA, NSERROR_NOMEM, NSERROR_NOT_FOUND, NSERROR_OK, and NSERROR_UNKNOWN.
Referenced by html_begin_conversion(), html_create_html_data(), html_process_data(), html_process_encoding_change(), and libdom_parse_file().
nserror libdom_iterate_child_elements | ( | dom_node * | parent, |
libdom_iterate_cb | cb, | ||
void * | ctx | ||
) |
Definition at line 76 of file libdom.c.
References NSERROR_NOMEM, NSERROR_OK, parent, and type.
Referenced by hotlist_load_directory().
nserror libdom_parse_file | ( | const char * | filename, |
const char * | encoding, | ||
dom_document ** | doc | ||
) |
Definition at line 381 of file libdom.c.
References BUF_SIZE, ignore_dom_msg(), libdom_hubbub_error_to_nserror(), NSERROR_DOM, NSERROR_NOT_FOUND, and NSERROR_OK.
Referenced by hotlist_load().