Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Macros | Functions
drwnXMLParser.h File Reference

Provides XML parsing functionality for serializing and deserializing objects and containers of objects. More...

Go to the source code of this file.

Macros

#define RAPIDXML_NO_EXCEPTIONS
 
#define drwnXMLDoc   rapidxml::xml_document<char>
 
#define drwnXMLNode   rapidxml::xml_node<char>
 
#define drwnXMLAttr   rapidxml::xml_attribute<char>
 

Functions

drwnXMLNode * drwnParseXMLFile (drwnXMLDoc &xml, const char *filename, const char *tag=NULL)
 parse an xml file into xml (loads all data into memory) and return a pointer to the first node (with tag tag if provided)
 
bool drwnIsXMLEmpty (drwnXMLNode &xml)
 checks whether an xml document is empty
 
int drwnCountXMLChildren (drwnXMLNode &xml, const char *name=NULL)
 counts the number of children with name name
 
drwnXMLAttr * drwnAddXMLAttribute (drwnXMLNode &xml, const char *name, const char *value, bool bCopyName=true)
 Adds/changes an attribute for a given node (set bCopyName to false if it's a static string) and returns a reference to the attribute. The node must belong to a document for string copying to work.
 
drwnXMLNode * drwnAddXMLText (drwnXMLNode &xml, const char *value)
 adds/changes an text for a given node
 
drwnXMLNode * drwnAddXMLChildNode (drwnXMLNode &parent, const char *name, const char *value=NULL, bool bCopyName=true)
 adds a child node for a given parent (set bCopyName to false if it's a static string) and returns a reference to the node
 
drwnXMLNode * drwnAddXMLRootNode (drwnXMLDoc &xml, const char *name, bool bCopyName=false)
 adds a root node to an xml document (set bCopyName to false if it's a static string) and returns a reference to the node
 
const char * drwnGetXMLAttribute (const drwnXMLNode &node, const char *name)
 returns an attribute string (or NULL if the string does not exist)
 
const char * drwnGetXMLText (const drwnXMLNode &node)
 returns node text (or NULL if the node has no text)
 

Detailed Description

Provides XML parsing functionality for serializing and deserializing objects and containers of objects.

Version 1.2 of Darwin and above use the Boost and MIT-licensed RapidXML code by Marcin Kalicinski (see http://rapidxml.sourceforge.net/). See also http://www.ffuts.org/blog/a-rapidxml-gotcha/.

Previous versions used the BSD-licensed xmlParser code by Frank Vanden Berghen (see http://www.applied-mathematics.net/tools/xmlParser.html).

See Also
drwnXMLUtils
XML Utilities