コード例 #1
0
ファイル: tinyXmlExample.cpp プロジェクト: aliawa/help
// ----------------------------------------------------------------------
// main() for printing files named on the command line
// ----------------------------------------------------------------------
int main(int argc, char* argv[])
{
    for (int i=1; i<argc; i++)
    {
        dump_to_stdout(argv[i]);
    }
    return 0;
}
コード例 #2
0
ファイル: XMLTester.cpp プロジェクト: kristofe/GameEngine
void XMLTester::dump_to_stdout( TiXmlNode* pParent, unsigned int indent)
{
    if ( !pParent ) return;

    TiXmlNode* pChild;
    TiXmlText* pText;
    int t = pParent->Type();
    printf( "%s", xml_getIndent(indent));
    int num;

    switch ( t )
    {
    case TiXmlNode::DOCUMENT:
        printf( "Document" );
        break;

    case TiXmlNode::ELEMENT:
        printf( "Element [%s]", pParent->Value() );
        num=dump_attribs_to_stdout(pParent->ToElement(), indent+1);
        switch(num)
        {
        case 0:
            printf( " (No attributes)");
            break;
        case 1:
            printf( "%s1 attribute", getIndentAlt(indent));
            break;
        default:
            printf( "%s%d attributes", getIndentAlt(indent), num);
            break;
        }
        break;

    case TiXmlNode::COMMENT:
        printf( "Comment: [%s]", pParent->Value());
        break;

    case TiXmlNode::UNKNOWN:
        printf( "Unknown" );
        break;

    case TiXmlNode::TEXT:
        pText = pParent->ToText();
        printf( "Text: [%s]", pText->Value() );
        break;

    case TiXmlNode::DECLARATION:
        printf( "Declaration" );
        break;
    default:
        break;
    }
    printf( "\n" );
    for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
    {
        dump_to_stdout( pChild, indent+1 );
    }
}
コード例 #3
0
ファイル: xml2test.cpp プロジェクト: trotskey/Hokuhou
int _tmain(int argc, _TCHAR* argv[])
{
	printf("hello world\n");
	TiXmlDocument doc( "test.xml" );
	doc.LoadFile();
	dump_to_stdout( &doc );
	for(;;);
	return 0;
}
コード例 #4
0
ファイル: main.cpp プロジェクト: HmsChumsai/TestXML
// load the named file and dump its structure to STDOUT
void dump_to_stdout(const char* pFilename)
{
	TiXmlDocument doc(pFilename);
	bool loadOkay = doc.LoadFile();
	if (loadOkay)
	{
		printf("\n%s:\n", pFilename);
		dump_to_stdout(&doc); // defined later in the tutorial
	}
	else
	{
		printf("Failed to load file \"%s\"\n", pFilename);
	}
}
コード例 #5
0
ファイル: xmlStructure.cpp プロジェクト: akivajp/travatar
// load the named file and dump its structure to STDOUT
    void xmlStructure::dump_to_stdout ( const char* pFilename )
    {
        TiXmlDocument doc ( pFilename );
        bool loadOkay = doc.LoadFile ( TIXML_ENCODING_UTF8 );
        if ( loadOkay )
        {
            printf ( "\n%s:\n", pFilename );
            dump_to_stdout ( &doc ); // defined later in the tutorial
        }
        else
        {
            printf ( "Failed to load file \"%s\"\n", pFilename );
        }
    }