关闭

xercersXML.cpp

235人阅读 评论(0) 收藏 举报

//CXML.h
#ifndef XML_PARSER_HPP
#define XML_PARSER_HPP

#include <xercesc/util/TransService.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/Compilers/VCPPDefs.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMDocumentType.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/dom/DOMImplementationLS.hpp>
#include <xercesc/dom/DOMNodeIterator.hpp>
#include <xercesc/dom/DOMNodeList.hpp>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOMText.hpp>
#include <xercesc/dom/DOMAttr.hpp>
#include <xercesc/dom/DOMNodeFilter.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/util/XMLException.hpp>
#include <xercesc/framework/XMLFormatter.hpp>
#include <xercesc/util/XMLString.hpp>
#include <stdlib.h>
#include <string>
#include <list>
#include <map>
#include <stdexcept>
using namespace std;
XERCES_CPP_NAMESPACE_USE

typedef struct tagCmdInfo
{
 string strCmd;     //命令
 string strCmdEnd;  //命令对应的模式,如TERMINAL>等
}CmdInfo;


class CXML
{
public:
 CXML();
 virtual ~CXML();
 XMLTransService::Codes tranServiceCode;
 
 void xmlParser(string& xmlFile,
             list<list<string> > &listOfList,
             list<string> &listCmdTreeNode,
             list<string> &listText,
             list<CmdInfo> &cmdInfoKey) throw(std::runtime_error);

 void getCmdXML(list<list<string> > &listOfList,  //命令队列的队列
       list<string> &listCmdTreeNode,    //命令树结点名
       list<string> &listText,           //命令模式
       list<CmdInfo> &CmdInfoKey);

 void getLanguageXML( const char* pFilename,
       list<string> &listAttr,
       list<string> &listText);

 void printXML(string& xmlFile);

 void printLanguageXML(const char* pFileName);

private:   
 xercesc::XercesDOMParser *m_DOMXmlParser;   //定义解析对象
 list<string> m_listStr;
 list<list<string> > m_listOfList;
 list<string> m_listCmdTreeNode;
 list<string> m_listText;
 list<CmdInfo> m_CmdInfoKey;
};

#endif

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:18925次
    • 积分:304
    • 等级:
    • 排名:千里之外
    • 原创:11篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章存档