Simple C Expat Wrapper (SCEW)  1.1.7
Files | Functions
Contents

Accessors for XML root elements and preambles. More...

Files

file  tree.h
 SCEW tree handling routines.
 

Functions

SCEW_API scew_elementscew_tree_root (scew_tree const *tree)
 Returns the root element of the given tree. More...
 
SCEW_API scew_elementscew_tree_set_root (scew_tree *tree, XML_Char const *name)
 Creates the root element of an XML tree with the given name. More...
 
SCEW_API scew_elementscew_tree_set_root_element (scew_tree *tree, scew_element *root)
 Sets the root element of an XML tree with the given element. More...
 
SCEW_API XML_Char const * scew_tree_xml_preamble (scew_tree const *tree)
 Return the XML preamble for the given tree. More...
 
SCEW_API void scew_tree_set_xml_preamble (scew_tree *tree, XML_Char const *preamble)
 Sets the preamble string for the XML document. More...
 

Detailed Description

Accessors for XML root elements and preambles.

Function Documentation

SCEW_API scew_element* scew_tree_root ( scew_tree const *  tree)

Returns the root element of the given tree.

Precondition
tree != NULL
Returns
the tree's root element, or NULL if the tree does not have a root element yet.
SCEW_API scew_element* scew_tree_set_root ( scew_tree tree,
XML_Char const *  name 
)

Creates the root element of an XML tree with the given name.

Note that if the tree already had a root element, it will be overwritten, possibly causing a memory leak, as the old root element is not automatically freed. So, if you plan to set a new root element, remember to free the old one first.

Precondition
tree != NULL
name != NULL
Parameters
treethe XML tree to set a new root element to.
namethe name of the new XML root element.
Returns
the tree's root element, or NULL if the element could not be created.
SCEW_API scew_element* scew_tree_set_root_element ( scew_tree tree,
scew_element root 
)

Sets the root element of an XML tree with the given element.

Note that if the tree already had a root element, it will be overwritten, possibly causing a memory leak, as the old root element is not automatically freed. So, if you plan to set a new root element, remember to free the old one first.

Precondition
tree != NULL
root != NULL
Parameters
treethe XML tree to set a new root element to.
rootthe new XML root element.
Returns
the tree's root element, or NULL if the element could not be created.
SCEW_API XML_Char const* scew_tree_xml_preamble ( scew_tree const *  tree)

Return the XML preamble for the given tree.

The XML preamble is the text between the XML declaration and the first element. It typically contains DOCTYPE declarations or processing instructions.

SCEW does not provide specific functions for DOCTYPEs or processing instructions, but they are treated as a whole.

Precondition
tree != NULL
Parameters
treethe XML tree to obtain the preamble for.
Returns
the XML preamble, or NULL if no preamble is found.
SCEW_API void scew_tree_set_xml_preamble ( scew_tree tree,
XML_Char const *  preamble 
)

Sets the preamble string for the XML document.

Typically this contains DOCTYPE declarations or processing instructions. The old XML tree preamble will be freed, if any.

SCEW does not provide specific functions for DOCTYPEs or processing instructions, but they can be added as a whole.

Precondition
tree != NULL
preamble != NULL
Parameters
treethe XML tree to set the preamble to.
preamblethe XML preamble text for the given tree.