ZEDA  1.6.18
Macros | Functions
zeda_xml.h File Reference

XML file operations. More...

#include <zeda/zeda_misc.h>
#include <libxml/parser.h>
Include dependency graph for zeda_xml.h:

Go to the source code of this file.

Macros

#define zXMLInit()   LIBXML_TEST_VERSION
 
#define zXMLCheckStr(str1, str2)   ( strcmp( (char*)(str1), (str2) ) == 0 )
 
#define zXMLGetString(node)   ( (char *)xmlNodeListGetString( (node)->doc, node, 1 ) )
 
#define zXMLGetInt(node)   atoi( zXMLGetString( node ) )
 
#define zXMLGetContent(node)   ( (char *)xmlNodeGetContent( node ) )
 
#define zXMLForEachNode(node, np)   for( (np)=(node); (np); (np)=(np)->next )
 
#define zXMLCheckElement(node, str)   ( (node)->type == XML_ELEMENT_NODE && zXMLCheckStr( (node)->name, str ) )
 
#define zXMLCheckElementAndExec(node, name, op)   if( zXMLCheckElement(node,name) ){ if( !op ) return false; }
 
#define zXMLFindNodeAttr(node, name)   ( (char *)xmlGetProp( node, (xmlChar*)name ) )
 
#define zXMLAddNodeAttr(node, name, val)   xmlNewProp( node, (xmlChar *)name, (xmlChar *)val )
 
#define zXMLReplaceNodeAttr(node, name, val)   xmlSetProp( node, (xmlChar *)name, (xmlChar *)val )
 
#define zXMLGetAttrVal(attr)   ( (char *)xmlNodeListGetString( (attr)->doc, (attr)->children, 1 ) )
 
#define zXMLGetAttrInt(attr)   atoi( zXMLGetAttrVal( attr ) )
 
#define zXMLGetAttrDouble(attr)   atof( zXMLGetAttrVal( attr ) )
 
#define zXMLForEachAttr(node, attr)   for( (attr)=(node)->properties; (attr); (attr)=(attr)->next )
 
#define zXMLCheckAttr(attr, str)   zXMLCheckStr( (attr)->name, str )
 
#define zXMLCheckAttrAndExec(attr, str, op)   if( zXMLCheckStr( (attr)->name, str ) ){ (op); }
 

Functions

xmlNode * zXMLFindNodeElement (xmlNode *node, char *name)
 
bool zXMLCheckAttrVal (xmlAttr *attr, char *name, char *str)
 

Detailed Description

XML file operations.

Author
Zhidao

Macro Definition Documentation

◆ zXMLInit

#define zXMLInit ( )    LIBXML_TEST_VERSION

◆ zXMLCheckStr

#define zXMLCheckStr (   str1,
  str2 
)    ( strcmp( (char*)(str1), (str2) ) == 0 )

◆ zXMLGetString

#define zXMLGetString (   node)    ( (char *)xmlNodeListGetString( (node)->doc, node, 1 ) )

◆ zXMLGetInt

#define zXMLGetInt (   node)    atoi( zXMLGetString( node ) )

◆ zXMLGetContent

#define zXMLGetContent (   node)    ( (char *)xmlNodeGetContent( node ) )

◆ zXMLForEachNode

#define zXMLForEachNode (   node,
  np 
)    for( (np)=(node); (np); (np)=(np)->next )

◆ zXMLCheckElement

#define zXMLCheckElement (   node,
  str 
)    ( (node)->type == XML_ELEMENT_NODE && zXMLCheckStr( (node)->name, str ) )

◆ zXMLCheckElementAndExec

#define zXMLCheckElementAndExec (   node,
  name,
  op 
)    if( zXMLCheckElement(node,name) ){ if( !op ) return false; }

◆ zXMLFindNodeAttr

#define zXMLFindNodeAttr (   node,
  name 
)    ( (char *)xmlGetProp( node, (xmlChar*)name ) )

◆ zXMLAddNodeAttr

#define zXMLAddNodeAttr (   node,
  name,
  val 
)    xmlNewProp( node, (xmlChar *)name, (xmlChar *)val )

◆ zXMLReplaceNodeAttr

#define zXMLReplaceNodeAttr (   node,
  name,
  val 
)    xmlSetProp( node, (xmlChar *)name, (xmlChar *)val )

◆ zXMLGetAttrVal

#define zXMLGetAttrVal (   attr)    ( (char *)xmlNodeListGetString( (attr)->doc, (attr)->children, 1 ) )

◆ zXMLGetAttrInt

#define zXMLGetAttrInt (   attr)    atoi( zXMLGetAttrVal( attr ) )

◆ zXMLGetAttrDouble

#define zXMLGetAttrDouble (   attr)    atof( zXMLGetAttrVal( attr ) )

◆ zXMLForEachAttr

#define zXMLForEachAttr (   node,
  attr 
)    for( (attr)=(node)->properties; (attr); (attr)=(attr)->next )

◆ zXMLCheckAttr

#define zXMLCheckAttr (   attr,
  str 
)    zXMLCheckStr( (attr)->name, str )

◆ zXMLCheckAttrAndExec

#define zXMLCheckAttrAndExec (   attr,
  str,
  op 
)    if( zXMLCheckStr( (attr)->name, str ) ){ (op); }

Function Documentation

◆ zXMLFindNodeElement()

xmlNode* zXMLFindNodeElement ( xmlNode *  node,
char *  name 
)

◆ zXMLCheckAttrVal()

bool zXMLCheckAttrVal ( xmlAttr *  attr,
char *  name,
char *  str 
)