libdom
|
#include <assert.h>
#include <stdlib.h>
#include <dom/functypes.h>
#include <dom/core/attr.h>
#include <dom/core/element.h>
#include <dom/core/document.h>
#include <dom/core/implementation.h>
#include "core/string.h"
#include "core/attr.h"
#include "core/cdatasection.h"
#include "core/comment.h"
#include "core/document.h"
#include "core/doc_fragment.h"
#include "core/element.h"
#include "core/entity_ref.h"
#include "core/namednodemap.h"
#include "core/nodelist.h"
#include "core/pi.h"
#include "core/text.h"
#include "utils/validate.h"
#include "utils/namespace.h"
#include "utils/utils.h"
Classes | |
struct | dom_doc_nl |
dom_exception _dom_document_adopt_node | ( | dom_document * | doc, |
dom_node * | node, | ||
dom_node ** | result ) |
Attempt to adopt a node from another document into this document
doc | The document to adopt into |
node | The node to adopt |
result | Pointer to location to receive adopted node |
node
is readonly, DOM_NOT_SUPPORTED_ERR if node
is of type Document or DocumentTypeThe 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_document_copy | ( | dom_node_internal * | old, |
dom_node_internal ** | copy ) |
dom_exception _dom_document_create | ( | dom_events_default_action_fetcher | daf, |
void * | daf_ctx, | ||
dom_document ** | doc ) |
Create a Document
doc | Pointer to location to receive created document |
daf | The default action fetcher |
The returned document will already be referenced.
dom_exception _dom_document_create_attribute | ( | dom_document * | doc, |
dom_string * | name, | ||
dom_attr ** | result ) |
Create an attribute
doc | The document owning the attribute |
name | The name of the attribute |
result | Pointer to location to receive result |
name
is invalid.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_document_create_attribute_ns | ( | dom_document * | doc, |
dom_string * | namespace, | ||
dom_string * | qname, | ||
dom_attr ** | result ) |
Create an attribute from the qualified name and namespace URI
doc | The document owning the attribute |
namespace | The namespace URI to use |
qname | The qualified name of the attribute |
result | Pointer to location to receive result |
qname
is invalid, 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_document_create_cdata_section | ( | dom_document * | doc, |
dom_string * | data, | ||
dom_cdata_section ** | result ) |
Create a CDATA section
doc | The document owning the section |
data | The data for the section contents |
result | Pointer to location to receive result |
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_document_create_comment | ( | dom_document * | doc, |
dom_string * | data, | ||
dom_comment ** | result ) |
Create a comment node
doc | The document owning the node |
data | The data for the node |
result | Pointer to location to receive result |
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_document_create_document_fragment | ( | dom_document * | doc, |
dom_document_fragment ** | result ) |
Create a document fragment
doc | The document owning the fragment |
result | Pointer to location to receive result |
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_document_create_element | ( | dom_document * | doc, |
dom_string * | tag_name, | ||
dom_element ** | result ) |
Create an element
doc | The document owning the element |
tag_name | The name of the element |
result | Pointer to location to receive result |
tag_name
is invalid.doc
and tag_name
will have their reference counts increased.
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_document_create_element_ns | ( | dom_document * | doc, |
dom_string * | namespace, | ||
dom_string * | qname, | ||
dom_element ** | result ) |
Create an element from the qualified name and namespace URI
doc | The document owning the element |
namespace | The namespace URI to use, or NULL for none |
qname | The qualified name of the element |
result | Pointer to location to receive result |
qname
is invalid, 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_document_create_entity_reference | ( | dom_document * | doc, |
dom_string * | name, | ||
dom_entity_reference ** | result ) |
Create an entity reference
doc | The document owning the reference |
name | The name of the entity to reference |
result | Pointer to location to receive result |
name
is invalid, DOM_NOT_SUPPORTED_ERR if this is an HTML document.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_document_create_processing_instruction | ( | dom_document * | doc, |
dom_string * | target, | ||
dom_string * | data, | ||
dom_processing_instruction ** | result ) |
Create a processing instruction
doc | The document owning the instruction |
target | The instruction target |
data | The data for the node |
result | Pointer to location to receive result |
target
is invalid, DOM_NOT_SUPPORTED_ERR if this is an HTML document.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_document_create_text_node | ( | dom_document * | doc, |
dom_string * | data, | ||
dom_text ** | result ) |
Create a text node
doc | The document owning the node |
data | The data for the node |
result | Pointer to location to receive result |
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.
void _dom_document_destroy | ( | dom_node_internal * | node | ) |
bool _dom_document_finalise | ( | dom_document * | doc | ) |
dom_exception _dom_document_get_doctype | ( | dom_document * | doc, |
dom_document_type ** | result ) |
Retrieve the doctype of a document
doc | The document to retrieve the doctype from |
result | Pointer to location to receive result |
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_document_get_document_element | ( | dom_document * | doc, |
dom_element ** | result ) |
Retrieve the document element of a document
doc | The document to retrieve the document element from |
result | Pointer to location to receive result |
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_document_get_dom_config | ( | dom_document * | doc, |
struct dom_configuration ** | result ) |
Retrieve the DOM configuration associated with a document
doc | The document to query |
result | Pointer to location to receive result |
The returned object will have its reference count increased. It is the responsibility of the caller to unref the object once it has finished with it.
dom_exception _dom_document_get_element_by_id | ( | dom_document * | doc, |
dom_string * | id, | ||
dom_element ** | result ) |
Retrieve the element that matches the specified ID
doc | The document to search in |
id | The ID to search for |
result | Pointer to location to receive result |
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_document_get_elements_by_tag_name | ( | dom_document * | doc, |
dom_string * | tagname, | ||
dom_nodelist ** | result ) |
Retrieve a list of all elements with a given tag name
doc | The document to search in |
tagname | The tag name to search for ("*" for all) |
result | Pointer to location to receive result |
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_document_get_elements_by_tag_name_ns | ( | dom_document * | doc, |
dom_string * | namespace, | ||
dom_string * | localname, | ||
dom_nodelist ** | result ) |
Retrieve a list of all elements with a given local name and namespace URI
doc | The document to search in |
namespace | The namespace URI |
localname | The local name |
result | Pointer to location to receive result |
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_document_get_implementation | ( | dom_document * | doc, |
dom_implementation ** | result ) |
Retrieve the DOM implementation that handles this document
doc | The document to retrieve the implementation from |
result | Pointer to location to receive result |
The returned implementation will have its reference count increased. It is the responsibility of the caller to unref the implementation once it has finished with it.
dom_exception _dom_document_get_input_encoding | ( | dom_document * | doc, |
dom_string ** | result ) |
Retrieve the input encoding of the document
doc | The document to query |
result | Pointer to location to receive result |
The returned string will have its reference count increased. It is the responsibility of the caller to unref the string once it has finished with it.
dom_exception _dom_document_get_nodelist | ( | dom_document * | doc, |
nodelist_type | type, | ||
dom_node_internal * | root, | ||
dom_string * | tagname, | ||
dom_string * | namespace, | ||
dom_string * | localname, | ||
dom_nodelist ** | list ) |
Get a nodelist, creating one if necessary
doc | The document to get a nodelist for |
type | The type of the NodeList |
root | Root node of subtree that list applies to |
tagname | Name of nodes in list (or NULL) |
namespace | Namespace part of nodes in list (or NULL) |
localname | Local part of nodes in list (or NULL) |
list | Pointer to location to receive list |
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_document_get_quirks_mode | ( | dom_document * | doc, |
dom_document_quirks_mode * | result ) |
dom_exception _dom_document_get_strict_error_checking | ( | dom_document * | doc, |
bool * | result ) |
Retrieve the error checking mode of the document
doc | The document to query |
result | Pointer to location to receive result |
dom_exception _dom_document_get_text_content | ( | dom_node_internal * | node, |
dom_string ** | result ) |
dom_exception _dom_document_get_uri | ( | dom_document * | doc, |
dom_string ** | result ) |
Retrieve the URI of the document
doc | The document to query |
result | Pointer to location to receive result |
The returned string will have its reference count increased. It is the responsibility of the caller to unref the string once it has finished with it.
dom_exception _dom_document_get_xml_encoding | ( | dom_document * | doc, |
dom_string ** | result ) |
Retrieve the XML encoding of the document
doc | The document to query |
result | Pointer to location to receive result |
The returned string will have its reference count increased. It is the responsibility of the caller to unref the string once it has finished with it.
dom_exception _dom_document_get_xml_standalone | ( | dom_document * | doc, |
bool * | result ) |
Retrieve the standalone status of the document
doc | The document to query |
result | Pointer to location to receive result |
dom_exception _dom_document_get_xml_version | ( | dom_document * | doc, |
dom_string ** | result ) |
Retrieve the XML version of the document
doc | The document to query |
result | Pointer to location to receive result |
The returned string will have its reference count increased. It is the responsibility of the caller to unref the string once it has finished with it.
We don't support this API now, so the return value is always DOM_NOT_SUPPORTED_ERR.
dom_exception _dom_document_import_node | ( | dom_document * | doc, |
dom_node * | node, | ||
bool | deep, | ||
dom_node ** | result ) |
Import a node from another document into this one
doc | The document to import into |
node | The node to import |
deep | Whether to copy the node's subtree |
result | Pointer to location to receive imported node in this document. |
node
is unsupportedThe 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_document_initialise | ( | dom_document * | doc, |
dom_events_default_action_fetcher | daf, | ||
void * | daf_ctx ) |
dom_exception _dom_document_normalize | ( | dom_document * | doc | ) |
Normalize a document
doc | The document to normalize |
void _dom_document_remove_nodelist | ( | dom_document * | doc, |
dom_nodelist * | list ) |
Remove a nodelist from a document
doc | The document to remove the list from |
list | The list to remove |
dom_exception _dom_document_rename_node | ( | dom_document * | doc, |
dom_node * | node, | ||
dom_string * | namespace, | ||
dom_string * | qname, | ||
dom_node ** | result ) |
Rename a node in a document
doc | The document containing the node |
node | The node to rename |
namespace | The new namespace for the node |
qname | The new qualified name for the node |
result | Pointer to location to receive renamed node |
tag_name
is invalid, DOM_WRONG_DOCUMENT_ERR if node
was created in a different document 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.
We don't support this API now, so the return value is always DOM_NOT_SUPPORTED_ERR.
void _dom_document_set_id_name | ( | dom_document * | doc, |
dom_string * | name ) |
Set the ID attribute name of this document
doc | The document object |
name | The ID name of the elements in this document |
dom_exception _dom_document_set_quirks_mode | ( | dom_document * | doc, |
dom_document_quirks_mode | quirks ) |
dom_exception _dom_document_set_strict_error_checking | ( | dom_document * | doc, |
bool | strict ) |
Set the error checking mode of the document
doc | The document to query |
strict | Whether to use strict error checking |
dom_exception _dom_document_set_text_content | ( | dom_node_internal * | node, |
dom_string * | content ) |
dom_exception _dom_document_set_uri | ( | dom_document * | doc, |
dom_string * | uri ) |
Set the URI of the document
doc | The document to query |
uri | The URI to use |
The returned string will have its reference count increased. It is the responsibility of the caller to unref the string once it has finished with it.
dom_exception _dom_document_set_xml_standalone | ( | dom_document * | doc, |
bool | standalone ) |
Set the standalone status of the document
doc | The document to query |
standalone | Standalone status to use |
We don't support this API now, so the return value is always DOM_NOT_SUPPORTED_ERR.
dom_exception _dom_document_set_xml_version | ( | dom_document * | doc, |
dom_string * | version ) |
Set the XML version of the document
doc | The document to query |
version | XML version to use |
We don't support this API now, so the return value is always DOM_NOT_SUPPORTED_ERR.
void _dom_document_try_destroy | ( | dom_document * | doc | ) |
Try to destroy the document.
doc | The instance of Document |
Delete the document if:
else, do nothing.
dom_exception _dom_find_element_by_id | ( | dom_node_internal * | root, |
dom_string * | id, | ||
dom_element ** | result ) |
Find element with certain ID in the subtree rooted at root
root | The root element from where we start |
id | The ID of the target element |
result | The result element |