libdom
Loading...
Searching...
No Matches
namednodemap.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <dom/core/element.h>
#include <dom/core/node.h>
#include <dom/core/string.h>
#include "core/document.h"
#include "core/element.h"
#include "core/namednodemap.h"
#include "core/node.h"
#include "utils/utils.h"

Classes

struct  dom_namednodemap
 

Functions

dom_exception _dom_namednodemap_create (dom_document *doc, void *priv, struct nnm_operation *opt, dom_namednodemap **map)
 
void dom_namednodemap_ref (dom_namednodemap *map)
 
void dom_namednodemap_unref (dom_namednodemap *map)
 
dom_exception dom_namednodemap_get_length (dom_namednodemap *map, dom_ulong *length)
 
dom_exception _dom_namednodemap_get_named_item (dom_namednodemap *map, dom_string *name, dom_node **node)
 
dom_exception _dom_namednodemap_set_named_item (dom_namednodemap *map, dom_node *arg, dom_node **node)
 
dom_exception _dom_namednodemap_remove_named_item (dom_namednodemap *map, dom_string *name, dom_node **node)
 
dom_exception _dom_namednodemap_item (dom_namednodemap *map, dom_ulong index, dom_node **node)
 
dom_exception _dom_namednodemap_get_named_item_ns (dom_namednodemap *map, dom_string *namespace, dom_string *localname, dom_node **node)
 
dom_exception _dom_namednodemap_set_named_item_ns (dom_namednodemap *map, dom_node *arg, dom_node **node)
 
dom_exception _dom_namednodemap_remove_named_item_ns (dom_namednodemap *map, dom_string *namespace, dom_string *localname, dom_node **node)
 
bool _dom_namednodemap_equal (dom_namednodemap *m1, dom_namednodemap *m2)
 
void _dom_namednodemap_update (dom_namednodemap *map, void *priv)
 

Function Documentation

◆ _dom_namednodemap_create()

dom_exception _dom_namednodemap_create ( dom_document * doc,
void * priv,
struct nnm_operation * opt,
dom_namednodemap ** map )

Create a namednodemap

Parameters
docThe owning document
privThe private data of this dom_namednodemap
optThe operation function pointer
mapPointer to location to receive created map
Returns
DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion

::head must be a node owned by ::doc and must be either an Element or DocumentType node.

If ::head is of type Element, ::type must be DOM_ATTRIBUTE_NODE If ::head is of type DocumentType, ::type may be either DOM_ENTITY_NODE or DOM_NOTATION_NODE.

The returned map will already be referenced, so the client need not explicitly reference it. The client must unref the map once it is finished with it.

◆ _dom_namednodemap_equal()

bool _dom_namednodemap_equal ( dom_namednodemap * m1,
dom_namednodemap * m2 )

Compare whether two NamedNodeMap are equal.

◆ _dom_namednodemap_get_named_item()

dom_exception _dom_namednodemap_get_named_item ( dom_namednodemap * map,
dom_string * name,
dom_node ** node )

Retrieve an item by name from a named node map

Parameters
mapThe map to retrieve the item from
nameThe name of the item to retrieve
nodePointer to location to receive item
Returns
DOM_NO_ERR.

The returned node will have had its reference count increased. The client should unref the node once it has finished with it.

◆ _dom_namednodemap_get_named_item_ns()

dom_exception _dom_namednodemap_get_named_item_ns ( dom_namednodemap * map,
dom_string * namespace,
dom_string * localname,
dom_node ** node )

Retrieve an item by namespace/localname from a named node map

Parameters
mapThe map to retrieve the item from
namespaceThe namespace URI of the item to retrieve
localnameThe local name of the node to retrieve
nodePointer to location to receive item
Returns
DOM_NO_ERR on success, DOM_NOT_SUPPORTED_ERR if the implementation does not support the feature "XML" and the language exposed through the Document does not support Namespaces.

The returned node will have had its reference count increased. The client should unref the node once it has finished with it.

◆ _dom_namednodemap_item()

dom_exception _dom_namednodemap_item ( dom_namednodemap * map,
dom_ulong index,
dom_node ** node )

Retrieve an item from a named node map

Parameters
mapThe map to retrieve the item from
indexThe map index to retrieve
nodePointer to location to receive item
Returns
DOM_NO_ERR.

::index is a zero-based index into ::map. ::index lies in the range [0, length-1]

The returned node will have had its reference count increased. The client should unref the node once it has finished with it.

◆ _dom_namednodemap_remove_named_item()

dom_exception _dom_namednodemap_remove_named_item ( dom_namednodemap * map,
dom_string * name,
dom_node ** node )

Remove an item by name from a named node map

Parameters
mapThe map to remove from
nameThe name of the item to remove
nodePointer to location to receive removed item
Returns
DOM_NO_ERR on success, DOM_NOT_FOUND_ERR if there is no node named ::name in ::map, DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly.

The returned node will have had its reference count increased. The client should unref the node once it has finished with it.

◆ _dom_namednodemap_remove_named_item_ns()

dom_exception _dom_namednodemap_remove_named_item_ns ( dom_namednodemap * map,
dom_string * namespace,
dom_string * localname,
dom_node ** node )

Remove an item by namespace/localname from a named node map

Parameters
mapThe map to remove from
namespaceThe namespace URI of the item to remove
localnameThe local name of the item to remove
nodePointer to location to receive removed item
Returns
DOM_NO_ERR on success, DOM_NOT_FOUND_ERR if there is no node named ::name in ::map, DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly. DOM_NOT_SUPPORTED_ERR if the implementation does not support the feature "XML" and the language exposed through the Document does not support Namespaces.

The returned node will have had its reference count increased. The client should unref the node once it has finished with it.

◆ _dom_namednodemap_set_named_item()

dom_exception _dom_namednodemap_set_named_item ( dom_namednodemap * map,
dom_node * arg,
dom_node ** node )

Add a node to a named node map, replacing any matching existing node

Parameters
mapThe map to add to
argThe node to add
nodePointer to location to receive replaced node
Returns
DOM_NO_ERR on success, DOM_WRONG_DOCUMENT_ERR if ::arg was created from a different document than ::map, DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly, DOM_INUSE_ATTRIBUTE_ERR if ::arg is an Attr that is already an attribute on another Element, DOM_HIERARCHY_REQUEST_ERR if the type of ::arg is not permitted as a member of ::map.

::arg's nodeName attribute will be used to store it in ::map. It will be accessible using the nodeName attribute as the key for lookup.

Replacing a node by itself has no effect.

The returned node will have had its reference count increased. The client should unref the node once it has finished with it.

◆ _dom_namednodemap_set_named_item_ns()

dom_exception _dom_namednodemap_set_named_item_ns ( dom_namednodemap * map,
dom_node * arg,
dom_node ** node )

Add a node to a named node map, replacing any matching existing node

Parameters
mapThe map to add to
argThe node to add
nodePointer to location to receive replaced node
Returns
DOM_NO_ERR on success, DOM_WRONG_DOCUMENT_ERR if ::arg was created from a different document than ::map, DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly, DOM_INUSE_ATTRIBUTE_ERR if ::arg is an Attr that is already an attribute on another Element, DOM_HIERARCHY_REQUEST_ERR if the type of ::arg is not permitted as a member of ::map. DOM_NOT_SUPPORTED_ERR if the implementation does not support the feature "XML" and the language exposed through the Document does not support Namespaces.

::arg's namespaceURI and localName attributes will be used to store it in ::map. It will be accessible using the namespaceURI and localName attributes as the keys for lookup.

Replacing a node by itself has no effect.

The returned node will have had its reference count increased. The client should unref the node once it has finished with it.

◆ _dom_namednodemap_update()

void _dom_namednodemap_update ( dom_namednodemap * map,
void * priv )

Update the dom_namednodemap to make it as a proxy of another object

Parameters
mapThe dom_namednodemap
privThe private data to change to

◆ dom_namednodemap_get_length()

dom_exception dom_namednodemap_get_length ( dom_namednodemap * map,
dom_ulong * length )

Retrieve the length of a named node map

Parameters
mapMap to retrieve length of
lengthPointer to location to receive length
Returns
DOM_NO_ERR.

◆ dom_namednodemap_ref()

void dom_namednodemap_ref ( dom_namednodemap * map)

Claim a reference on a DOM named node map

Parameters
mapThe map to claim a reference on

◆ dom_namednodemap_unref()

void dom_namednodemap_unref ( dom_namednodemap * map)

Release a reference on a DOM named node map

Parameters
mapThe map to release the reference from

If the reference count reaches zero, any memory claimed by the map will be released