summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-07-07 13:17:58 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-07-07 13:17:58 +0100
commitc33030571a009fb42856298b00d46c2eaf90d203 (patch)
tree93394ab940bef35443d6740f3f8ec87c0d41f76c /src
parentd040bdb3e5a70ef7e05b186e41cb90de27aa67c0 (diff)
downloadlibdom-c33030571a009fb42856298b00d46c2eaf90d203.tar.gz
libdom-c33030571a009fb42856298b00d46c2eaf90d203.tar.bz2
HTMLDocument: Make lists retrieved by tag name be caseless
Diffstat (limited to 'src')
-rw-r--r--src/html/html_document.c42
-rw-r--r--src/html/html_document.h9
2 files changed, 49 insertions, 2 deletions
diff --git a/src/html/html_document.c b/src/html/html_document.c
index 37d19de..10f1cc7 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -220,6 +220,48 @@ dom_exception _dom_html_document_create_element_ns(dom_document *doc,
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 */
diff --git a/src/html/html_document.h b/src/html/html_document.h
index 7f9bdb8..fbe7155 100644
--- a/src/html/html_document.h
+++ b/src/html/html_document.h
@@ -113,6 +113,11 @@ dom_exception _dom_html_document_create_element(dom_document *doc,
dom_exception _dom_html_document_create_element_ns(dom_document *doc,
dom_string *namespace, dom_string *qname,
dom_element **result);
+dom_exception _dom_html_document_get_elements_by_tag_name(dom_document *doc,
+ dom_string *tagname, dom_nodelist **result);
+dom_exception _dom_html_document_get_elements_by_tag_name_ns(
+ dom_document *doc, dom_string *namespace,
+ dom_string *localname, dom_nodelist **result);
#define DOM_DOCUMENT_VTABLE_HTML \
_dom_document_get_doctype, \
@@ -126,11 +131,11 @@ dom_exception _dom_html_document_create_element_ns(dom_document *doc,
_dom_document_create_processing_instruction, \
_dom_document_create_attribute, \
_dom_document_create_entity_reference, \
- _dom_document_get_elements_by_tag_name, \
+ _dom_html_document_get_elements_by_tag_name, \
_dom_document_import_node, \
_dom_html_document_create_element_ns, \
_dom_document_create_attribute_ns, \
- _dom_document_get_elements_by_tag_name_ns, \
+ _dom_html_document_get_elements_by_tag_name_ns, \
_dom_document_get_element_by_id, \
_dom_document_get_input_encoding, \
_dom_document_get_xml_encoding, \