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 2002-2022 Zuse Institute Berlin */
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 */
67  const char* filename /**< XML file name */
68  );
69 
70 /** create new node */
72  const char* name,
73  int lineno
74  );
75 
76 /** create new attribute */
78  const char* name,
79  const char* value
80  );
81 
82 /** add attribute */
83 void xmlAddAttr(
84  XML_NODE* n,
85  XML_ATTR* a
86  );
87 
88 /** append child node */
89 void xmlAppendChild(
90  XML_NODE* parent,
91  XML_NODE* child
92  );
93 
94 /** free node */
95 void xmlFreeNode(
96  XML_NODE* node
97  );
98 
99 /** output node */
100 void xmlShowNode(
101  const XML_NODE* root
102  );
103 
104 /** get attribute value */
105 const char* xmlGetAttrval(
106  const XML_NODE* node,
107  const char* name
108  );
109 
110 /** return first node */
111 const XML_NODE* xmlFirstNode(
112  const XML_NODE* node,
113  const char* name
114  );
115 
116 /** return next node */
117 const XML_NODE* xmlNextNode(
118  const XML_NODE* node,
119  const char* name
120  );
121 
122 /** find node */
123 const XML_NODE* xmlFindNode(
124  const XML_NODE* node,
125  const char* name
126  );
127 
128 /** find node with bound on the depth */
130  const XML_NODE* node, /**< current node - use start node to begin */
131  const char* name, /**< name of tag to search for */
132  int depth, /**< current depth - start with 0 */
133  int maxdepth /**< maximal depth */
134  );
135 
136 /** return next sibling */
137 const XML_NODE* xmlNextSibl(
138  const XML_NODE* node
139  );
140 
141 /** return previous sibling */
142 const XML_NODE* xmlPrevSibl(
143  const XML_NODE* node
144  );
145 
146 /** return first child */
147 const XML_NODE* xmlFirstChild(
148  const XML_NODE* node
149  );
150 
151 /** return last child */
152 const XML_NODE* xmlLastChild(
153  const XML_NODE* node
154  );
155 
156 /** return name of node */
157 const char* xmlGetName(
158  const XML_NODE* node
159  );
160 
161 /** get line number */
162 int xmlGetLine(
163  const XML_NODE* node
164  );
165 
166 /** get data */
167 const char* xmlGetData(
168  const XML_NODE* node
169  );
170 
171 /** find PCDATA */
172 const char* xmlFindPcdata(
173  const XML_NODE* node,
174  const char* name
175  );
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #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