我想让我的C ++程序生成xml文件吗?在程序中,我有一个树形结构. [英] i want my c++ programe to generate a xml file?.In programe i have a tree structure.

查看:69
本文介绍了我想让我的C ++程序生成xml文件吗?在程序中,我有一个树形结构.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

树状视图.
a
/\
b c
这是程序的输出.
我想为此输出生成xml.

树的C ++结构.

Tree view.
a
/ \
b c
this is the output of the progrme.
I want to generate the xml for this output.

c++ structure for tree.

struct TreeNode {
             int item;         // The data in this node.
             TreeNode *left;   // Pointer to the left subtree.
             TreeNode *right;  // Pointer to the right subtree.
          }

推荐答案

编写 XML文件非常简单,您甚至不需要库(另一方面手动库大大简化了解析 XML文件这一更困难的任务."
您只需要标准的C++文件输出工具和遍历树的函数.
:)
Writing an XML file is really simple, you don''t even need a library (on the other hand libraries greatly simplify the more difficult task of parsing XML files).
You just need the standard C++ file output facilities and a function traversing the tree.
:)


您的问题根本不清楚.您是否正在寻找一个可以轻松创建xml文件的XML库?如果是,请查看 TinyXML [ ^ ],它是一个简单而轻巧的XML库.
Your question isn''t clear at all. Are you looking for a XML library that allows you to create an xml file easily ? If yes, have a look at TinyXML[^], which is a simple and lightweight XML library.


这篇关于我想让我的C ++程序生成xml文件吗?在程序中,我有一个树形结构.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆