libdom
|
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libwapcaplet/libwapcaplet.h>
#include <dom/dom.h>
#include <dom/core/attr.h>
#include <dom/core/element.h>
#include <dom/core/node.h>
#include <dom/core/string.h>
#include <dom/core/document.h>
#include <dom/events/events.h>
#include "core/attr.h"
#include "core/document.h"
#include "core/element.h"
#include "core/node.h"
#include "core/namednodemap.h"
#include "utils/validate.h"
#include "utils/namespace.h"
#include "utils/utils.h"
#include "utils/list.h"
#include "events/mutation_event.h"
Classes | |
struct | dom_attr_list |
Typedefs | |
typedef struct dom_attr_list | dom_attr_list |
Variables | |
const struct dom_element_vtable | _dom_element_vtable |
typedef struct dom_attr_list dom_attr_list |
void __dom_element_destroy | ( | struct dom_node_internal * | node | ) |
dom_exception _dom_element_copy | ( | dom_node_internal * | old, |
dom_node_internal ** | copy ) |
dom_exception _dom_element_copy_internal | ( | dom_element * | old, |
dom_element * | new ) |
dom_exception _dom_element_create | ( | struct dom_document * | doc, |
dom_string * | name, | ||
dom_string * | namespace, | ||
dom_string * | prefix, | ||
struct dom_element ** | result ) |
Create an element node
doc | The owning document |
name | The (local) name of the node to create |
namespace | The namespace URI of the element, or NULL |
prefix | The namespace prefix of the element, or NULL |
result | Pointer to location to receive created element |
::doc, ::name, ::namespace and ::prefix will have their reference counts increased.
The returned element will already be referenced.
void _dom_element_destroy | ( | struct dom_element * | element | ) |
Destroy an element
element | The element to destroy |
The contents of ::element will be destroyed and ::element will be freed.
void _dom_element_finalise | ( | struct dom_element * | ele | ) |
dom_exception _dom_element_get_attribute | ( | struct dom_element * | element, |
dom_string * | name, | ||
dom_string ** | value ) |
Retrieve an attribute from an element by name
element | The element to retrieve attribute from |
name | The attribute's name |
value | Pointer to location to receive attribute's value |
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_element_get_attribute_node | ( | struct dom_element * | element, |
dom_string * | name, | ||
struct dom_attr ** | result ) |
Retrieve an attribute node from an element by name
element | The element to retrieve attribute node from |
name | The attribute's name |
result | Pointer to location to receive attribute node |
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_element_get_attribute_node_ns | ( | struct dom_element * | element, |
dom_string * | namespace, | ||
dom_string * | localname, | ||
struct dom_attr ** | result ) |
Retrieve an attribute node from an element by namespace/localname
element | The element to retrieve attribute from |
namespace | The attribute's namespace URI |
localname | The attribute's local name |
result | Pointer to location to receive attribute node |
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_element_get_attribute_ns | ( | struct dom_element * | element, |
dom_string * | namespace, | ||
dom_string * | localname, | ||
dom_string ** | value ) |
Retrieve an attribute from an element by namespace/localname
element | The element to retrieve attribute from |
namespace | The attribute's namespace URI, or NULL |
localname | The attribute's local name |
value | Pointer to location to receive attribute's value |
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_element_get_attributes | ( | dom_node_internal * | node, |
struct dom_namednodemap ** | result ) |
dom_exception _dom_element_get_classes | ( | struct dom_element * | element, |
lwc_string *** | classes, | ||
uint32_t * | n_classes ) |
Obtain a pre-parsed array of class names for an element
element | Element containing classes |
classes | Pointer to location to receive libdom-owned array |
n_classes | Pointer to location to receive number of classes |
dom_exception _dom_element_get_elements_by_tag_name | ( | struct dom_element * | element, |
dom_string * | name, | ||
struct dom_nodelist ** | result ) |
Retrieve a list of descendant elements of an element which match a given tag name
element | The root of the subtree to search |
name | The tag name to match (or "*" for all tags) |
result | Pointer to location to receive result |
The returned nodelist will have its reference count increased. It is the responsibility of the caller to unref the nodelist once it has finished with it.
dom_exception _dom_element_get_elements_by_tag_name_ns | ( | struct dom_element * | element, |
dom_string * | namespace, | ||
dom_string * | localname, | ||
struct dom_nodelist ** | result ) |
Retrieve a list of descendant elements of an element which match a given namespace/localname pair.
element | The root of the subtree to search |
namespace | The namespace URI to match (or "*" for all) |
localname | The local name to match (or "*" for all) |
result | Pointer to location to receive result |
The returned nodelist will have its reference count increased. It is the responsibility of the caller to unref the nodelist once it has finished with it.
dom_exception _dom_element_get_id | ( | struct dom_element * | ele, |
dom_string ** | id ) |
Get the ID string of the element
ele | The element |
id | The ID of this element |
dom_exception _dom_element_get_schema_type_info | ( | struct dom_element * | element, |
struct dom_type_info ** | result ) |
Retrieve the type information associated with an element
element | The element to retrieve type information from |
result | Pointer to location to receive type information |
The returned typeinfo will have its reference count increased. It is the responsibility of the caller to unref the typeinfo once it has finished with it.
dom_exception _dom_element_get_tag_name | ( | struct dom_element * | element, |
dom_string ** | name ) |
Retrieve an element's tag name
element | The element to retrieve the name from |
name | Pointer to location to receive name |
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_element_has_attribute | ( | struct dom_element * | element, |
dom_string * | name, | ||
bool * | result ) |
Determine if an element possesses and attribute with the given name
element | The element to query |
name | The attribute name to look for |
result | Pointer to location to receive result |
dom_exception _dom_element_has_attribute_ns | ( | struct dom_element * | element, |
dom_string * | namespace, | ||
dom_string * | localname, | ||
bool * | result ) |
Determine if an element possesses and attribute with the given namespace/localname pair.
element | The element to query |
namespace | The attribute namespace URI to look for |
localname | The attribute local name to look for |
result | Pointer to location to receive result |
dom_exception _dom_element_has_attributes | ( | dom_node_internal * | node, |
bool * | result ) |
dom_exception _dom_element_has_class | ( | struct dom_element * | element, |
lwc_string * | name, | ||
bool * | match ) |
Determine if an element has an associated class
element | Element to consider |
name | Class name to look for |
match | Pointer to location to receive result |
dom_exception _dom_element_initialise | ( | struct dom_document * | doc, |
struct dom_element * | el, | ||
dom_string * | name, | ||
dom_string * | namespace, | ||
dom_string * | prefix ) |
Initialise an element node
doc | The owning document |
el | The element |
name | The (local) name of the node to create |
namespace | The namespace URI of the element, or NULL |
prefix | The namespace prefix of the element, or NULL |
The caller should make sure that ::name is a valid NCName.
::doc, ::name, ::namespace and ::prefix will have their reference counts increased.
The returned element will already be referenced.
dom_exception _dom_element_is_default_namespace | ( | dom_node_internal * | node, |
dom_string * | namespace, | ||
bool * | result ) |
Test whether certain namespace is the default namespace of some node.
node | The Node to test |
namespace | The namespace to test |
result | true is the namespace is default namespace |
dom_exception _dom_element_lookup_namespace | ( | dom_node_internal * | node, |
dom_string * | prefix, | ||
dom_string ** | result ) |
Look up the namespace with certain prefix.
node | The current node in which we search for the prefix |
prefix | The prefix to search |
result | The result namespace if found |
dom_exception _dom_element_lookup_prefix | ( | dom_node_internal * | node, |
dom_string * | namespace, | ||
dom_string ** | result ) |
Look up the prefix which matches the namespace.
node | The current Node in which we search for |
namespace | The namespace for which we search a prefix |
result | The returned prefix |
dom_exception _dom_element_parse_attribute | ( | dom_element * | ele, |
dom_string * | name, | ||
dom_string * | value, | ||
dom_string ** | parsed ) |
The virtual function to parse some dom attribute
ele | The element object |
name | The name of the attribute |
value | The new value of the attribute |
parsed | The parsed value of the attribute |
dom_exception _dom_element_remove_attribute | ( | struct dom_element * | element, |
dom_string * | name ) |
Remove an attribute from an element by name
element | The element to remove attribute from |
name | The name of the attribute to remove |
dom_exception _dom_element_remove_attribute_node | ( | struct dom_element * | element, |
struct dom_attr * | attr, | ||
struct dom_attr ** | result ) |
Remove an attribute node from an element
element | The element to remove attribute node from |
attr | The attribute node to remove |
result | Pointer to location to receive attribute node |
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_element_remove_attribute_ns | ( | struct dom_element * | element, |
dom_string * | namespace, | ||
dom_string * | localname ) |
Remove an attribute from an element by namespace/localname
element | The element to remove attribute from |
namespace | The attribute's namespace URI |
localname | The attribute's local name |
dom_exception _dom_element_set_attribute | ( | struct dom_element * | element, |
dom_string * | name, | ||
dom_string * | value ) |
Set an attribute on an element by name
element | The element to set attribute on |
name | The attribute's name |
value | The attribute's value |
dom_exception _dom_element_set_attribute_node | ( | struct dom_element * | element, |
struct dom_attr * | attr, | ||
struct dom_attr ** | result ) |
Set an attribute node on an element, replacing existing node, if present
element | The element to add a node to |
attr | The attribute node to add |
result | Pointer to location to receive previous node |
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_element_set_attribute_node_ns | ( | struct dom_element * | element, |
struct dom_attr * | attr, | ||
struct dom_attr ** | result ) |
Set an attribute node on an element, replacing existing node, if present
element | The element to add a node to |
attr | The attribute node to add |
result | Pointer to location to recieve previous node |
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_element_set_attribute_ns | ( | struct dom_element * | element, |
dom_string * | namespace, | ||
dom_string * | qname, | ||
dom_string * | value ) |
Set an attribute on an element by namespace/qualified name
element | The element to set attribute on |
namespace | The attribute's namespace URI |
qname | The attribute's qualified name |
value | The attribute's value |
dom_exception _dom_element_set_id_attribute | ( | struct dom_element * | element, |
dom_string * | name, | ||
bool | is_id ) |
(Un)declare an attribute as being an element's ID by name
element | The element containing the attribute |
name | The attribute's name |
is_id | Whether the attribute is an ID |
dom_exception _dom_element_set_id_attribute_node | ( | struct dom_element * | element, |
struct dom_attr * | id_attr, | ||
bool | is_id ) |
(Un)declare an attribute node as being an element's ID
element | The element containing the attribute |
id_attr | The attribute node |
is_id | Whether the attribute is an ID |
dom_exception _dom_element_set_id_attribute_ns | ( | struct dom_element * | element, |
dom_string * | namespace, | ||
dom_string * | localname, | ||
bool | is_id ) |
(Un)declare an attribute as being an element's ID by namespace/localname
element | The element containing the attribute |
namespace | The attribute's namespace URI |
localname | The attribute's local name |
is_id | Whether the attribute is an ID |
dom_exception dom_element_named_ancestor_node | ( | dom_element * | element, |
lwc_string * | name, | ||
dom_element ** | ancestor ) |
Get a named ancestor node
The caller is responsible for unreffing the returned node.
element | Element to consider |
name | Node name to look for |
ancestor | Pointer to location to receive node. |
dom_exception dom_element_named_parent_node | ( | dom_element * | element, |
lwc_string * | name, | ||
dom_element ** | parent ) |
Get a named parent node
The caller is responsible for unreffing the returned node.
element | Element to consider |
name | Node name to look for |
parent | Pointer to location to receive node pointer |
dom_exception dom_element_parent_node | ( | dom_element * | element, |
dom_element ** | parent ) |
Get a named parent node
The caller is responsible for unreffing the returned node.
element | Element to consider |
name | Node name to look for |
parent | Pointer to location to receive node pointer |
const struct dom_element_vtable _dom_element_vtable |