本文整理汇总了C++中poco::xml::DOMParser::setEntityResolver方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMParser::setEntityResolver方法的具体用法?C++ DOMParser::setEntityResolver怎么用?C++ DOMParser::setEntityResolver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::xml::DOMParser
的用法示例。
在下文中一共展示了DOMParser::setEntityResolver方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseXML
const bool BoardListXML::ParseXML(const std::string &xml)
{
bool parsed=false;
Poco::XML::DOMParser dp;
dp.setEntityResolver(0);
Initialize();
try
{
Poco::AutoPtr<Poco::XML::Document> doc=dp.parseString(FixCDATA(xml));
Poco::XML::Element *root=XMLGetFirstChild(doc,"BoardList");
Poco::XML::Element *boardel=NULL;
boardel=XMLGetFirstChild(root,"Board");
while(boardel)
{
std::string name="";
std::string description="";
Poco::XML::Element *txt=XMLGetFirstChild(boardel,"Name");
if(txt && txt->firstChild())
{
name=SanitizeSingleString(txt->firstChild()->getNodeValue());
StringFunctions::LowerCase(name,name);
}
txt=XMLGetFirstChild(boardel,"Description");
if(txt && txt->firstChild())
{
description=SanitizeSingleString(txt->firstChild()->getNodeValue());
}
if(name!="" && description!="")
{
m_boards.push_back(board(name,description));
}
boardel=XMLGetNextSibling(boardel,"Board");
}
parsed=true;
}
catch(...)
{
}
return parsed;
}
示例2: ParseXML
const bool IdentityIntroductionXML::ParseXML(const std::string &xml)
{
FreenetSSKKey ssk;
bool parsed=false;
Poco::XML::DOMParser dp;
dp.setEntityResolver(0);
Initialize();
try
{
Poco::AutoPtr<Poco::XML::Document> doc=dp.parseString(FixCDATA(xml));
Poco::XML::Element *root=XMLGetFirstChild(doc,"IdentityIntroduction");
Poco::XML::Element *txt=NULL;
txt=XMLGetFirstChild(root,"Identity");
if(txt)
{
if(txt->firstChild())
{
m_identity=SanitizeSingleString(txt->firstChild()->getNodeValue());
if(ssk.TryParse(m_identity)==false)
{
return false;
}
m_identity=ssk.GetBaseKey();
}
}
parsed=true;
}
catch(...)
{
}
return parsed;
}
示例3: ParseXML
const bool MessageXML::ParseXML(const std::string &xml)
{
bool parsed=false;
Poco::XML::DOMParser dp;
dp.setEntityResolver(0);
Initialize();
try
{
Poco::AutoPtr<Poco::XML::Document> doc=dp.parseString(FixCDATA(xml));
Poco::XML::Element *root=XMLGetFirstChild(doc,"Message");
Poco::XML::Element *txt=NULL;
txt=XMLGetFirstChild(root,"Date");
if(txt)
{
if(txt->firstChild())
{
m_date=SanitizeSingleString(txt->firstChild()->getNodeValue());
}
}
txt=XMLGetFirstChild(root,"Time");
if(txt)
{
if(txt->firstChild())
{
m_time=SanitizeSingleString(txt->firstChild()->getNodeValue());
}
}
txt=XMLGetFirstChild(root,"Subject");
if(txt)
{
if(txt->firstChild())
{
m_subject=SanitizeSingleString(txt->firstChild()->getNodeValue());
}
}
txt=XMLGetFirstChild(root,"MessageID");
if(txt)
{
if(txt->firstChild())
{
m_messageid=SanitizeSingleString(txt->firstChild()->getNodeValue());
}
}
txt=XMLGetFirstChild(root,"ReplyBoard");
if(txt)
{
if(txt->firstChild())
{
m_replyboard=SanitizeSingleString(txt->firstChild()->getNodeValue());
// strip off everything after , in board name
if(m_replyboard.find(',')!=std::string::npos)
{
m_replyboard.erase(m_replyboard.find(','));
}
m_replyboard=Board::FixBoardName(m_replyboard);
}
}
txt=XMLGetFirstChild(root,"Body");
if(txt)
{
if(txt->firstChild())
{
m_body=txt->firstChild()->getNodeValue();
}
}
Poco::XML::Element *boards=XMLGetFirstChild(root,"Boards");
if(boards)
{
Poco::XML::Element *board=XMLGetFirstChild(boards,"Board");
while(board)
{
if(board->firstChild())
{
std::string boardname=SanitizeSingleString(board->firstChild()->getNodeValue());
// strip off everything after , in board name
if(boardname.find(',')!=std::string::npos)
{
boardname.erase(boardname.find(','));
}
boardname=Board::FixBoardName(boardname);
m_boards.push_back(boardname);
}
board=XMLGetNextSibling(board,"Board");
}
}
Poco::XML::Element *inreplyto=XMLGetFirstChild(root,"InReplyTo");
if(inreplyto)
{
Poco::XML::Element *message=XMLGetFirstChild(inreplyto,"Message");
while(message)
{
Poco::XML::Element *orderel=XMLGetFirstChild(message,"Order");
Poco::XML::Element *messageidel=XMLGetFirstChild(message,"MessageID");
if(orderel && orderel->firstChild() && messageidel && messageidel->firstChild())
{
int order=-1;
//.........这里部分代码省略.........
示例4: ParseXML
const bool SoneXML::ParseXML(const std::string &xml)
{
bool parsed=false;
Poco::XML::DOMParser dp;
dp.setEntityResolver(0);
Initialize();
try
{
Poco::AutoPtr<Poco::XML::Document> doc=dp.parseString(FixCDATA(xml));
Poco::XML::Element *root=XMLGetFirstChild(doc,"sone");
Poco::XML::Element *posts=NULL;
Poco::XML::Element *replies=NULL;
Poco::XML::Element *txt=NULL;
Poco::XML::Element *profile=NULL;
Poco::XML::Element *albums=NULL;
if(root)
{
posts=XMLGetFirstChild(root,"posts");
replies=XMLGetFirstChild(root,"replies");
profile=XMLGetFirstChild(root,"profile");
albums=XMLGetFirstChild(root,"albums");
}
if(posts)
{
txt=XMLGetFirstChild(posts,"post");
while(txt)
{
std::string id("");
std::string timestr("");
Poco::Timestamp::TimeVal timeval;
Poco::DateTime messagetime;
std::string messagetext("");
Poco::XML::Element *el;
el=XMLGetFirstChild(txt,"id");
if(el && el->firstChild())
{
id=el->firstChild()->getNodeValue();
}
el=XMLGetFirstChild(txt,"time");
if(el && el->firstChild())
{
timestr=el->firstChild()->getNodeValue();
StringFunctions::Convert(timestr,timeval);
messagetime=Poco::Timestamp(timeval*static_cast<Poco::Timestamp::TimeVal>(1000));
}
el=XMLGetFirstChild(txt,"text");
if(el && el->firstChild())
{
messagetext=el->firstChild()->getNodeValue();
}
if(id!="" && messagetext!="")
{
m_messages.push_back(message(messagetime,id,std::string(""),messagetext));
}
txt=XMLGetNextSibling(txt,"post");
}
}
if(replies)
{
txt=XMLGetFirstChild(replies,"reply");
while(txt)
{
std::string id("");
std::string replyto("");
std::string timestr("");
Poco::Timestamp::TimeVal timeval;
Poco::DateTime messagetime;
std::string messagetext("");
Poco::XML::Element *el;
el=XMLGetFirstChild(txt,"id");
if(el && el->firstChild())
{
id=el->firstChild()->getNodeValue();
}
el=XMLGetFirstChild(txt,"post-id");
if(el && el->firstChild())
{
replyto=el->firstChild()->getNodeValue();
}
el=XMLGetFirstChild(txt,"time");
if(el && el->firstChild())
{
timestr=el->firstChild()->getNodeValue();
StringFunctions::Convert(timestr,timeval);
//.........这里部分代码省略.........