Scippy

SCIP

Solving Constraint Integer Programs

xml.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file xml.h
26  * @brief declarations for XML parsing
27  * @author Thorsten Koch
28  * @author Marc Pfetsch
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #ifndef __SCIP_XML_H__
34 #define __SCIP_XML_H__
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
41 typedef struct XML_ATTR_struct XML_ATTR;
42 
43 struct XML_ATTR_struct
44 {
45  char* name;
46  char* value;
47  XML_ATTR* next;
48 };
49 
50 typedef struct XML_NODE_struct XML_NODE;
51 
52 struct XML_NODE_struct
53 {
54  char* name;
55  int lineno;
56  XML_ATTR* attrlist;
57  XML_NODE* parent;
58  XML_NODE* prevsibl;
59  XML_NODE* nextsibl;
60  XML_NODE* firstchild;
61  XML_NODE* lastchild;
62  char* data; /* does not come together with children */
63 };
64 
65 /** Parse file */
66 SCIP_EXPORT
68  const char* filename /**< XML file name */
69  );
70 
71 /** create new node */
72 SCIP_EXPORT
74  const char* name,
75  int lineno
76  );
77 
78 /** create new attribute */
79 SCIP_EXPORT
81  const char* name,
82  const char* value
83  );
84 
85 /** add attribute */
86 SCIP_EXPORT
87 void xmlAddAttr(
88  XML_NODE* n,
89  XML_ATTR* a
90  );
91 
92 /** append child node */
93 SCIP_EXPORT
94 void xmlAppendChild(
95  XML_NODE* parent,
96  XML_NODE* child
97  );
98 
99 /** free node */
100 SCIP_EXPORT
101 void xmlFreeNode(
102  XML_NODE* node
103  );
104 
105 /** output node */
106 SCIP_EXPORT
107 void xmlShowNode(
108  const XML_NODE* root
109  );
110 
111 /** get attribute value */
112 SCIP_EXPORT
113 const char* xmlGetAttrval(
114  const XML_NODE* node,
115  const char* name
116  );
117 
118 /** return first node */
119 SCIP_EXPORT
120 const XML_NODE* xmlFirstNode(
121  const XML_NODE* node,
122  const char* name
123  );
124 
125 /** return next node */
126 SCIP_EXPORT
127 const XML_NODE* xmlNextNode(
128  const XML_NODE* node,
129  const char* name
130  );
131 
132 /** find node */
133 SCIP_EXPORT
134 const XML_NODE* xmlFindNode(
135  const XML_NODE* node,
136  const char* name
137  );
138 
139 /** find node with bound on the depth */
140 SCIP_EXPORT
142  const XML_NODE* node, /**< current node - use start node to begin */
143  const char* name, /**< name of tag to search for */
144  int depth, /**< current depth - start with 0 */
145  int maxdepth /**< maximal depth */
146  );
147 
148 /** return next sibling */
149 SCIP_EXPORT
150 const XML_NODE* xmlNextSibl(
151  const XML_NODE* node
152  );
153 
154 /** return previous sibling */
155 SCIP_EXPORT
156 const XML_NODE* xmlPrevSibl(
157  const XML_NODE* node
158  );
159 
160 /** return first child */
161 SCIP_EXPORT
162 const XML_NODE* xmlFirstChild(
163  const XML_NODE* node
164  );
165 
166 /** return last child */
167 SCIP_EXPORT
168 const XML_NODE* xmlLastChild(
169  const XML_NODE* node
170  );
171 
172 /** return name of node */
173 SCIP_EXPORT
174 const char* xmlGetName(
175  const XML_NODE* node
176  );
177 
178 /** get line number */
179 SCIP_EXPORT
180 int xmlGetLine(
181  const XML_NODE* node
182  );
183 
184 /** get data */
185 SCIP_EXPORT
186 const char* xmlGetData(
187  const XML_NODE* node
188  );
189 
190 /** find PCDATA */
191 SCIP_EXPORT
192 const char* xmlFindPcdata(
193  const XML_NODE* node,
194  const char* name
195  );
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif
const char * xmlFindPcdata(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1519
const XML_NODE * xmlFirstNode(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1362
struct XML_ATTR_struct XML_ATTR
Definition: xml.h:41
XML_NODE * xmlProcess(const char *filename)
Definition: xmlparse.c:1085
const XML_NODE * xmlFirstChild(const XML_NODE *node)
Definition: xmlparse.c:1469
const char * xmlGetData(const XML_NODE *node)
Definition: xmlparse.c:1509
void xmlShowNode(const XML_NODE *root)
Definition: xmlparse.c:1309
struct XML_NODE_struct XML_NODE
Definition: xml.h:50
const XML_NODE * xmlFindNodeMaxdepth(const XML_NODE *node, const char *name, int depth, int maxdepth)
Definition: xmlparse.c:1419
int xmlGetLine(const XML_NODE *node)
Definition: xmlparse.c:1499
const XML_NODE * xmlNextNode(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1382
const XML_NODE * xmlFindNode(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1394
const char * xmlGetName(const XML_NODE *node)
Definition: xmlparse.c:1489
const XML_NODE * xmlLastChild(const XML_NODE *node)
Definition: xmlparse.c:1479
const char * xmlGetAttrval(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1337
SCIP_VAR * a
Definition: circlepacking.c:66
XML_ATTR * xmlNewAttr(const char *name, const char *value)
Definition: xmlparse.c:1195
XML_NODE * xmlNewNode(const char *name, int lineno)
Definition: xmlparse.c:1176
void xmlAddAttr(XML_NODE *n, XML_ATTR *a)
Definition: xmlparse.c:1215
void xmlFreeNode(XML_NODE *node)
Definition: xmlparse.c:1275
const XML_NODE * xmlPrevSibl(const XML_NODE *node)
Definition: xmlparse.c:1459
const XML_NODE * xmlNextSibl(const XML_NODE *node)
Definition: xmlparse.c:1449
void xmlAppendChild(XML_NODE *parent, XML_NODE *child)
Definition: xmlparse.c:1228