新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> XML编辑器,XML解析器,XML开发环境
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XML工具及XML开发环境 』 → [求助]TinyXml工具的使用 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 10783 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [求助]TinyXml工具的使用 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     qgsrg 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:4
      积分:66
      门派:XML.ORG.CN
      注册:2005/3/16

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给qgsrg发送一个短消息 把qgsrg加入好友 查看qgsrg的个人资料 搜索qgsrg在『 XML工具及XML开发环境 』的所有贴子 引用回复这个贴子 回复这个贴子 查看qgsrg的博客楼主
    发贴心情 [求助]TinyXml工具的使用

    各位强人:
       我现在需要在VC6下编写一个xml的编辑器,我初步是想利用TinyXml的对象类,
    但我不知道如何使用。麻烦大家谁能给我一个非常简单的小例子即可。比如打开一个xml文件,修改一下里面内容,保存起来就可。

      我一用就出错。不明白怎么回事。。。急切希望大家能帮帮忙。多谢了


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/3/20 20:36:00
     
     shanbo198215 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:0
      积分:55
      门派:XML.ORG.CN
      注册:2005/7/20

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给shanbo198215发送一个短消息 把shanbo198215加入好友 查看shanbo198215的个人资料 搜索shanbo198215在『 XML工具及XML开发环境 』的所有贴子 引用回复这个贴子 回复这个贴子 查看shanbo198215的博客2
    发贴心情 
    TiXmlDocument *pDoc = new TiXmlDocument;
    pDoc->LoadFile(x.xml,0);
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/7/20 11:10:00
     
     xiaostar 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:61
      门派:XML.ORG.CN
      注册:2005/8/10

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xiaostar发送一个短消息 把xiaostar加入好友 查看xiaostar的个人资料 搜索xiaostar在『 XML工具及XML开发环境 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xiaostar的博客3
    发贴心情 
    tinyXML下载的时候附一个test程序,其实都是不错的例子

    如:
     const char* demoStart =
      "<?xml version=\"1.0\"  standalone='no' >\n"
      "<!-- Our to do list data -->"
      "<ToDo>\n"
      "<!-- Do I need a secure PDA? -->\n"
      "<Item priority=\"1\" distance='close'> Go to the <bold>Toy store!</bold></Item>"
      "<Item priority=\"2\" distance='none'> Do bills   </Item>"
      "<Item priority=\"2\" distance='far &amp; back'> Look for Evil Dinosaurs! </Item>"
      "</ToDo>";

    #ifdef TIXML_USE_STL
     /* What the todo list should look like after processing.
      In stream (no formatting) representation. */
     const char* demoEnd =
      "<?xml version=\"1.0\" standalone=\"no\" ?>"
      "<!-- Our to do list data -->"
      "<ToDo>"
      "<!-- Do I need a secure PDA? -->"
      "<Item priority=\"2\" distance=\"close\">Go to the"
      "<bold>Toy store!"
      "</bold>"
      "</Item>"
      "<Item priority=\"1\" distance=\"far\">Talk to:"
      "<Meeting where=\"School\">"
      "<Attendee name=\"Marple\" position=\"teacher\" />"
      "<Attendee name=\"Voel\
    #endif

     // The example parses from the character string (above):
     #if defined( WIN32 ) && defined( TUNE )" position=\"counselor\" />"
      "</Meeting>"
      "<Meeting where=\"Lunch\" />"
      "</Item>"
      "<Item priority=\"2\" distance=\"here\">Do bills"
      "</Item>"
      "</ToDo>";
     QueryPerformanceCounter( (LARGE_INTEGER*) (&start) );
     #endif

     {
      // Write to a file and read it back, to check file I/O.

      TiXmlDocument doc( "demotest.xml" );
      doc.Parse( demoStart );

      if ( doc.Error() )
      {
       printf( "Error in %s: %s\n", doc.Value(), doc.ErrorDesc() );
       exit( 1 );
      }
      doc.SaveFile();
     }

     TiXmlDocument doc( "demotest.xml" );
     bool loadOkay = doc.LoadFile();

     if ( !loadOkay )
     {
      printf( "Could not load test file 'demotest.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc() );
      exit( 1 );
     }

     printf( "** Demo doc read from disk: ** \n\n" );
     doc.Print( stdout );

     TiXmlNode* node = 0;
     TiXmlElement* todoElement = 0;
     TiXmlElement* itemElement = 0;


     // --------------------------------------------------------
     // An example of changing existing attributes, and removing
     // an element from the document.
     // --------------------------------------------------------

     // Get the "ToDo" element.
     // It is a child of the document, and can be selected by name.
     node = doc.FirstChild( "ToDo" );
     assert( node );
     todoElement = node->ToElement();
     assert( todoElement  );

     // Going to the toy store is now our second priority...
     // So set the "priority" attribute of the first item in the list.
     node = todoElement->FirstChildElement(); // This skips the "PDA" comment.
     assert( node );
     itemElement = node->ToElement();
     assert( itemElement  );
     itemElement->SetAttribute( "priority", 2 );

     // Change the distance to "doing bills" from
     // "none" to "here". It's the next sibling element.
     itemElement = itemElement->NextSiblingElement();
     assert( itemElement );
     itemElement->SetAttribute( "distance", "here" );

     // Remove the "Look for Evil Dinosours!" item.
     // It is 1 more sibling away. We ask the parent to remove
     // a particular child.
     itemElement = itemElement->NextSiblingElement();
     todoElement->RemoveChild( itemElement );

     itemElement = 0;

     // --------------------------------------------------------
     // What follows is an example of created elements and text
     // nodes and adding them to the document.
     // --------------------------------------------------------

     // Add some meetings.
     TiXmlElement item( "Item" );
     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 );
    我只贴了一部份

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/8/11 15:29:00
     
     77i01 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:0
      积分:54
      门派:XML.ORG.CN
      注册:2005/11/4

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给77i01发送一个短消息 把77i01加入好友 查看77i01的个人资料 搜索77i01在『 XML工具及XML开发环境 』的所有贴子 引用回复这个贴子 回复这个贴子 查看77i01的博客4
    发贴心情 
    我也想在VC .net 2003里面用这个东西,可是我把
    tinystr.h
    tinyxml.h
    tinystr.cpp
    tinyxml.cpp
    tinyxmlerror.cpp
    tinyxmlparser.cpp
    六个文件包含到项目中,任何代码都没有加。一编译就出错了。
    提示是:

    ------ 已启动全部重新生成: 项目: Win32XML, 配置: Debug Win32 ------

    正在删除项目“Win32XML”(配置“Debug|Win32”)的中间文件和输出文件。
    正在编译...
    stdafx.cpp
    正在编译...
    tinyxmlparser.cpp
    d:\试验机资料\xml\win32xml\tinyxmlparser.cpp(1573) : fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾
    tinyxmlerror.cpp
    d:\试验机资料\xml\win32xml\tinyxmlerror.cpp(53) : fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾
    tinyxml.cpp
    d:\试验机资料\xml\win32xml\tinyxml.cpp(1733) : fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾
    tinystr.cpp
    d:\试验机资料\xml\win32xml\tinystr.cpp(116) : fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾
    TempTest.cpp
    Win32XML.cpp
    正在生成代码...

    生成日志保存在“file://d:\试验机资料\Xml\Win32XML\Debug\BuildLog.htm”中
    Win32XML - 4 错误,0 警告


    ---------------------- 完成 ---------------------

        全部重新生成: 0 已成功, 1 已失败, 0 已跳过

    怎么回事啊??老大们给我一个提示。。

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/11/4 16:53:00
     
     wispx 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:7
      积分:85
      门派:XML.ORG.CN
      注册:2005/11/3

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给wispx发送一个短消息 把wispx加入好友 查看wispx的个人资料 搜索wispx在『 XML工具及XML开发环境 』的所有贴子 引用回复这个贴子 回复这个贴子 查看wispx的博客5
    发贴心情 
    我想在linux下用tinyxml 修改一个xml文件的element
    ./a.out story info 就把里面一个节点的的element story 改成了 info

    但是应当怎么个使用法呢?

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/11/15 11:11:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XML工具及XML开发环境 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/25 18:40:03

    本主题贴数5,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    78.125ms