From 7f29141f5069d02843468785a54543a2f6d9260a Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 6 Jul 2007 14:32:44 +0000 Subject: Import DOM library. This is mainly stub functions atm (and is missing a number of key interfaces). svn path=/trunk/dom/; revision=3384 --- src/core/node.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/core/node.h (limited to 'src/core/node.h') diff --git a/src/core/node.h b/src/core/node.h new file mode 100644 index 0000000..b39ac40 --- /dev/null +++ b/src/core/node.h @@ -0,0 +1,60 @@ +/* + * This file is part of libdom. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 John-Mark Bell + */ + +#ifndef dom_internal_core_node_h_ +#define dom_internal_core_node_h_ + +#include +#include + +struct dom_attr; + +/** + * User data context attached to a DOM node + */ +struct dom_user_data { + struct dom_string *key; /**< Key for data */ + void *data; /**< Client-specific data */ + dom_user_data_handler handler; /**< Callback function */ + + struct dom_user_data *next; /**< Next in list */ + struct dom_user_data *prev; /**< Previous in list */ +}; + +/** + * DOM node object + * + * DOM nodes are reference counted + */ +struct dom_node { + struct dom_string *name; /**< Node name */ + struct dom_string *value; /**< Node value */ + dom_node_type type; /**< Node type */ + struct dom_node *parent; /**< Parent node */ + struct dom_node *first_child; /**< First child node */ + struct dom_node *last_child; /**< Last child node */ + struct dom_node *previous; /**< Previous sibling */ + struct dom_node *next; /**< Next sibling */ + struct dom_attr *attributes; /**< Node attributes */ + + struct dom_document *owner; /**< Owning document */ + + struct dom_string *namespace; /**< Namespace URI */ + struct dom_string *prefix; /**< Namespace prefix */ + struct dom_string *localname; /**< Local part of qualified name */ + + struct dom_user_data *user_data; /**< User data list */ + + uint32_t refcnt; /**< Reference count */ +}; + +dom_exception dom_node_create(struct dom_ctx *ctx, + struct dom_document *doc, dom_node_type type, + struct dom_string *name, struct dom_string *value, + struct dom_node **node); + +#endif -- cgit v1.2.3