Votre question ne sait pas, donc je suppose que vous voulez « données de sortie dans un fichier XML »
données outputing dans un flux de fichier dans un format XML pourrait être quelque chose comme:
#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 ;
}
S'il vous plaît lire l'aide iostream pour plus d'informations sur l'objet fstream et ses utilisations:
http://www.cplusplus.com/reference/iostream/
Maintenant, si vous voulez analyser et modifier un XML existant, vous aurez besoin d'un analyseur XML. Vous pouvez google ces parseurs, par exemple avec:
http://www.google.com/search?q=XML+c%2B%2B+parser
Edit:
Après avoir lu les commentaires:
XML est une sorte de fichier texte organisé. Un peu comme HTML, s'il s'agit d'éléments, d'attributs et de données. Par exemple, c'est un contenu de fichier XML:
<?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 -->
Pour plus d'informations, lisez:
http://www.google.com/search?q=XML
Aucun texte? Pas d'explication ? – paercebal
@paercebal: je veux montrer la sortie d'un programme d'arbre binaire en XML. – nomi
je peux le montrer dans le classement simple, mais je ne sais pas à propos de xml – nomi