Debian Codegraph @

libgdome/gdomecore/gdome-xml-util.h

raw
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
2 /* gdome-xml-util.h
3 *
4 * Copyright (C) 1999 Raph Levien <[email protected]>
5 * Copyright (C) 2000 Mathieu Lacage <[email protected]>
6 * Copyright (C) 2001 Paolo Casarini <[email protected]>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 #ifndef GDOME_XMLUTIL_FILE
24 #define GDOME_XMLUTIL_FILE
25
26 #include <libxml/tree.h>
27 #include "gdome.h"
28 #include "gdome-xml-node.h"
29
30 #define GDOME_XML_IS_N(node) (\
31 ((Gdome_xml_Node *) node)->n->type == XML_ELEMENT_NODE || \
32 ((Gdome_xml_Node *) node)->n->type == XML_TEXT_NODE || \
33 ((Gdome_xml_Node *) node)->n->type == XML_CDATA_SECTION_NODE || \
34 ((Gdome_xml_Node *) node)->n->type == XML_ENTITY_REF_NODE || \
35 ((Gdome_xml_Node *) node)->n->type == XML_ENTITY_NODE || \
36 ((Gdome_xml_Node *) node)->n->type == XML_PI_NODE || \
37 ((Gdome_xml_Node *) node)->n->type == XML_COMMENT_NODE || \
38 ((Gdome_xml_Node *) node)->n->type == XML_ATTRIBUTE_NODE || \
39 ((Gdome_xml_Node *) node)->n->type == XML_NOTATION_NODE || \
40 ((Gdome_xml_Node *) node)->n->type == XML_DOCUMENT_TYPE_NODE || \
41 ((Gdome_xml_Node *) node)->n->type == XML_DOCUMENT_FRAG_NODE || \
42 ((Gdome_xml_Node *) node)->n->type == XML_DTD_NODE || \
43 ((Gdome_xml_Node *) node)->n->type == XML_DOCUMENT_NODE || \
44 ((Gdome_xml_Node *) node)->n->type == XML_ENTITY_DECL || \
45 ((Gdome_xml_Node *) node)->n->type == XML_HTML_DOCUMENT_NODE || \
46 ((Gdome_xml_Node *) node)->n->type == XML_NAMESPACE_DECL )
47
48 #define GDOME_XML_IS_TREE_N(node) (\
49 ((Gdome_xml_Node *) node)->n->type == XML_ELEMENT_NODE || \
50 ((Gdome_xml_Node *) node)->n->type == XML_TEXT_NODE || \
51 ((Gdome_xml_Node *) node)->n->type == XML_CDATA_SECTION_NODE || \
52 ((Gdome_xml_Node *) node)->n->type == XML_ENTITY_REF_NODE || \
53 ((Gdome_xml_Node *) node)->n->type == XML_PI_NODE || \
54 ((Gdome_xml_Node *) node)->n->type == XML_COMMENT_NODE || \
55 ((Gdome_xml_Node *) node)->n->type == XML_DOCUMENT_TYPE_NODE || \
56 ((Gdome_xml_Node *) node)->n->type == XML_DTD_NODE )
57
58 #define GDOME_XML_IS_LEAF_N(node) (\
59 ((Gdome_xml_Node *) node)->n->type == XML_NOTATION_NODE || \
60 ((Gdome_xml_Node *) node)->n->type == XML_TEXT_NODE || \
61 ((Gdome_xml_Node *) node)->n->type == XML_CDATA_SECTION_NODE || \
62 ((Gdome_xml_Node *) node)->n->type == XML_PI_NODE || \
63 ((Gdome_xml_Node *) node)->n->type == XML_COMMENT_NODE || \
64 ((Gdome_xml_Node *) node)->n->type == XML_DOCUMENT_TYPE_NODE || \
65 ((Gdome_xml_Node *) node)->n->type == XML_DTD_NODE )
66
67 #define GDOME_XML_IS_DOC(node) (\
68 ((Gdome_xml_Node *) node)->n->type == XML_DOCUMENT_NODE || \
69 ((Gdome_xml_Node *) node)->n->type == XML_HTML_DOCUMENT_NODE )
70
71 #define GDOME_XML_IS_CD(cd) (\
72 ((Gdome_xml_Node *) cd)->n->type == XML_CDATA_SECTION_NODE || \
73 ((Gdome_xml_Node *) cd)->n->type == XML_TEXT_NODE || \
74 ((Gdome_xml_Node *) cd)->n->type == XML_COMMENT_NODE )
75
76 #define GDOME_XML_IS_CDS(cds) (\
77 ((Gdome_xml_Node *) cds)->n->type == XML_CDATA_SECTION_NODE )
78
79 #define GDOME_XML_IS_C(c) (\
80 ((Gdome_xml_Node *) c)->n->type == XML_COMMENT_NODE )
81
82 #define GDOME_XML_IS_T(t) (\
83 ((Gdome_xml_Node *) t)->n->type == XML_CDATA_SECTION_NODE || \
84 ((Gdome_xml_Node *) t)->n->type == XML_TEXT_NODE )
85
86 #define GDOME_XML_IS_EL(el) (\
87 ((Gdome_xml_Node *) el)->n->type == XML_ELEMENT_NODE )
88
89 #define GDOME_XML_IS_NOT(not) (\
90 ((Gdome_xml_Node *) not)->n->type == XML_NOTATION_NODE )
91
92 #define GDOME_XML_IS_A(a) (\
93 ((Gdome_xml_Node *) a)->n->type == XML_ATTRIBUTE_NODE )
94
95 #define GDOME_XML_IS_DF(df) (\
96 ((Gdome_xml_Node *) df)->n->type == XML_DOCUMENT_FRAG_NODE )
97
98 #define GDOME_XML_IS_NL(cd) 1
99
100 #define GDOME_XML_IS_ENT(ent) (\
101 ((Gdome_xml_Node *) ent)->n->type == XML_ENTITY_NODE || \
102 ((Gdome_xml_Node *) ent)->n->type == XML_ENTITY_DECL )
103
104 #define GDOME_XML_IS_ER(er) (\
105 ((Gdome_xml_Node *) er)->n->type == XML_ENTITY_REF_NODE )
106
107 #define GDOME_XML_IS_PI(pi) (\
108 ((Gdome_xml_Node *) pi)->n->type == XML_PI_NODE )
109
110 #define GDOME_XML_IS_DT(dt) (\
111 ((Gdome_xml_Node *) dt)->n->type == XML_DTD_NODE || \
112 ((Gdome_xml_Node *) dt)->n->type == XML_DOCUMENT_TYPE_NODE )
113
114 #define GDOME_XML_IS_NS(ns) (\
115 ((Gdome_xml_Node *) ns)->n->type == XML_NAMESPACE_DECL )
116
117 /* Utility Macro */
118 #define GDOME_ISREADONLY(node) ((Gdome_xml_Node *)node)->accessType == GDOME_READONLY_NODE
119
120 #endif /* GDOME_XMLUTIL_FILE */