★★★★★★ 如何用CMarkup类读写XML文件,回答完美者我叫他★阿哥★

tibetan 2004-12-02 05:45:22
本小姐刚毕业呀,学识不多希望各位帮助。^_^偏偏需要用到个英文的注释源码,偶英文又不好,气死人!所有问问各位大哥!主要需要解释如下函数,用过的人帮我下,写下函数的用法和注意事项。^_^
-----------------阿哥-----------

CMarkup() { SetDoc( NULL ); };
CMarkup( LPCTSTR szDoc ) { SetDoc( szDoc ); };
CMarkup( const CMarkup& markup ) { *this = markup; };
void operator=( const CMarkup& markup );
virtual ~CMarkup() {};

// Navigate
bool Load( LPCTSTR szFileName );
bool SetDoc( LPCTSTR szDoc );
bool IsWellFormed();
bool FindElem( LPCTSTR szName=NULL );
bool FindChildElem( LPCTSTR szName=NULL );
bool IntoElem();
bool OutOfElem();
void ResetChildPos() ;
void ResetMainPos() ;
void ResetPos() ;
CString GetTagName() const;
CString GetChildTagName() const ;
CString GetData() const ;
CString GetChildData() const ;
CString GetAttr( LPCTSTR szAttr ) const ;
CString GetChildAttr( LPCTSTR szAttr ) const ;
CString GetAttrName( int n ) const;
bool SavePos( LPCTSTR szPosName=_T("") );
bool RestorePos( LPCTSTR szPosName=_T("") );
bool GetOffsets( int& nStart, int& nEnd ) const;
CString GetError() const { return m_csError; };

// Create
bool Save( LPCTSTR szFileName );
CString GetDoc() const ;
bool AddElem( LPCTSTR szName, LPCTSTR szData=NULL ) ;
bool InsertElem( LPCTSTR szName, LPCTSTR szData=NULL ) ;
bool AddChildElem( LPCTSTR szName, LPCTSTR szData=NULL ) ;
bool InsertChildElem( LPCTSTR szName, LPCTSTR szData=NULL ) ;
bool AddAttr( LPCTSTR szAttr, LPCTSTR szValue ) ;
bool AddChildAttr( LPCTSTR szAttr, LPCTSTR szValue ) ;
bool AddAttr( LPCTSTR szAttr, int nValue ) ;
bool AddChildAttr( LPCTSTR szAttr, int nValue ) ;
bool AddChildSubDoc( LPCTSTR szSubDoc ) ;
bool InsertChildSubDoc( LPCTSTR szSubDoc ) ;
CString GetChildSubDoc() const;

// Modify
bool RemoveElem();
bool RemoveChildElem();
bool SetAttr( LPCTSTR szAttr, LPCTSTR szValue ) ;
bool SetChildAttr( LPCTSTR szAttr, LPCTSTR szValue ) ;
bool SetAttr( LPCTSTR szAttr, int nValue ) ;
bool SetChildAttr( LPCTSTR szAttr, int nValue ) ;
bool SetData( LPCTSTR szData, int nCDATA=0 ) ;
bool SetChildData( LPCTSTR szData, int nCDATA=0 );
...全文
182 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
pacman2000 2004-12-06
  • 打赏
  • 举报
回复
这个CMarkup看起来怎么这么累呢?
micemice 2004-12-06
  • 打赏
  • 举报
回复
up
tibetan 2004-12-06
  • 打赏
  • 举报
回复
影子传说:都猩猩级人物了,还不给我出个点子???????
不像话!快点,给我出个注意,给我解释下,这才像话!哈哈
不过,你回答完美,我会实现我的XX
beyondtkl 2004-12-03
  • 打赏
  • 举报
回复
haha a ge?? hei...

pretty MM
yinenlai 2004-12-03
  • 打赏
  • 举报
回复
jz
oo 2004-12-03
  • 打赏
  • 举报
回复
up
021850524 2004-12-03
  • 打赏
  • 举报
回复
CMarkup() { SetDoc( NULL ); };//在当前的标签下设置空的内容.
CMarkup( LPCTSTR szDoc ) { SetDoc( szDoc ); };//和上面的那个对应啊.比如szDoc是"<ITEM>test</ITEM>", 那就是把整个这个子标签添加到当前的标签下.
CMarkup( const CMarkup& markup ) { *this = markup; };//复制整个对象过来.
void operator=( const CMarkup& markup );和virtual ~CMarkup() {};就不用讲了吧.
bool Load( LPCTSTR szFileName );//以文件名为参数设置CMarkup对象.
bool FindElem( LPCTSTR szName=NULL );//进入当前层,查找节点.NULL是说找第一个节点.
bool FindChildElem( LPCTSTR szName=NULL );//不进入当前层,在标签上查找子节点, NULL意义相同.
bool IntoElem();和bool OutOfElem();是说当指针在当前标签上的动作,是进入当前层还是跳到相应的父层上去.
bool AddElem( LPCTSTR szName, LPCTSTR szData=NULL ) ;//是进入当前层后添加项目
bool AddChildElem( LPCTSTR szName, LPCTSTR szData=NULL ) ;//是在标签上,没进入当前层时添加项目

//////////////////////////////////////////////////////////////////
CMarkup有一个类似指针的东西,它用来指示当前的位置,是在哪个标签上.
//////////////////////////////////////////////////////////////////
你自己看吧.给你网站
http://www.firstobject.com/dn_markup.htm
//////////////////////////////////////////////////////////////////
祝你学习进步!



sharkhuang 2004-12-03
  • 打赏
  • 举报
回复
用的什么xml库?
liuleilover 2004-12-03
  • 打赏
  • 举报
回复
有趣
xuzheng318 2004-12-03
  • 打赏
  • 举报
回复
1楼,沙发,帮顶!

64,631

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧