RAVE
rave_simplexml.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2010 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of RAVE.
5
6RAVE is free software: you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11RAVE is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public License
17along with RAVE. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
26#ifndef RAVE_SIMPLEXML_H
27#define RAVE_SIMPLEXML_H
28#include "rave_attribute.h"
29#include "rave_object.h"
30#include <stdio.h>
31
33
38
44SimpleXmlNode_t* SimpleXmlNode_parseFile(const char* filename);
45
54
61
68int SimpleXmlNode_setName(SimpleXmlNode_t* self, const char* name);
69
75const char* SimpleXmlNode_getName(SimpleXmlNode_t* self);
76
85int SimpleXmlNode_setText(SimpleXmlNode_t* self, const char* text, int len);
86
94int SimpleXmlNode_addText(SimpleXmlNode_t* self, const char* text, int len);
95
101const char* SimpleXmlNode_getText(SimpleXmlNode_t* self);
102
110
117
124
132
140
148int SimpleXmlNode_addAttribute(SimpleXmlNode_t* self, const char* key, const char* value);
149
156const char* SimpleXmlNode_getAttribute(SimpleXmlNode_t* self, const char* key);
157
164int SimpleXmlNode_write(SimpleXmlNode_t* self, FILE* fp);
165
175
176#endif /* RAVE_SIMPLEXML_H */
Used for keeping track on attributes.
Generic implementation of an object that is used within rave.
const char * SimpleXmlNode_getName(SimpleXmlNode_t *self)
Returns the tag name of this node.
Definition rave_simplexml.c:350
SimpleXmlNode_t * SimpleXmlNode_create(SimpleXmlNode_t *parent, const char *name)
Creates a xml node.
Definition rave_simplexml.c:590
const char * SimpleXmlNode_getText(SimpleXmlNode_t *self)
Returns the text.
Definition rave_simplexml.c:403
int SimpleXmlNode_setName(SimpleXmlNode_t *self, const char *name)
Sets the tag name of this node.
Definition rave_simplexml.c:334
int SimpleXmlNode_addText(SimpleXmlNode_t *self, const char *text, int len)
Adds text.
Definition rave_simplexml.c:367
SimpleXmlNode_t * SimpleXmlNode_parseFile(const char *filename)
The parser function for parsing the xml-file into a node tree.
Definition rave_simplexml.c:258
const char * SimpleXmlNode_getAttribute(SimpleXmlNode_t *self, const char *key)
Returns the attribute value for the specified attribute.
Definition rave_simplexml.c:494
void SimpleXmlNode_remove(SimpleXmlNode_t *self, SimpleXmlNode_t *child)
Removes the given child from the children list.
Definition rave_simplexml.c:421
SimpleXmlNode_t * SimpleXmlNode_getChild(SimpleXmlNode_t *self, int index)
Returns the child at specified index.
Definition rave_simplexml.c:445
int SimpleXmlNode_addChild(SimpleXmlNode_t *self, SimpleXmlNode_t *child)
Adds a child to this node.
Definition rave_simplexml.c:410
int SimpleXmlNode_setText(SimpleXmlNode_t *self, const char *text, int len)
Sets the text.
Definition rave_simplexml.c:356
RaveCoreObjectType SimpleXmlNode_TYPE
Type definition to use when creating a rave object.
Definition rave_simplexml.c:619
int SimpleXmlNode_addAttribute(SimpleXmlNode_t *self, const char *key, const char *value)
Adds an attribute to a node.
Definition rave_simplexml.c:469
void SimpleXmlNode_setParent(SimpleXmlNode_t *self, SimpleXmlNode_t *parent)
Sets the parent for this node.
Definition rave_simplexml.c:323
SimpleXmlNode_t * SimpleXmlNode_getChildByName(SimpleXmlNode_t *self, const char *name)
Returns the child with the given name.
Definition rave_simplexml.c:451
SimpleXmlNode_t * SimpleXmlNode_getParent(SimpleXmlNode_t *self)
Returns the parent for this node.
Definition rave_simplexml.c:329
int SimpleXmlNode_write(SimpleXmlNode_t *self, FILE *fp)
Writes the node to the file pointer.
Definition rave_simplexml.c:581
int SimpleXmlNode_getNumberOfChildren(SimpleXmlNode_t *self)
Returns the number of children.
Definition rave_simplexml.c:439
Represents a node.
Definition rave_simplexml.c:38
SimpleXmlNode_t * parent
this nodes parent
Definition rave_simplexml.c:45
RAVE_OBJECT_HEAD char * name
Always on top.
Definition rave_simplexml.c:40
char * text
the trimmed character data
Definition rave_simplexml.c:41
The rave object type definition.
Definition rave_object.h:52