当前位置: 首页>>代码示例>>C++>>正文


C++ TiXmlElement::InsertAfterChild方法代码示例

本文整理汇总了C++中TiXmlElement::InsertAfterChild方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::InsertAfterChild方法的具体用法?C++ TiXmlElement::InsertAfterChild怎么用?C++ TiXmlElement::InsertAfterChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TiXmlElement的用法示例。


在下文中一共展示了TiXmlElement::InsertAfterChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
        item.SetAttribute( "priority", "1" );
        item.SetAttribute( "distance", "far" );

        TiXmlText text( "Talk to:" );

        TiXmlElement meeting1( "Meeting" );
        meeting1.SetAttribute( "where", "School" );

        TiXmlElement meeting2( "Meeting" );
        meeting2.SetAttribute( "where", "Lunch" );

        TiXmlElement attendee1( "Attendee" );
        attendee1.SetAttribute( "name", "Marple" );
        attendee1.SetAttribute( "position", "teacher" );

        TiXmlElement attendee2( "Attendee" );
        attendee2.SetAttribute( "name", "Voel" );
        attendee2.SetAttribute( "position", "counselor" );

        // Assemble the nodes we've created:
        meeting1.InsertEndChild( attendee1 );
        meeting1.InsertEndChild( attendee2 );

        item.InsertEndChild( text );
        item.InsertEndChild( meeting1 );
        item.InsertEndChild( meeting2 );

        // And add the node to the existing list after the first child.
        node = todoElement->FirstChild( "Item" );
        assert( node );
        itemElement = node->ToElement();
        assert( itemElement );

        todoElement->InsertAfterChild( itemElement, item );

        printf( "\n** Demo doc processed: ** \n\n" );
        doc.Print( stdout );


    #ifdef TIXML_USE_STL
        printf( "** Demo doc processed to stream: ** \n\n" );
        cout << doc << endl << endl;
    #endif

        // --------------------------------------------------------
        // Different tests...do we have what we expect?
        // --------------------------------------------------------

        int count = 0;
        TiXmlElement*   element;

        //////////////////////////////////////////////////////

    #ifdef TIXML_USE_STL
        cout << "** Basic structure. **\n";
        ostringstream outputStream( ostringstream::out );
        outputStream << doc;
        XmlTest( "Output stream correct.",  string( demoEnd ).c_str(),
                                            outputStream.str().c_str(), true );
    #endif

        node = doc.RootElement();
        assert( node );
        XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );
        XmlTest ( "Root element value is 'ToDo'.", "ToDo",  node->Value());
开发者ID:jiaqiang,项目名称:thirdparty,代码行数:66,代码来源:xmltest.cpp


注:本文中的TiXmlElement::InsertAfterChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。