summaryrefslogtreecommitdiff
path: root/src/html/html_document.c
blob: 1c3ebabaf2e41075c566fb67c89ade52f89c3109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/*
 * This file is part of libdom.
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
 */

#include <assert.h>
#include <stdlib.h>

#include "html/html_document.h"
#include "html/html_element.h"
#include "html/html_collection.h"
#include "html/html_html_element.h"
#include "html/html_head_element.h"
#include "html/html_body_element.h"
#include "html/html_link_element.h"
#include "html/html_title_element.h"
#include "html/html_meta_element.h"
#include "html/html_form_element.h"
#include "html/html_button_element.h"
#include "html/html_input_element.h"
#include "html/html_text_area_element.h"
#include "html/html_opt_group_element.h"
#include "html/html_option_element.h"
#include "html/html_select_element.h"
#include "html/html_hr_element.h"
#include "html/html_dlist_element.h"
#include "html/html_directory_element.h"
#include "html/html_menu_element.h"
#include "html/html_fieldset_element.h"
#include "html/html_legend_element.h"
#include "html/html_paragraph_element.h"
#include "html/html_heading_element.h"
#include "html/html_quote_element.h"
#include "html/html_pre_element.h"
#include "html/html_br_element.h"
#include "html/html_label_element.h"
#include "html/html_ulist_element.h"
#include "html/html_olist_element.h"
#include "html/html_li_element.h"
#include "html/html_font_element.h"

#include "core/attr.h"
#include "core/string.h"
#include "utils/namespace.h"
#include "utils/utils.h"

static struct dom_html_document_vtable html_document_vtable = {
	{
		{
			{
				DOM_NODE_EVENT_TARGET_VTABLE
			},
			DOM_NODE_VTABLE,
		},
		DOM_DOCUMENT_VTABLE_HTML
	},
	DOM_HTML_DOCUMENT_VTABLE
};

static struct dom_node_protect_vtable html_document_protect_vtable = {
	DOM_HTML_DOCUMENT_PROTECT_VTABLE
};

/* Create a HTMLDocument */
dom_exception _dom_html_document_create(
		dom_events_default_action_fetcher daf,
		void *daf_ctx,
		dom_html_document **doc)
{
	dom_exception error;
	dom_html_document *result;

	result = malloc(sizeof(dom_html_document));
	if (result == NULL)
		return DOM_NO_MEM_ERR;

	result->base.base.base.vtable = &html_document_vtable;
	result->base.base.vtable = &html_document_protect_vtable;
	
	error = _dom_html_document_initialise(result, daf, daf_ctx);
	if (error != DOM_NO_ERR) {
		free(result);
		return error;
	}

	*doc = result;
	return DOM_NO_ERR;
}

/* Initialise a HTMLDocument */
dom_exception _dom_html_document_initialise(dom_html_document *doc,
		dom_events_default_action_fetcher daf,
		void *daf_ctx)
{
	dom_exception error;
	int sidx;

	error = _dom_document_initialise(&doc->base, daf, daf_ctx);
	if (error != DOM_NO_ERR)
		return error;

	doc->title = NULL;
	doc->referrer = NULL;
	doc->domain = NULL;
	doc->url = NULL;
	doc->cookie = NULL;
	
	doc->memoised = calloc(sizeof(dom_string *), hds_COUNT);
	if (doc->memoised == NULL) {
		error = DOM_NO_MEM_ERR;
		goto out;
	}
	
#define HTML_DOCUMENT_STRINGS_ACTION(attr,str)                             \
	error = dom_string_create_interned((const uint8_t *) #str,	\
					   SLEN(#str), &doc->memoised[hds_##attr]); \
	if (error != DOM_NO_ERR) {					\
		goto out;						\
	}

#include "html_document_strings.h"
#undef HTML_DOCUMENT_STRINGS_ACTION

out:
	if (doc->memoised != NULL && error != DOM_NO_ERR) {
		for(sidx = 0; sidx < hds_COUNT; ++sidx) {
			if (doc->memoised[sidx] != NULL) {
				dom_string_unref(doc->memoised[sidx]);
			}
		}
		free(doc->memoised);
		doc->memoised = NULL;
	}
	return error;
}

/* Finalise a HTMLDocument */
bool _dom_html_document_finalise(dom_html_document *doc)
{
	int sidx;
	
	if (doc->cookie != NULL)
		dom_string_unref(doc->cookie);
	if (doc->url != NULL)
		dom_string_unref(doc->url);
	if (doc->domain != NULL)
		dom_string_unref(doc->domain);
	if (doc->referrer != NULL)
		dom_string_unref(doc->referrer);
	if (doc->title != NULL)
		dom_string_unref(doc->title);
	
	if (doc->memoised != NULL) {
		for(sidx = 0; sidx < hds_COUNT; ++sidx) {
			if (doc->memoised[sidx] != NULL) {
				dom_string_unref(doc->memoised[sidx]);
			}
		}
		free(doc->memoised);
		doc->memoised = NULL;
	}
	
	return _dom_document_finalise(&doc->base);
}

/* Destroy a HTMLDocument */
void _dom_html_document_destroy(dom_node_internal *node)
{
	dom_html_document *doc = (dom_html_document *) node;

	if (_dom_html_document_finalise(doc) == true)
		free(doc);
}

dom_exception _dom_html_document_copy(dom_node_internal *old,
		dom_node_internal **copy)
{
	UNUSED(old);
	UNUSED(copy);

	return DOM_NOT_SUPPORTED_ERR;
}

/* Overloaded methods inherited from super class */

/** Internal method to support both kinds of create method */
static dom_exception
_dom_html_document_create_element_internal(dom_html_document *html,
					   dom_string *in_tag_name,
					   dom_string *namespace,
					   dom_string *prefix,
					   dom_html_element **result)
{
	dom_exception exc;
	dom_string *tag_name;

	exc = dom_string_toupper(in_tag_name, true, &tag_name);
	if (exc != DOM_NO_ERR)
		return exc;

	if (dom_string_caseless_isequal(tag_name, html->memoised[hds_HTML])) {
		exc = _dom_html_html_element_create(html, namespace, prefix,
				(dom_html_html_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_HEAD])) {
		exc = _dom_html_head_element_create(html, namespace, prefix,
				(dom_html_head_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TITLE])) {
		exc = _dom_html_title_element_create(html, namespace, prefix,
				(dom_html_title_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_BODY])) {
		exc = _dom_html_body_element_create(html, namespace, prefix,
				(dom_html_body_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FORM])) {
		exc = _dom_html_form_element_create(html, namespace, prefix,
				(dom_html_form_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LINK])) {
		exc = _dom_html_link_element_create(html, namespace, prefix,
				(dom_html_link_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_BUTTON])) {
		exc = _dom_html_button_element_create(html, namespace, prefix,
				(dom_html_button_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_INPUT])) {
		exc = _dom_html_input_element_create(html, namespace, prefix,
				(dom_html_input_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TEXTAREA])) {
		exc = _dom_html_text_area_element_create(html, namespace, prefix,
				(dom_html_text_area_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_OPTGROUP])) {
		exc = _dom_html_opt_group_element_create(html, namespace, prefix,
				(dom_html_opt_group_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_OPTION])) {
		exc = _dom_html_option_element_create(html, namespace, prefix,
				(dom_html_option_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_SELECT])) {
		exc = _dom_html_select_element_create(html, namespace, prefix,
				(dom_html_select_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_HR])) {
		exc = _dom_html_hr_element_create(html, namespace, prefix,
				(dom_html_hr_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_DL])) {
		exc = _dom_html_d_list_element_create(html, namespace, prefix,
				(dom_html_d_list_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_DIRECTORY])) {
		exc = _dom_html_directory_element_create(html, namespace, prefix,
				(dom_html_directory_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_MENU])) {
		exc = _dom_html_menu_element_create(html, namespace, prefix,
				(dom_html_menu_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FIELDSET])) {
		exc = _dom_html_field_set_element_create(html, namespace, prefix,
				(dom_html_field_set_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LEGEND])) {
		exc = _dom_html_legend_element_create(html, namespace, prefix,
				(dom_html_legend_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_P])) {
		exc = _dom_html_paragraph_element_create(html, namespace, prefix,
				(dom_html_paragraph_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_H1]) ||
			dom_string_caseless_isequal(tag_name, html->memoised[hds_H2]) ||
			dom_string_caseless_isequal(tag_name, html->memoised[hds_H3]) ||
			dom_string_caseless_isequal(tag_name, html->memoised[hds_H4]) ||
			dom_string_caseless_isequal(tag_name, html->memoised[hds_H5]) ||
			dom_string_caseless_isequal(tag_name, html->memoised[hds_H6])
			) {
		exc = _dom_html_heading_element_create(html, tag_name, namespace, prefix,
				(dom_html_heading_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_Q])) {
		exc = _dom_html_quote_element_create(html, namespace, prefix,
				(dom_html_quote_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_PRE])) {
		exc = _dom_html_pre_element_create(html, namespace, prefix,
				(dom_html_pre_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_BR])) {
		exc = _dom_html_br_element_create(html, namespace, prefix,
				(dom_html_br_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LABEL])) {
		exc = _dom_html_label_element_create(html, namespace, prefix,
				(dom_html_label_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_UL])) {
		exc = _dom_html_u_list_element_create(html, namespace, prefix,
				(dom_html_u_list_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_OL])) {
		exc = _dom_html_o_list_element_create(html, namespace, prefix,
				(dom_html_o_list_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LI])) {
		exc = _dom_html_li_element_create(html, namespace, prefix,
				(dom_html_li_element **) result);
	} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FONT])) {
		exc = _dom_html_font_element_create(html, namespace, prefix,
				(dom_html_font_element **) result);
	} else {
		exc =  _dom_html_element_create(html, tag_name, namespace,
						prefix, result);
	}

	dom_string_unref(tag_name);

	return exc;
}

dom_exception _dom_html_document_create_element(dom_document *doc,
		dom_string *tag_name, dom_element **result)
{
	dom_html_document *html = (dom_html_document *) doc;

	return _dom_html_document_create_element_internal(html,
			tag_name, NULL, NULL,
			(dom_html_element **)result);
}

dom_exception _dom_html_document_create_element_ns(dom_document *doc,
		dom_string *namespace, dom_string *qname,
		dom_element **result)
{
	dom_html_document *html = (dom_html_document *) doc;
	dom_string *prefix, *localname;
	dom_exception err;

	/* Divide QName into prefix/localname pair */
	err = _dom_namespace_split_qname(qname, &prefix, &localname);
	if (err != DOM_NO_ERR) {
		return err;
	}

	/* Attempt to create element */
	err = _dom_html_document_create_element_internal(html, localname,
			namespace, prefix, (dom_html_element **)result);

	/* Tidy up */
	dom_string_unref(localname);

	if (prefix != NULL) {
		dom_string_unref(prefix);
	}

	return err;
}

/**
 * Create an attribute
 *
 * \param doc     The document owning the attribute
 * \param name    The name of the attribute
 * \param result  Pointer to location to receive result
 * \return DOM_NO_ERR                on success,
 *
 * The constructed attribute will always be classified as 'specified'.
 *
 * The returned node will have its reference count increased. It is
 * the responsibility of the caller to unref the node once it has
 * finished with it.
 */
dom_exception _dom_html_document_create_attribute(dom_document *doc,
		dom_string *name, dom_attr **result)
{
	return _dom_attr_create(doc, name, NULL, NULL, true, result);
}

/**
 * Create an attribute from the qualified name and namespace URI
 *
 * \param doc        The document owning the attribute
 * \param namespace  The namespace URI to use
 * \param qname      The qualified name of the attribute
 * \param result     Pointer to location to receive result
 * \return DOM_NO_ERR                on success,
 *         DOM_NAMESPACE_ERR         if ::qname is malformed, or it has a
 *                                   prefix and ::namespace is NULL, or
 *                                   ::qname has a prefix "xml" and
 *                                   ::namespace is not
 *                                   "http://www.w3.org/XML/1998/namespace",
 *                                   or ::qname has a prefix "xmlns" and
 *                                   ::namespace is not
 *                                   "http://www.w3.org/2000/xmlns", or
 *                                   ::namespace is
 *                                   "http://www.w3.org/2000/xmlns" and
 *                                   ::qname is not (or is not prefixed by)
 *                                   "xmlns",
 *         DOM_NOT_SUPPORTED_ERR     if ::doc does not support the "XML"
 *                                   feature.
 *
 * The returned node will have its reference count increased. It is
 * the responsibility of the caller to unref the node once it has
 * finished with it.
 */
dom_exception _dom_html_document_create_attribute_ns(dom_document *doc,
		dom_string *namespace, dom_string *qname,
		dom_attr **result)
{
	dom_string *prefix, *localname;
	dom_exception err;

	/* Divide QName into prefix/localname pair */
	err = _dom_namespace_split_qname(qname, &prefix, &localname);
	if (err != DOM_NO_ERR) {
		return err;
	}

	/* Attempt to create attribute */
	err = _dom_attr_create(doc, localname, namespace, prefix, true, result);

	/* Tidy up */
	if (localname != NULL) {
		dom_string_unref(localname);
	}

	if (prefix != NULL) {
		dom_string_unref(prefix);
	}

	return err;
}

/**
 * Retrieve a list of all elements with a given tag name
 *
 * \param doc      The document to search in
 * \param tagname  The tag name to search for ("*" for all)
 * \param result   Pointer to location to receive result
 * \return DOM_NO_ERR.
 *
 * The returned list will have its reference count increased. It is
 * the responsibility of the caller to unref the list once it has
 * finished with it.
 */
dom_exception _dom_html_document_get_elements_by_tag_name(dom_document *doc,
		dom_string *tagname, dom_nodelist **result)
{
	return _dom_document_get_nodelist(doc, DOM_NODELIST_BY_NAME_CASELESS,
			(dom_node_internal *) doc,  tagname, NULL, NULL, 
			result);
}

/**
 * Retrieve a list of all elements with a given local name and namespace URI
 *
 * \param doc        The document to search in
 * \param namespace  The namespace URI
 * \param localname  The local name
 * \param result     Pointer to location to receive result
 * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
 *
 * The returned list will have its reference count increased. It is
 * the responsibility of the caller to unref the list once it has
 * finished with it.
 */
dom_exception _dom_html_document_get_elements_by_tag_name_ns(
		dom_document *doc, dom_string *namespace,
		dom_string *localname, dom_nodelist **result)
{
	return _dom_document_get_nodelist(doc, DOM_NODELIST_BY_NAMESPACE_CASELESS,
			(dom_node_internal *) doc, NULL, namespace, localname, 
			result);
}

/*-----------------------------------------------------------------------*/
/* The DOM spec public API */

/**
 * Get the title of this HTMLDocument 
 * \param doc    The document object
 * \param title  The reutrned title string
 * \return DOM_NO_ERR on success, appropriated dom_exception on failure.
 *
 * @note: this method find a title for the document as following:
 * 1. If there is a title in the document object set by 
 *    dom_html_document_set_title, then use it;
 * 2. If there is no such one, find the <title> element and use its text
 *    as the returned title.
 */
dom_exception _dom_html_document_get_title(dom_html_document *doc,
		dom_string **title)
{
	dom_exception exc = DOM_NO_ERR;
	*title = NULL;
	
	if (doc->title != NULL) {
		*title = dom_string_ref(doc->title);
	} else {
		dom_element *node;
		dom_nodelist *nodes;
		uint32_t len;
		
		exc = dom_document_get_elements_by_tag_name(doc,
							    doc->memoised[hds_TITLE],
							    &nodes);
		if (exc != DOM_NO_ERR) {
			return exc;
		}
		
		exc = dom_nodelist_get_length(nodes, &len);
		if (exc != DOM_NO_ERR) {
			dom_nodelist_unref(nodes);
			return exc;
		}
		
		if (len == 0) {
			dom_nodelist_unref(nodes);
			return DOM_NO_ERR;
		}
		
		exc = dom_nodelist_item(nodes, 0, (void *) &node);
		dom_nodelist_unref(nodes);
		if (exc != DOM_NO_ERR) {
			return exc;
		}
		
		exc = dom_node_get_text_content(node, title);
		dom_node_unref(node);
	}

	return exc;
}

dom_exception _dom_html_document_set_title(dom_html_document *doc,
		dom_string *title)
{
	if (doc->title != NULL)
		dom_string_unref(doc->title);

	doc->title = dom_string_ref(title);

	return DOM_NO_ERR;
}

dom_exception _dom_html_document_get_referrer(dom_html_document *doc,
		dom_string **referrer)
{
	*referrer = dom_string_ref(doc->referrer);

	return DOM_NO_ERR;
}

dom_exception _dom_html_document_get_domain(dom_html_document *doc,
		dom_string **domain)
{
	*domain = dom_string_ref(doc->domain);

	return DOM_NO_ERR;
}

dom_exception _dom_html_document_get_url(dom_html_document *doc,
		dom_string **url)
{
	*url = dom_string_ref(doc->url);

	return DOM_NO_ERR;
}

dom_exception _dom_html_document_get_body(dom_html_document *doc,
		struct dom_html_element **body)
{
	UNUSED(doc);
	UNUSED(body);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_set_body(dom_html_document *doc,
		struct dom_html_element *body)
{
	UNUSED(doc);
	UNUSED(body);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_get_images(dom_html_document *doc,
		struct dom_html_collection **col)
{
	UNUSED(doc);
	UNUSED(col);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_get_applets(dom_html_document *doc,
		struct dom_html_collection **col)
{
	UNUSED(doc);
	UNUSED(col);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_get_links(dom_html_document *doc,
		struct dom_html_collection **col)
{
	UNUSED(doc);
	UNUSED(col);

	return DOM_NOT_SUPPORTED_ERR;
}

static bool __dom_html_document_node_is_form(dom_node_internal *node,
					     void *ctx)
{
	dom_html_document *doc = (dom_html_document *)node->owner;
	
	UNUSED(ctx);
	
	return dom_string_caseless_isequal(node->name,
					   doc->memoised[hds_FORM]);
}

dom_exception _dom_html_document_get_forms(dom_html_document *doc,
		struct dom_html_collection **col)
{
	dom_html_collection *result;
	dom_element *root;
	dom_exception err;

	err = dom_document_get_document_element(doc, &root);
	if (err != DOM_NO_ERR)
		return err;

	err = _dom_html_collection_create(doc, (dom_node_internal *) root, 
			__dom_html_document_node_is_form, NULL, &result);
	if (err != DOM_NO_ERR) {
		dom_node_unref(root);
		return err;
	}

	dom_node_unref(root);

	*col = result;

	return DOM_NO_ERR;
}

dom_exception _dom_html_document_get_anchors(dom_html_document *doc,
		struct dom_html_collection **col)
{
	UNUSED(doc);
	UNUSED(col);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_get_cookie(dom_html_document *doc,
		dom_string **cookie)
{
	UNUSED(doc);
	UNUSED(cookie);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_set_cookie(dom_html_document *doc,
		dom_string *cookie)
{
	UNUSED(doc);
	UNUSED(cookie);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_open(dom_html_document *doc)
{
	UNUSED(doc);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_close(dom_html_document *doc)
{
	UNUSED(doc);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_write(dom_html_document *doc,
		dom_string *text)
{
	UNUSED(doc);
	UNUSED(text);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_writeln(dom_html_document *doc,
		dom_string *text)
{
	UNUSED(doc);
	UNUSED(text);

	return DOM_NOT_SUPPORTED_ERR;
}

dom_exception _dom_html_document_get_elements_by_name(dom_html_document *doc,
		dom_string *name, struct dom_nodelist **list)
{
	UNUSED(doc);
	UNUSED(name);
	UNUSED(list);

	return DOM_NOT_SUPPORTED_ERR;
}