diff options
Diffstat (limited to 'bindings/hubbub/parser.c')
-rw-r--r-- | bindings/hubbub/parser.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/bindings/hubbub/parser.c b/bindings/hubbub/parser.c index 9423c2c..f0e088e 100644 --- a/bindings/hubbub/parser.c +++ b/bindings/hubbub/parser.c @@ -713,6 +713,7 @@ dom_hubbub_parser_default_script(void *ctx, struct dom_node *node) * \param enc Source charset, or NULL * \param fix_enc Whether fix the encoding * \param enable_script Whether scripting should be enabled. + * \param document Dom document return parameter. * \param msg Informational message function * \param script Script callback function * \param mctx Pointer to client-specific private data @@ -722,6 +723,7 @@ dom_hubbub_parser * dom_hubbub_parser_create(const char *enc, bool fix_enc, bool enable_script, + dom_document **document, dom_msg msg, dom_script script, void *mctx) @@ -731,6 +733,12 @@ dom_hubbub_parser_create(const char *enc, hubbub_error error; dom_exception err; + /* check result parameter */ + if (document == NULL) { + msg(DOM_MSG_CRITICAL, mctx, "Bad document return parameter"); + return NULL; + } + parser = malloc(sizeof(dom_hubbub_parser)); if (parser == NULL) { msg(DOM_MSG_CRITICAL, mctx, "No memory for parsing context"); @@ -795,6 +803,9 @@ dom_hubbub_parser_create(const char *enc, HUBBUB_PARSER_ENABLE_SCRIPTING, ¶ms); + /* set return parameter */ + *document = (dom_document *)dom_node_ref(parser->doc); + return parser; } @@ -884,24 +895,6 @@ dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser) } /** - * Fetch the Document object from the parser - * - * \param parser The parser object - * \return the created document on success, NULL on failure - */ -dom_document *dom_hubbub_parser_get_document(dom_hubbub_parser *parser) -{ - dom_document *doc = NULL; - - if (parser->complete) { - doc = parser->doc; - parser->doc = NULL; - } - - return doc; -} - -/** * Retrieve the encoding * * \param parser The parser object |