XMLParser.h
上传用户:hysujiao87
上传日期:2007-12-02
资源大小:156k
文件大小:1k
- // XMLParser.h: interface for the CXMLParser class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_XMLPARSER_H__4E74F8D9_8E8D_4A0B_AD38_8F7F3194350D__INCLUDED_)
- #define AFX_XMLPARSER_H__4E74F8D9_8E8D_4A0B_AD38_8F7F3194350D__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "Element.h"
- class CElement;
- class AFX_EXT_CLASS CXMLParser
- {
- public:
- CXMLParser();
- virtual ~CXMLParser();
- int LoadXML(BYTE* pBuf, DWORD nSize);
- int LoadXML(LPCTSTR pathXML);
- int BuildXML();
- CString get_version() const {return m_version;}
- CString get_xml() const {return m_xml;}
- CElement* get_root(){return m_root;}
- void set_root(CElement* root){m_root = root;}
-
- int EnumerateElements(LPENUM_CALLBACK_FUNC pFunc);
- int FreeTree();
- int FreeXML();
-
- CElement *createElement(LPCTSTR tag, LPCTSTR content);
- protected:
- int m_pos;
- CString m_xml;
- CString m_version;
- CElement* m_root;
- int ParseVersion();
-
- int ParseRoot();
- int ParseElement(CElement* element);
- int ParseAttribute(LPCTSTR tagString, CString &tagName, CMapStringToString &attribute);
- int findNextTag(CString &tagName, CString &beforeTag);
- int BuildVersion();
- int findFirstNotOf(CString &str, LPCTSTR array, int start, int arraySize);
- };
- #endif // !defined(AFX_XMLPARSER_H__4E74F8D9_8E8D_4A0B_AD38_8F7F3194350D__INCLUDED_)