本文整理汇总了C++中node::NodeList类的典型用法代码示例。如果您正苦于以下问题:C++ NodeList类的具体用法?C++ NodeList怎么用?C++ NodeList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parse_file
void parse_file( bool do_html, istream& input_stream, ostream& output_stream )
{
DomParser parser;
parser.set_substitute_entities( true );
parser.parse_stream( input_stream );
if ( parser )
{
/* if succesfull create output */
const Element * rootNode = parser.get_document()->get_root_node();
if ( rootNode == NULL )
{
throw runtime_error( "get_root_node() failed" );
}
OutputBuilder* b;
if ( do_html )
{
b = new HtmlBuilder( output_stream );
} else
{
b = new LatexBuilder( output_stream );
}
/* do stuff */
{
const Element & root_in = dynamic_cast<const Element &>( *rootNode );
if ( root_in.get_name() != "document" )
{
throw runtime_error( "root node must be document" );
}
OutputState * s = b->create_root();
Node::NodeList list = root_in.get_children();
for ( Node::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter )
{
if ( *iter != NULL )
{
parse_node( **iter, * s );
}
}
s->finish();
delete s;
}
delete b;
}
}
开发者ID:MarcAntoine-Arnaud,项目名称:xml2epub,代码行数:45,代码来源:options.hpp
示例2: loadLabels
bool PinotSettings::loadLabels(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
// Load the label's properties
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "name")
{
m_labels.insert(nodeContent);
}
// Labels used to have colours...
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:35,代码来源:PinotSettings.cpp
示例3: loadFilePatterns
bool PinotSettings::loadFilePatterns(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
// Load the file patterns list
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "pattern")
{
m_filePatternsBlackList.insert(nodeContent);
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:34,代码来源:PinotSettings.cpp
示例4: fromXML
void CharacterList::fromXML(const xmlpp::Element &root)
{
using namespace xmlpp;
clear();
Node::NodeList node = root.get_children("character");
for (Node::NodeList::const_iterator it = node.begin(); it != node.end(); it++)
{
Element *elem = dynamic_cast<Element*>(*it);
string name;
Attribute *attr = elem->get_attribute("name");
if (attr != NULL)
{
name = attr->get_value();
}
string playerName="";
attr = elem->get_attribute("playername");
if (attr != NULL)
{
playerName = attr->get_value();
}
Character character = Character(name,playerName);
character.fromXML(*elem);
vCharacters.push_back(character);
}
}
开发者ID:Dramac,项目名称:GM-Assistant,代码行数:26,代码来源:CharacterList.cpp
示例5: loadUi
bool PinotSettings::loadUi(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "xpos")
{
m_xPos = atoi(nodeContent.c_str());
}
else if (nodeName == "ypos")
{
m_yPos = atoi(nodeContent.c_str());
}
else if (nodeName == "width")
{
m_width = atoi(nodeContent.c_str());
}
else if (nodeName == "height")
{
m_height = atoi(nodeContent.c_str());
}
else if (nodeName == "panepos")
{
m_panePos = atoi(nodeContent.c_str());
}
else if (nodeName == "expandqueries")
{
if (nodeContent == "YES")
{
m_expandQueries = true;
}
else
{
m_expandQueries = false;
}
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:59,代码来源:PinotSettings.cpp
示例6: loadMailAccounts
bool PinotSettings::loadMailAccounts(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
MailAccount mailAccount;
// Load the mail account's properties
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "name")
{
mailAccount.m_name = nodeContent;
}
else if (nodeName == "type")
{
mailAccount.m_type = nodeContent;
}
else if (nodeName == "mtime")
{
mailAccount.m_modTime = (time_t)atoi(nodeContent.c_str());
}
else if (nodeName == "mindate")
{
mailAccount.m_lastMessageTime = (time_t)atoi(nodeContent.c_str());
}
else if (nodeName == "size")
{
mailAccount.m_size = (off_t)atoi(nodeContent.c_str());
}
}
if (mailAccount.m_name.empty() == false)
{
m_mailAccounts.insert(mailAccount);
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:57,代码来源:PinotSettings.cpp
示例7: loadLabels
bool PinotSettings::loadLabels(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
Label label;
// Load the label's properties
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "name")
{
label.m_name = nodeContent;
}
else if (nodeName == "red")
{
label.m_red = (unsigned short)atoi(nodeContent.c_str());
}
else if (nodeName == "green")
{
label.m_green = (unsigned short)atoi(nodeContent.c_str());
}
else if (nodeName == "blue")
{
label.m_blue = (unsigned short)atoi(nodeContent.c_str());
}
}
if (label.m_name.empty() == false)
{
m_labels.insert(label);
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:53,代码来源:PinotSettings.cpp
示例8: p
intg pascal_dataset<Tdata>::count_samples() {
total_difficult = 0;
total_truncated = 0;
total_occluded = 0;
total_ignored = 0;
total_samples = 0;
std::string xmlpath;
boost::filesystem::path p(annroot);
if (!boost::filesystem::exists(p))
eblthrow("Annotation path " << annroot << " does not exist.");
std::cout << "Counting number of samples in " << annroot << " ..."
<< std::endl;
// find all xml files recursively
std::list<std::string> *files = find_fullfiles(annroot, XML_PATTERN, NULL,
false, true);
if (!files || files->size() == 0)
eblthrow("no xml files found in " << annroot << " using file pattern "
<< XML_PATTERN);
std::cout << "Found " << files->size() << " xml files." << std::endl;
for (std::list<std::string>::iterator i = files->begin(); i != files->end(); ++i) {
xmlpath = *i;
// parse xml
DomParser parser;
parser.parse_file(xmlpath);
if (parser) {
// initialize root node and list
const Node* pNode = parser.get_document()->get_root_node();
Node::NodeList list = pNode->get_children();
// parse all objects in image
for(Node::NodeList::iterator iter = list.begin();
iter != list.end(); ++iter) {
if (!strcmp((*iter)->get_name().c_str(), "object")) {
// check for difficult flag in object node
Node::NodeList olist = (*iter)->get_children();
count_sample(olist);
}
}
}
}
if (files) delete files;
std::cout << "Found: " << total_samples << " samples, including ";
std::cout << total_difficult << " difficult, " << total_truncated;
std::cout << " truncated and " << total_occluded << " occluded." << std::endl;
ignore_difficult ? std::cout << "Ignoring" : std::cout << "Using";
std::cout << " difficult samples." << std::endl;
ignore_truncated ? std::cout << "Ignoring" : std::cout << "Using";
std::cout << " truncated samples." << std::endl;
ignore_occluded ? std::cout << "Ignoring" : std::cout << "Using";
std::cout << " occluded samples." << std::endl;
total_samples = total_samples - total_ignored;
return total_samples;
}
开发者ID:2php,项目名称:eblearn,代码行数:52,代码来源:pascal_dataset.hpp
示例9: loadProxy
bool PinotSettings::loadProxy(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pChildElem = dynamic_cast<Element*>(pNode);
if (pChildElem == NULL)
{
continue;
}
string nodeName(pChildElem->get_name());
string nodeContent(getElementContent(pChildElem));
if (nodeName == "address")
{
m_proxyAddress = nodeContent;
}
else if (nodeName == "port")
{
m_proxyPort = (unsigned int)atoi(nodeContent.c_str());
}
else if (nodeName == "type")
{
m_proxyType = nodeContent;
}
else if (nodeName == "enable")
{
if (nodeContent == "YES")
{
m_proxyEnabled = true;
}
else
{
m_proxyEnabled = false;
}
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:52,代码来源:PinotSettings.cpp
示例10: loadIndexableLocations
bool PinotSettings::loadIndexableLocations(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
IndexableLocation location;
// Load the indexable location's properties
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "name")
{
location.m_name = nodeContent;
}
else if (nodeName == "monitor")
{
if (nodeContent == "YES")
{
location.m_monitor = true;
}
else
{
location.m_monitor = false;
}
}
}
if (location.m_name.empty() == false)
{
m_indexableLocations.insert(location);
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:52,代码来源:PinotSettings.cpp
示例11: fromXML
void Character::fromXML(const xmlpp::Element &root)
{
using namespace xmlpp;
clearSkills();
Node::NodeList list = root.get_children("skill");
for (Node::NodeList::const_iterator it = list.begin(); it != list.end(); it++)
{
Element *elem = dynamic_cast<Element *>(*it);
string value;
Attribute *attr = elem->get_attribute("value");
if (attr != NULL)
{
value = attr->get_value();
}
vSkills.push_back(value);
}
}
开发者ID:Dramac,项目名称:GM-Assistant,代码行数:18,代码来源:Character.cpp
示例12: loadIndexes
bool PinotSettings::loadIndexes(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
string indexName, indexLocation;
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "name")
{
indexName = nodeContent;
}
else if (nodeName == "location")
{
indexLocation = nodeContent;
}
}
if ((indexName.empty() == false) &&
(indexLocation.empty() == false))
{
addIndex(indexName, indexLocation);
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:44,代码来源:PinotSettings.cpp
示例13: loadColour
bool PinotSettings::loadColour(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
// Load the colour RGB components
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
gushort value = (gushort)atoi(nodeContent.c_str());
if (nodeName == "red")
{
m_newResultsColourRed = value;
}
else if (nodeName == "green")
{
m_newResultsColourGreen = value;
}
else if (nodeName == "blue")
{
m_newResultsColourBlue = value;
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:43,代码来源:PinotSettings.cpp
示例14: loadResults
bool PinotSettings::loadResults(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "viewmode")
{
if (nodeContent == "SOURCE")
{
m_browseResults = false;
}
else
{
m_browseResults = true;
}
}
else if (nodeName == "browser")
{
m_browserCommand = nodeContent;
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:43,代码来源:PinotSettings.cpp
示例15: fromXML
void FileItem::fromXML(const xmlpp::Element &root) throw(xmlpp::exception, invalid_argument, overflow_error)
{
using namespace xmlpp;
Node::NodeList list = root.get_children("file");
string name = "";
if (list.size()==0)
{
throw xmlpp::exception("Missing file name");
}
else
{
Element *tmp = dynamic_cast<Element*>(list.front());
Attribute *attr = tmp->get_attribute("name");
if (attr!=NULL)
{
name = attr->get_value();
}
}
setFileName(name);
}
开发者ID:Dramac,项目名称:GM-Assistant,代码行数:21,代码来源:FileItem.cpp
示例16: getNodeContent
static ustring getNodeContent(const Node *pNode)
{
if (pNode == NULL)
{
return "";
}
// Is it an element ?
const Element *pElem = dynamic_cast<const Element*>(pNode);
if (pElem != NULL)
{
#ifdef HAS_LIBXMLPP026
const TextNode *pText = pElem->get_child_content();
#else
const TextNode *pText = pElem->get_child_text();
#endif
if (pText == NULL)
{
// Maybe the text is given as CDATA
const Node::NodeList childNodes = pNode->get_children();
if (childNodes.size() == 1)
{
// Is it CDATA ?
const CdataNode *pContent = dynamic_cast<const CdataNode*>(*childNodes.begin());
if (pContent != NULL)
{
return pContent->get_content();
}
}
return "";
}
return pText->get_content();
}
return "";
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:38,代码来源:OpenSearchParser.cpp
示例17: getTextFromElement
string XmlReader::getTextFromElement(const Element* elementNode, const string& childName, bool required) const {
string text;
const Node::NodeList children = elementNode->get_children(childName);
if (children.size() == 1) {
const Element *elementChild = castToElement(children.front());
for (const Node *child : elementChild->get_children()) {
const TextNode* textNode = dynamic_cast<const TextNode*>(child);
if (textNode != nullptr) {
if (!textNode->is_white_space())
text += textNode->get_content();
} else {
throw InvalidDatasetFile(caller(), "Invalid cast to 'TextNode*' type!", (child != nullptr ? child->get_line() : -1));
}
}
} else if (children.size() > 1) {
throw InvalidDatasetFile(caller(), "Only from one child the text can be retrieved!", elementNode->get_line());
} else if (children.empty() && required) {
string msg = "Cannot find the '"+string(childName)+"' element!\n";
throw InvalidDatasetFile(caller(), msg+"Invalid input xml file!", elementNode->get_line());
}
return text;
}
开发者ID:CTU-IIG,项目名称:EnergyOptimizatorOfRoboticCells,代码行数:23,代码来源:XmlReader.cpp
示例18: loadEngineChannels
bool PinotSettings::loadEngineChannels(const Element *pElem)
{
if (pElem == NULL)
{
return false;
}
Node::NodeList childNodes = pElem->get_children();
if (childNodes.empty() == true)
{
return false;
}
for (Node::NodeList::iterator iter = childNodes.begin(); iter != childNodes.end(); ++iter)
{
Node *pNode = (*iter);
Element *pElem = dynamic_cast<Element*>(pNode);
if (pElem == NULL)
{
continue;
}
string nodeName = pElem->get_name();
string nodeContent = getElementContent(pElem);
if (nodeName == "name")
{
std::map<string, bool>::iterator channelIter = m_engineChannels.find(nodeContent);
if (channelIter != m_engineChannels.end())
{
channelIter->second = false;
}
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:37,代码来源:PinotSettings.cpp
示例19: iss
/** Process received string. */
void
Msl2010RefBoxProcessor::process_string(char *buf, size_t len)
{
__logger->log_info(__name, "Received\n *****\n %s \n *****", buf);
std::istringstream iss( std::string(buf), std::istringstream::in);
dom = new DomParser();
//dom->set_validate();
dom->set_substitute_entities();
dom->parse_stream(iss);
root = dom->get_document()->get_root_node();
//printf( " root node:\n%s\n", root->get_name().data() );
const Element * el = dynamic_cast<const Element *>(root);
if ( el ) {
/// valid element
//printf("Is valid Element\n");
__logger->log_info(__name, "root-element name is '%s'", el->get_name().data() );
const Node::NodeList nl = el->get_children();
if( nl.size() == 0 ) {
__logger->log_info(__name, "root has NO children!");
}
else {
//printf("root has %u children!\n", nl.size());
for (Node::NodeList::const_iterator it = nl.begin(); it != nl.end(); ++it) {
const Node* node = *it;
__logger->log_info(__name, "1st level child name is '%s'", node->get_name().data() );
//if( node->get_name().data() == REFBOX_GAMEINFO ) {
//
//}
//else if( node->get_name().data() == REFBOX_EVENT ) {
//
//}
//else {
// printf(" unhandled RefboxMessage-type '%s'!\n", node->get_name().data() );
//}
const Node::NodeList cnl = node->get_children();
if( cnl.size() == 0 ) {
__logger->log_info(__name, "child has NO children!");
}
else {
//printf("child has %u children!\n", nl.size());
for (Node::NodeList::const_iterator cit = cnl.begin(); cit != cnl.end(); ++cit) {
const Node* cnode = *cit;
const Element* cel = dynamic_cast<const Element *>(cnode);
std::string cnodename(cnode->get_name().data());
__logger->log_info(__name, "2nd level child name is '%s'", cnode->get_name().data() );
const Attribute* cattr;
std::string cteamcolor;
//std::string cgoalcolor;
//std::string ccardcolor;
std::string cstagetype;
if( cnodename == REFBOX_KICKOFF || cnodename == REFBOX_FREEKICK ||
cnodename == REFBOX_GOALKICK || cnodename == REFBOX_THROWIN ||
cnodename == REFBOX_CORNER || cnodename == REFBOX_PENALTY ||
cnodename == REFBOX_GOAL_AWARDED || cnodename == REFBOX_GOAL_REMOVED ||
cnodename == REFBOX_CARD_AWARDED || cnodename == REFBOX_CARD_REMOVED ||
cnodename == REFBOX_PLAYER_OUT || cnodename == REFBOX_PLAYER_IN ||
cnodename == REFBOX_SUBSTITUTION )
{
cattr = cel->get_attribute("team");
cteamcolor = std::string( cattr->get_value().data() );
}
if( cnodename == REFBOX_CANCEL ) {
// refbox canceled last command
__logger->log_info(__name, "RefBox cancelled last command");
}
else if( cnodename == REFBOX_GAMESTOP ) {
_rsh->set_gamestate(GS_FROZEN, TEAM_BOTH);
}
else if( cnodename == REFBOX_GAMESTART ) {
_rsh->set_gamestate(GS_PLAY, TEAM_BOTH);
}
else if( cnodename == REFBOX_DROPPEDBALL ) {
_rsh->set_gamestate(GS_DROP_BALL, TEAM_BOTH);
}
else if( cnodename == REFBOX_GOAL_AWARDED ) {
// increment according to color
if( cteamcolor == REFBOX_TEAMCOLOR_CYAN ) {
_rsh->set_score(++__score_cyan, __score_magenta);
}
else if ( cteamcolor == REFBOX_TEAMCOLOR_MAGENTA ) {
_rsh->set_score(__score_cyan, ++__score_magenta);
}
_rsh->set_gamestate(GS_FROZEN, TEAM_BOTH);
//.........这里部分代码省略.........
开发者ID:timn,项目名称:fawkes,代码行数:101,代码来源:msl2010.cpp
示例20: parse
bool OpenSearchResponseParser::parse(const ::Document *pResponseDoc, vector<DocumentInfo> &resultsList,
unsigned int &totalResults, unsigned int &firstResultIndex) const
{
float pseudoScore = 100;
unsigned int contentLen = 0;
bool foundResult = false;
if ((pResponseDoc == NULL) ||
(pResponseDoc->getData(contentLen) == NULL) ||
(contentLen == 0))
{
return false;
}
// Make sure the response MIME type is sensible
string mimeType = pResponseDoc->getType();
if ((mimeType.empty() == false) &&
(mimeType.find("xml") == string::npos))
{
cerr << "OpenSearchResponseParser::parse: response is not XML" << endl;
return false;
}
const char *pContent = pResponseDoc->getData(contentLen);
try
{
bool loadFeed = false;
// Parse the configuration file
DomParser parser;
parser.set_substitute_entities(true);
parser.parse_memory_raw((const unsigned char *)pContent, (Parser::size_type)contentLen);
xmlpp::Document *pDocument = parser.get_document();
if (pDocument == NULL)
{
return false;
}
Node *pNode = pDocument->get_root_node();
Element *pRootElem = dynamic_cast<Element *>(pNode);
if (pRootElem == NULL)
{
return false;
}
// Check the top-level element is what we expect
ustring rootNodeName = pRootElem->get_name();
if (m_rssResponse == true)
{
if (rootNodeName == "rss")
{
const Node::NodeList rssChildNodes = pRootElem->get_children();
for (Node::NodeList::const_iterator rssIter = rssChildNodes.begin();
rssIter != rssChildNodes.end(); ++rssIter)
{
Node *pRssNode = (*rssIter);
Element *pRssElem = dynamic_cast<Element*>(pRssNode);
if (pRssElem != NULL)
{
if (pRssElem->get_name() == "channel")
{
pRootElem = pRssElem;
loadFeed = true;
break;
}
}
}
}
}
else
{
if (rootNodeName != "feed")
{
return false;
}
loadFeed = true;
}
if (loadFeed == false)
{
#ifdef DEBUG
cout << "OpenSearchResponseParser::parse: error on root node "
<< rootNodeName << endl;
#endif
return false;
}
// RSS
ustring itemNode("item");
ustring descriptionNode("description");
if (m_rssResponse == false)
{
// Atom
itemNode = "entry";
descriptionNode = "content";
}
// Go through the subnodes
const Node::NodeList childNodes = pRootElem->get_children();
for (Node::NodeList::const_iterator iter = childNodes.begin();
iter != childNodes.end(); ++iter)
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:101,代码来源:OpenSearchParser.cpp
注:本文中的node::NodeList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论