// XMLConsole.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "tinyxml.h"
// ———————————————————————-
// STDOUT输出和缩进实用函数
// ———————————————————————-
const unsigned int NUM_INDENTS_PER_SPACE=2;
const char * getIndent( unsigned int numIndents )
{
static const char * pINDENT=" + ";
static const unsigned int LENGTH=strlen( pINDENT );
unsigned int n=numIndents*NUM_INDENTS_PER_SPACE;
if ( n > LENGTH ) n = LENGTH;
return &pINDENT[ LENGTH-n ];
}
// 与getIndent相同,但最后没有“+”
const char * getIndentAlt( unsigned int numIndents )
{
static const char * pINDENT=" ";
static const unsigned int LENGTH=strlen( pINDENT );
unsigned int n=numIndents*NUM_INDENTS_PER_SPACE;
if ( n > LENGTH ) n = LENGTH;
return &pINDENT[ LENGTH-n ];
}
int dump_attribs_to_stdout(TiXmlElement* pElement, unsigned int indent)
{
if ( !pElement ) return
一个是用tinyxml遍历xml的源码
最新推荐文章于 2022-05-17 16:54:56 发布