diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-07-07 13:17:58 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-07-07 13:17:58 +0100 |
commit | 0e51c3a8ca92d6b98339c5910de51ddc79da54bd (patch) | |
tree | 93394ab940bef35443d6740f3f8ec87c0d41f76c /src/html | |
parent | 64ebb000750151aab7ee0738512da061cad2783e (diff) | |
download | libdom-0e51c3a8ca92d6b98339c5910de51ddc79da54bd.tar.gz libdom-0e51c3a8ca92d6b98339c5910de51ddc79da54bd.tar.bz2 |
HTMLDocument: Make lists retrieved by tag name be caseless
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/html_document.c | 42 | ||||
-rw-r--r-- | src/html/html_document.h | 9 |
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, \ |