libcmutils 0.6.5
Multi-platform C99 utility library
Loading...
Searching...
No Matches
XML parsing and the document model.

Data Structures

struct  CMUTIL_XmlNode
 XML node manipulation. More...
 

Enumerations

enum  CMXmlNodeKind { CMXmlNodeUnknown = 0 , CMXmlNodeText , CMXmlNodeTag }
 The kind of XML node. More...
 

Functions

CMUTIL_XmlNodeCMUTIL_XmlParse (CMUTIL_String *str)
 Parse an XML string into an XML node tree.
 
CMUTIL_XmlNodeCMUTIL_XmlParseString (const char *xmlstr, size_t len)
 Parse an XML string into an XML node tree.
 
CMUTIL_XmlNodeCMUTIL_XmlParseFile (const char *fpath)
 Parse an XML file into an XML node tree.
 
CMUTIL_XmlNodeCMUTIL_XmlNodeCreate (CMXmlNodeKind type, const char *tagname)
 Create a new XML node with the specified type and tag name.
 
CMUTIL_XmlNodeCMUTIL_XmlNodeCreateWithLen (CMXmlNodeKind type, const char *tagname, size_t len)
 Create a new XML node with the specified type and tag name of the given length.
 

Detailed Description

Enumeration Type Documentation

◆ CMXmlNodeKind

The kind of XML node.

Enumerator
CMXmlNodeUnknown 

Unknown node type.

CMXmlNodeText 

Text node type.

CMXmlNodeTag 

XML tag node type.

Function Documentation

◆ CMUTIL_XmlParse()

CMUTIL_XmlNode * CMUTIL_XmlParse ( CMUTIL_String str)

Parse an XML string into an XML node tree.

The caller is responsible for destroying the returned XML node tree using the Destroy method of CMUTIL_XmlNode.

Parameters
strThe XML string to parse.
Returns
The root XML node of the parsed tree, or NULL on failure.

◆ CMUTIL_XmlParseString()

CMUTIL_XmlNode * CMUTIL_XmlParseString ( const char *  xmlstr,
size_t  len 
)

Parse an XML string into an XML node tree.

The caller is responsible for destroying the returned XML node tree using the Destroy method of CMUTIL_XmlNode.

Parameters
xmlstrThe XML string to parse.
lenThe length of the XML string.
Returns
The root XML node of the parsed tree, or NULL on failure.

◆ CMUTIL_XmlParseFile()

CMUTIL_XmlNode * CMUTIL_XmlParseFile ( const char *  fpath)

Parse an XML file into an XML node tree.

The caller is responsible for destroying the returned XML node tree using the Destroy method of CMUTIL_XmlNode.

Parameters
fpathThe path to the XML file to parse.
Returns
The root XML node of the parsed tree, or NULL on failure.

◆ CMUTIL_XmlNodeCreate()

CMUTIL_XmlNode * CMUTIL_XmlNodeCreate ( CMXmlNodeKind  type,
const char *  tagname 
)

Create a new XML node with the specified type and tag name.

The caller is responsible for destroying the returned XML node using the Destroy method of CMUTIL_XmlNode.

Parameters
typeThe type of the XML node (e.g., CMXmlNodeTag, CMXmlNodeText).
tagnameThe tag name of the XML node.
Returns
The newly created XML node, or NULL on failure.

◆ CMUTIL_XmlNodeCreateWithLen()

CMUTIL_XmlNode * CMUTIL_XmlNodeCreateWithLen ( CMXmlNodeKind  type,
const char *  tagname,
size_t  len 
)

Create a new XML node with the specified type and tag name of the given length.

The caller is responsible for destroying the returned XML node using the Destroy method of CMUTIL_XmlNode.

Parameters
typeThe type of the XML node (e.g., CMXmlNodeTag, CMXmlNodeText).
tagnameThe tag name of the XML node.
lenThe length of the tag name.
Returns
The newly created XML node, or NULL on failure.