xercersXML.cpp

//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

阅读更多
上一篇CXML.cpp
下一篇mail.cppp
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭