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-2024 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
37extern "C" {
38#endif
39
40
41typedef struct XML_ATTR_struct XML_ATTR;
42
43struct XML_ATTR_struct
44{
45 char* name;
46 char* value;
47 XML_ATTR* next;
48};
49
50typedef struct XML_NODE_struct XML_NODE;
51
52struct 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 */
66SCIP_EXPORT
68 const char* filename /**< XML file name */
69 );
70
71/** create new node */
72SCIP_EXPORT
74 const char* name,
75 int lineno
76 );
77
78/** create new attribute */
79SCIP_EXPORT
81 const char* name,
82 const char* value
83 );
84
85/** add attribute */
86SCIP_EXPORT
87void xmlAddAttr(
88 XML_NODE* n,
89 XML_ATTR* a
90 );
91
92/** append child node */
93SCIP_EXPORT
95 XML_NODE* parent,
96 XML_NODE* child
97 );
98
99/** free node */
100SCIP_EXPORT
101void xmlFreeNode(
102 XML_NODE* node
103 );
104
105/** output node */
106SCIP_EXPORT
107void xmlShowNode(
108 const XML_NODE* root
109 );
110
111/** get attribute value */
112SCIP_EXPORT
113const char* xmlGetAttrval(
114 const XML_NODE* node,
115 const char* name
116 );
117
118/** return first node */
119SCIP_EXPORT
121 const XML_NODE* node,
122 const char* name
123 );
124
125/** return next node */
126SCIP_EXPORT
127const XML_NODE* xmlNextNode(
128 const XML_NODE* node,
129 const char* name
130 );
131
132/** find node */
133SCIP_EXPORT
134const XML_NODE* xmlFindNode(
135 const XML_NODE* node,
136 const char* name
137 );
138
139/** find node with bound on the depth */
140SCIP_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 */
149SCIP_EXPORT
150const XML_NODE* xmlNextSibl(
151 const XML_NODE* node
152 );
153
154/** return previous sibling */
155SCIP_EXPORT
156const XML_NODE* xmlPrevSibl(
157 const XML_NODE* node
158 );
159
160/** return first child */
161SCIP_EXPORT
163 const XML_NODE* node
164 );
165
166/** return last child */
167SCIP_EXPORT
169 const XML_NODE* node
170 );
171
172/** return name of node */
173SCIP_EXPORT
174const char* xmlGetName(
175 const XML_NODE* node
176 );
177
178/** get line number */
179SCIP_EXPORT
180int xmlGetLine(
181 const XML_NODE* node
182 );
183
184/** get data */
185SCIP_EXPORT
186const char* xmlGetData(
187 const XML_NODE* node
188 );
189
190/** find PCDATA */
191SCIP_EXPORT
192const char* xmlFindPcdata(
193 const XML_NODE* node,
194 const char* name
195 );
196
197#ifdef __cplusplus
198}
199#endif
200
201#endif
SCIP_VAR * a
Definition: circlepacking.c:66
struct XML_ATTR_struct XML_ATTR
Definition: xml.h:41
const XML_NODE * xmlFirstChild(const XML_NODE *node)
Definition: xmlparse.c:1469
const XML_NODE * xmlFindNodeMaxdepth(const XML_NODE *node, const char *name, int depth, int maxdepth)
Definition: xmlparse.c:1419
void xmlAddAttr(XML_NODE *n, XML_ATTR *a)
Definition: xmlparse.c:1215
const XML_NODE * xmlFirstNode(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1362
const XML_NODE * xmlNextNode(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1382
const XML_NODE * xmlPrevSibl(const XML_NODE *node)
Definition: xmlparse.c:1459
void xmlAppendChild(XML_NODE *parent, XML_NODE *child)
Definition: xmlparse.c:1228
XML_NODE * xmlNewNode(const char *name, int lineno)
Definition: xmlparse.c:1176
const char * xmlGetName(const XML_NODE *node)
Definition: xmlparse.c:1489
XML_ATTR * xmlNewAttr(const char *name, const char *value)
Definition: xmlparse.c:1195
const XML_NODE * xmlLastChild(const XML_NODE *node)
Definition: xmlparse.c:1479
const XML_NODE * xmlFindNode(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1394
const char * xmlGetAttrval(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1337
struct XML_NODE_struct XML_NODE
Definition: xml.h:50
void xmlShowNode(const XML_NODE *root)
Definition: xmlparse.c:1309
const char * xmlFindPcdata(const XML_NODE *node, const char *name)
Definition: xmlparse.c:1519
const XML_NODE * xmlNextSibl(const XML_NODE *node)
Definition: xmlparse.c:1449
XML_NODE * xmlProcess(const char *filename)
Definition: xmlparse.c:1085
const char * xmlGetData(const XML_NODE *node)
Definition: xmlparse.c:1509
int xmlGetLine(const XML_NODE *node)
Definition: xmlparse.c:1499
void xmlFreeNode(XML_NODE *node)
Definition: xmlparse.c:1275