DomNode.h Source File

Main Page Modules Namespace List Data Structures File List Data Fields Examples

# DomNode.h

    00001 /*
    00002  * libsgml -- SGML state machine parsing library.
    00003  *
    00004  * Copyright (c) 2002 Uninformed Research (http://www.uninformed.org)
    00005  * All rights reserved.
    00006  *
    00007  * skape
    00008  * mmiller@hick.org
    00009  */
    00018 #ifndef _LIBSGML_DOMNODE_H
    00019 #define _LIBSGML_DOMNODE_H
    00020
    00021 #include "Variant.h"
    00022
    00023 #ifdef __cplusplus
    00024 extern "C" {
    00025 #endif
    00026
    00027 #include <stdio.h>
    00028
    00029 #define DOM_NDOE_TYPE_INVALID   0x0000
    00030 #define DOM_NODE_TYPE_DOCUMENT  0x0001
    00031 #define DOM_NODE_TYPE_ELEMENT   0x0002
    00032 #define DOM_NODE_TYPE_ATTRIBUTE 0x0003
    00033 #define DOM_NODE_TYPE_TEXT      0x0004
    00034 #define DOM_NODE_TYPE_COMMENT   0x0005
    00035
    00036 struct _dom_node_list;
    00037
    00041 typedef struct _dom_node {
    00042
    00059         unsigned long    type;
    00060
    00064         char             *name;
    00068         char             *value;
    00069
    00073         struct _dom_node *attributes;
    00074
    00078         struct _dom_node *parent;
    00079
    00083         struct _dom_node *firstChild;
    00087         struct _dom_node *lastChild;
    00088
    00092         struct _dom_node *prevSibling;
    00096         struct _dom_node *nextSibling;
    00097
    00101         unsigned char    autoclose;
    00105         unsigned char    deferredClosure;
    00109         unsigned char    escapeTags;
    00110
    00111 } DOM_NODE;
    00112
    00136 DOM_NODE *domNodeNew(unsigned long type, const char *name, const char *value);
    00142 void domNodeDestroySpecific(DOM_NODE *node);
    00148 void domNodeDestroy(DOM_NODE *node);
    00149
    00156 void domNodeAppendChild(DOM_NODE *parent, DOM_NODE *child);
    00163 void domNodeAppendSibling(DOM_NODE *node, DOM_NODE *sibling);
    00170 void domNodeRemoveChild(DOM_NODE *parent, DOM_NODE *child);
    00171
    00178 DOM_NODE *domNodeGetFirstChild(DOM_NODE *node);
    00185 DOM_NODE *domNodeGetPreviousSibling(DOM_NODE *node);
    00192 DOM_NODE *domNodeGetNextSibling(DOM_NODE *node);
    00193
    00200 void domNodeSetName(DOM_NODE *node, const char *name);
    00207 const char *domNodeGetName(DOM_NODE *node);
    00208
    00215 void domNodeSetValue(DOM_NODE *node, const char *value);
    00216
    00225 void domNodeSetValueVariant(DOM_NODE *node, enum VariantType type, void *value, unsigned long valueSize);
    00234 const char *domNodeGetValue(DOM_NODE *node);
    00244 void *domNodeGetValueVariant(DOM_NODE *node, enum VariantType type);
    00245
    00253 DOM_NODE *domNodeFindNodeByName(DOM_NODE *node, const char *name);
    00261 struct _dom_node_list *domNodeFindNodesByName(DOM_NODE *node, const char *name);
    00262 void domNodeFindNodesByName_r(struct _dom_node_list *nodeList, DOM_NODE *node, const char *name);
    00263
    00270 void domNodeSerializeToFile(DOM_NODE *node, const char *fileName);
    00277 void domNodeSerializeToFd(DOM_NODE *node, FILE *fd);
    00285 unsigned long domNodeSerializeToString(DOM_NODE *node, char **string);
    00286
    00287 void domNodeSerializeToString_r(DOM_NODE *node, char **string, unsigned long *stringLength);
    00288
    00293 #ifdef __cplusplus
    00294 }
    00295 #endif
    00296
    00297 #endif