Lephisto/src/xml.h
2013-02-17 19:51:31 +00:00

19 lines
518 B
C

#pragma once
#include "libxml/parser.h"
#define XML_NODE_START 1
#define XML_NODE_TEXT 3
// Check if node n is of name s.
#define xml_isNode(n,s) (((n)->type == XML_NODE_START) && \
(strcmp((char*)(n)->name, s)==0))
// Get the property s of node n. This mallocs.
#define xml_nodeProp(n,s) (char*)xmlGetProp(n, (xmlChar*)s)
#define xml_get(n) ((char*)(n)->children->content)
#define xml_getInt(n) (atoi((char*)(n)->children->content))
#define xml_getFloat(n) (atof((char*)(n)->children->content))