NetSurf
Typedefs | Functions
libdom.h File Reference

libdom utilities (implementation). More...

#include <stdbool.h>
#include <stdio.h>
#include <dom/dom.h>
#include <dom/bindings/hubbub/parser.h>
#include <dom/bindings/hubbub/errors.h>
Include dependency graph for libdom.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef nserror(* libdom_iterate_cb) (dom_node *node, void *ctx)
 

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_parse_file (const char *filename, const char *encoding, dom_document **doc)
 
nserror libdom_hubbub_error_to_nserror (dom_hubbub_error error)
 Convert libdom hubbub binding errors to nserrors. 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...
 

Detailed Description

libdom utilities (implementation).

Definition in file libdom.h.

Typedef Documentation

◆ libdom_iterate_cb

typedef nserror(* libdom_iterate_cb) (dom_node *node, void *ctx)

Definition at line 44 of file libdom.h.

Function Documentation

◆ libdom_dump_structure()

nserror libdom_dump_structure ( dom_node *  node,
FILE *  f,
int  depth 
)

Walk though a DOM (sub)tree, in depth first order, printing DOM structure.

Parameters
nodeThe root node to start from.
fThe file to write output into.
depthThe 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ libdom_find_first_element()

dom_node * libdom_find_first_element ( dom_node *  parent,
lwc_string *  element_name 
)

Search children of a node for first named element.

Parameters
parentdom_node to search children of, or NULL
element_namename of element to find
Returns
first child of node which is an element and matches name, or NULL if not found or parameter node is NULL

Definition at line 33 of file libdom.c.

References next_node(), node_name(), and parent.

Referenced by hotlist_load(), and hotlist_load_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ libdom_hubbub_error_to_nserror()

nserror libdom_hubbub_error_to_nserror ( dom_hubbub_error  error)

Convert libdom hubbub binding errors to nserrors.

Parameters
errorThe hubbub binding error to convert
Returns
The appropriate nserror
Todo:
better error handling and reporting

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().

Here is the caller graph for this function:

◆ libdom_iterate_child_elements()

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().

Here is the caller graph for this function:

◆ libdom_parse_file()

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().

Here is the call graph for this function:
Here is the caller graph for this function: