Simple C Expat Wrapper (SCEW)  1.1.7
Files | Enumerations | Functions
Properties

Handle XML trees properties. More...

Files

file  tree.h
 SCEW tree handling routines.
 

Enumerations

enum  scew_tree_standalone { scew_tree_standalone_unknown, scew_tree_standalone_no, scew_tree_standalone_yes }
 List of possible values for the standalone attribute. More...
 

Functions

SCEW_API XML_Char const * scew_tree_xml_version (scew_tree const *tree)
 Returns the current XML version for the given tree. More...
 
SCEW_API void scew_tree_set_xml_version (scew_tree *tree, XML_Char const *version)
 Sets the XML version in the XML declaration to the given tree. More...
 
SCEW_API XML_Char const * scew_tree_xml_encoding (scew_tree const *tree)
 Returns the current XML character encoding for the given tree. More...
 
SCEW_API void scew_tree_set_xml_encoding (scew_tree *tree, XML_Char const *encoding)
 Sets the character encoding used in the given XML tree. More...
 
SCEW_API scew_tree_standalone scew_tree_xml_standalone (scew_tree const *tree)
 Returns whether the given tree is an standalone document. More...
 
SCEW_API void scew_tree_set_xml_standalone (scew_tree *tree, scew_tree_standalone standalone)
 The standalone property tells the XML processor whether there are any other extra files to load, such as external entities or DTDs. More...
 

Detailed Description

Handle XML trees properties.

Enumeration Type Documentation

List of possible values for the standalone attribute.

The standalone attribute in an XML declaration defines whether the XML document is self consistent or not, that is, whether it needs to load any extra files.

Enumerator
scew_tree_standalone_unknown 

Standalone attribute not defined.

scew_tree_standalone_no 

Extra files are necessary.

scew_tree_standalone_yes 

Document stands on its own.

Function Documentation

SCEW_API XML_Char const* scew_tree_xml_version ( scew_tree const *  tree)

Returns the current XML version for the given tree.

This is the version specified in the "version" attribute in the XML declaration.

Precondition
tree != NULL
Parameters
treethe tree to return its version for.
Returns
a string representing the XML version.
SCEW_API void scew_tree_set_xml_version ( scew_tree tree,
XML_Char const *  version 
)

Sets the XML version in the XML declaration to the given tree.

Currently there is one XML version, so the value is always 1.0. If there were more XML versions, this property tells to the XML processor which one to use.

Precondition
tree != NULL
version != NULL
Parameters
treethe XML tree to set the new XML version to.
versionthe new XML version for the given tree.
SCEW_API XML_Char const* scew_tree_xml_encoding ( scew_tree const *  tree)

Returns the current XML character encoding for the given tree.

The default, when creating new SCEW trees, is UTF-8.

Expat supports the following encodings:

  • UTF-8, ASCII and ISO-8859-1.
  • UTF-16.

As SCEW is based on Expat the same encodings are supported when parsing XML documents. However, SCEW only supports UTF-16 in Windows platforms.

Note that these encodings are only supported when parsing files, but not when creating new ones. So, it is the responsibility of the user to provide the correct characters.

Precondition
tree != NULL
Parameters
treethe XML tree to obtain its character encoding for.
Returns
the character encoding for the given tree.
SCEW_API void scew_tree_set_xml_encoding ( scew_tree tree,
XML_Char const *  encoding 
)

Sets the character encoding used in the given XML tree.

Note that a user might want to use another encoding, different than the ones supported by Expat. And, as SCEW does not provide, or force, any encoding, the user is allowed to do so.

Precondition
tree != NULL
encoding != NULL
Parameters
treethe XML tree to set the new encoding to.
encodingthe new character encoding for the given tree.
SCEW_API scew_tree_standalone scew_tree_xml_standalone ( scew_tree const *  tree)

Returns whether the given tree is an standalone document.

The standalone property tells the XML processor whether there are any other extra files to load, such as external entities or DTDs.

Precondition
tree != NULL
Parameters
treethe tree to check its standalone property for.
Returns
the XML tree standalone property.
SCEW_API void scew_tree_set_xml_standalone ( scew_tree tree,
scew_tree_standalone  standalone 
)

The standalone property tells the XML processor whether there are any other extra files to load, such as external entities or DTDs.

If the XML document can stand on its own, set it to scew_tree_standalone_yes.

Precondition
tree != NULL
Parameters
treethe XML tree to set the option to.
standalonethe new XML tree standalone property.