Your question is unclear, so I guess you want to "output data into an XML file"
Outputing data into a file stream in an XML format could be something like:
#include <iotream>
#include <fstream>
int main(int argc, char * argv[])
{
TreeNode * root = doWhataverGizmoYouWantToCreateThat() ;
int count = countNodes(root) ;
delete root ;
std::fstream output("output.xml", std::ios_base::out)
output << "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" ;
output << "<count value=\"" << count << "\" />\n" ;
return 0 ;
}
Please read the iostream help for more information about the fstream object and its uses:
http://www.cplusplus.com/reference/iostream/
Now, if you want to parse and modify an existing XML, you'll need an XML parser. You can google those parsers, for example with:
http://www.google.com/search?q=XML+c%2B%2B+parser
Edit:
After reading the comments :
XML is a kind of organized text file. Somewhat like HTML, if is about elements, attributes, and data. For example, this is an XML file content:
<?xml version="1.0" encoding="utf-8" ?>
<!-- This is a comment -->
<!-- The first line will declare the XML file, as well as
its version, and its encoding -->
<my_element>
<!-- this is an element. It can contain others elements,
as well as text data and attributes -->
<my_other_element my_attribute="some_value" />
<!-- my_other_element has an attribute whose name is
my_attribute, and whose value is some_value -->
<my_another_element>Some text value</my_another_element>
<!-- my_another_element has an attribute whose content
is the following text "Some text value" -->
<my_element>
<!-- this is the end of my_element, closing it -->
For more information, read :
http://www.google.com/search?q=XML