asp教程.net c++输出 xml代码
#include "stdafx.h"
using namespace system;
using namespace system::configuration;
using namespace system::data;
using namespace system::data::sqlclient;
using namespace system::xml;void navigate(xmlnode ^node, int depth)
{
if (node == nullptr)
return;console::writeline(depth);
console::writeline(node->nodetype.tostring());
console::writeline(node->name);
console::writeline(node->value);if (node->attributes != nullptr)
{
for (int i = 0; i < node->attributes->count; i++)
{
console::writeline(node->attributes[i]->name);
console::writeline(node->attributes[i]->value);
}
}navigate(node->firstchild, depth+1);
navigate(node->nextsibling, depth);
}
void main(){
xmldocument ^doc = gcnew xmldocument();sqlconnection ^connect = gcnew sqlconnection();
connect->connectionstring = "sqlconnection";
sqldataadapter ^dadapt = gcnew sqldataadapter();
dataset ^dset = gcnew dataset();
dadapt->selectcommand = gcnew sqlcommand("select * from authors", connect);
dadapt->fill(dset, "authors");
xmldatadocument ^doc1 = gcnew xmldatadocument(dset);navigate(doc1->documentelement, 0);
}
加载xml 文件到 xmldocument
#include "stdafx.h"
using namespace system;
using namespace system::xml;
void navigate(xmlnode ^node, int depth)
{
if (node == nullptr)
return;console::writeline(depth);
console::writeline(node->nodetype.tostring());
console::writeline(node->name);
console::writeline(node->value);if (node->attributes != nullptr)
{
for (int i = 0; i < node->attributes->count; i++)
{
console::writeline(depth+1);
console::writeline(node->attributes[i]->name);
console::writeline(node->attributes[i]->value);
}
}
navigate(node->firstchild, depth+1);
navigate(node->nextsibling, depth);
}
void main()
{
xmldocument ^doc = gcnew xmldocument();
try
{
xmlreader ^reader = xmlreader::create("..monsters.xml");
doc->load(reader);
reader->close();
xmlnode ^node = doc->firstchild;
navigate(node, 0);
}
catch (exception ^e)
{
console::writeline("error occurred: {0}", e->message);
}
}
创造与魔法 安卓版v1.0.0750
创造与魔法是一款开放世界手游,在游戏中玩家可探索这个奇妙的世
创造与魔法修改版 最新版v1.0.0750
创造与魔法无限点券版是款探索冒险游戏,该款游戏的操作还是蛮自
战争与文明官方版本 安卓版v1.7.16
战争与文明是一款由上海邮通科技有限公司开发的战争策略游戏,这
迷你世界0元领皮肤无限迷你币版 最新安卓版v1.43.0
迷你世界0元购买皮肤版是这款开放沙盒冒险建造游戏的特殊破解版
创造与魔法无限经验版 安卓版v1.0.0750
创造与魔法无限经验版是款可以改造环境,整个游戏的自由度还是蛮