ELinks 0.18.0
|
#include "dom/code.h"
#include "dom/node.h"
#include "dom/stack.h"
#include "dom/sgml/sgml.h"
#include "dom/scanner.h"
Data Structures | |
struct | sgml_parser_state |
SGML parser state. More... | |
struct | sgml_parser |
The SGML parser. More... | |
Typedefs | |
typedef enum dom_code(* | sgml_error_T) (struct sgml_parser *, struct dom_string *, unsigned int) |
SGML error callback. | |
Enumerations | |
enum | sgml_parser_type { SGML_PARSER_STREAM , SGML_PARSER_TREE } |
SGML parser type. More... | |
enum | sgml_parser_flag { SGML_PARSER_COUNT_LINES = 1 , SGML_PARSER_COMPLETE = 2 , SGML_PARSER_INCREMENTAL = 4 , SGML_PARSER_DETECT_ERRORS = 8 } |
SGML parser flags. More... | |
Functions | |
struct sgml_parser * | init_sgml_parser (enum sgml_parser_type type, enum sgml_document_type doctype, struct dom_string *uri, unsigned int flags) |
Initialise an SGML parser. | |
void | done_sgml_parser (struct sgml_parser *parser) |
Release an SGML parser. | |
enum dom_code | parse_sgml (struct sgml_parser *parser, char *buf, size_t bufsize, int complete) |
Parse a chunk of SGML source. | |
unsigned int | get_sgml_parser_line_number (struct sgml_parser *parser) |
Get the line position in the source. | |
typedef enum dom_code(* sgml_error_T) (struct sgml_parser *, struct dom_string *, unsigned int) |
SGML error callback.
Called by the SGML parser when a parsing error has occurred.
If the return code is not DOM_CODE_OK the parsing will be ended and that code will be returned.
enum sgml_parser_flag |
enum sgml_parser_type |
SGML parser type.
There are two kinds of parser types: One that optimises one-time access to the DOM tree and one that creates a persistent DOM tree.
void done_sgml_parser | ( | struct sgml_parser * | parser | ) |
Release an SGML parser.
Deallocates all resources, except the root node.
parser | The parser being released. |
unsigned int get_sgml_parser_line_number | ( | struct sgml_parser * | parser | ) |
Get the line position in the source.
parser | A parser created with init_sgml_parser. |
struct sgml_parser * init_sgml_parser | ( | enum sgml_parser_type | type, |
enum sgml_document_type | doctype, | ||
struct dom_string * | uri, | ||
unsigned int | flags ) |
Initialise an SGML parser.
Initialise an SGML parser with the given properties.
type | Stream or tree; one-time or persistant. |
doctype | The document type, this affects what sub type nodes are given. |
uri | The URI of the document root. |
flags | Flags controlling the behaviour of the parser. |
enum dom_code parse_sgml | ( | struct sgml_parser * | parser, |
char * | buf, | ||
size_t | bufsize, | ||
int | complete ) |
Parse a chunk of SGML source.
Parses the given buffer. For incremental rendering the last buffer can be signals through the complete
parameter.
parser | A parser created with init_sgml_parser. |
buf | A buffer containing the chunk to parse. |
bufsize | The size of the buffer given in the buf parameter. |
complete | Whether this is the last chunk to parse. |