本文整理汇总了C++中poco::xml::Node::nextSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::nextSibling方法的具体用法?C++ Node::nextSibling怎么用?C++ Node::nextSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::xml::Node
的用法示例。
在下文中一共展示了Node::nextSibling方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseRuninfo
/**
* Parse the runinfo file to find the names of the neutron event files.
*
* @param runinfo Runinfo file with full path.
* @param dataDir Directory where the runinfo file lives.
* @param eventFilenames vector of all possible event files. This is filled by
*the algorithm.
*/
void LoadPreNexus::parseRuninfo(const string &runinfo, string &dataDir,
vector<string> &eventFilenames) {
eventFilenames.clear();
// Create a Poco Path object for runinfo filename
Poco::Path runinfoPath(runinfo, Poco::Path::PATH_GUESS);
// Now lets get the directory
Poco::Path dirPath(runinfoPath.parent());
dataDir = dirPath.absolute().toString();
g_log.debug() << "Data directory \"" << dataDir << "\"\n";
std::ifstream in(runinfo.c_str());
Poco::XML::InputSource src(in);
Poco::XML::DOMParser parser;
Poco::AutoPtr<Poco::XML::Document> pDoc = parser.parse(&src);
Poco::XML::NodeIterator it(pDoc, Poco::XML::NodeFilter::SHOW_ELEMENT);
Poco::XML::Node *pNode = it.nextNode(); // root node
while (pNode) {
if (pNode->nodeName() == "RunInfo") // standard name for this type
{
pNode = pNode->firstChild();
while (pNode) {
if (pNode->nodeName() == "FileList") {
pNode = pNode->firstChild();
while (pNode) {
if (pNode->nodeName() == "DataList") {
pNode = pNode->firstChild();
while (pNode) {
if (pNode->nodeName() == "scattering") {
Poco::XML::Element *element =
static_cast<Poco::XML::Element *>(pNode);
eventFilenames.push_back(element->getAttribute("name"));
}
pNode = pNode->nextSibling();
}
} else // search for DataList
pNode = pNode->nextSibling();
}
} else // search for FileList
pNode = pNode->nextSibling();
}
} else // search for RunInfo
pNode = pNode->nextSibling();
}
// report the results to the log
if (eventFilenames.size() == 1) {
g_log.debug() << "Found 1 event file: \"" << eventFilenames[0] << "\"\n";
} else {
g_log.debug() << "Found " << eventFilenames.size() << " event files:";
for (auto &eventFilename : eventFilenames) {
g_log.debug() << "\"" << eventFilename << "\" ";
}
g_log.debug() << "\n";
}
}
示例2: removeContents
bool ofXml::removeContents() {
if(element && element->hasChildNodes())
{
Poco::XML::Node* swap;
Poco::XML::Node* n = element->firstChild();
while(n->nextSibling() != nullptr)
{
swap = n->nextSibling();
element->removeChild(n);
n = swap;
}
return true;
}
return false;
}
示例3:
Poco::XML::Node* XMLConfiguration::findElement(const std::string& name, Poco::XML::Node* pNode, bool create)
{
Poco::XML::Node* pChild = pNode->firstChild();
while (pChild)
{
if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE && pChild->nodeName() == name)
return pChild;
pChild = pChild->nextSibling();
}
if (create)
{
Poco::AutoPtr<Poco::XML::Element> pElem = pNode->ownerDocument()->createElement(name);
pNode->appendChild(pElem);
return pElem;
}
else return 0;
}
开发者ID:babafall,项目名称:Sogeti-MasterThesis-CrossPlatformMobileDevelopment,代码行数:17,代码来源:XMLConfiguration.cpp
示例4: result
Expression::Pointer
StandardElementHandler::Create(ExpressionConverter* converter, Poco::XML::Element* element)
{
std::string name= element->nodeName();
if (ExpressionTagNames::INSTANCEOF == name) {
Expression::Pointer result(new InstanceofExpression(element));
return result;
} else if (ExpressionTagNames::TEST == name) {
Expression::Pointer result(new TestExpression(element));
return result;
} else if (ExpressionTagNames::OR == name) {
CompositeExpression::Pointer result(new OrExpression());
this->ProcessChildren(converter, element, result);
return result;
} else if (ExpressionTagNames::AND == name) {
CompositeExpression::Pointer result(new AndExpression());
this->ProcessChildren(converter, element, result);
return result;
} else if (ExpressionTagNames::NOT == name) {
Poco::XML::Node* child = element->firstChild();
while (child != 0) {
if (child->nodeType() == Poco::XML::Node::ELEMENT_NODE) {
Expression::Pointer result(new NotExpression(converter->Perform(static_cast<Poco::XML::Element*>(child))));
return result;
}
child = child->nextSibling();
}
} else if (ExpressionTagNames::WITH == name) {
CompositeExpression::Pointer result(new WithExpression(element));
this->ProcessChildren(converter, element, result);
return result;
} else if (ExpressionTagNames::ADAPT == name) {
CompositeExpression::Pointer result(new AdaptExpression(element));
this->ProcessChildren(converter, element, result);
return result;
} else if (ExpressionTagNames::ITERATE == name) {
CompositeExpression::Pointer result(new IterateExpression(element));
this->ProcessChildren(converter, element, result);
return result;
} else if (ExpressionTagNames::COUNT == name) {
Expression::Pointer result(new CountExpression(element));
return result;
} else if (ExpressionTagNames::SYSTEM_TEST == name) {
Expression::Pointer result(new SystemTestExpression(element));
return result;
} else if (ExpressionTagNames::RESOLVE == name) {
CompositeExpression::Pointer result(new ResolveExpression(element));
this->ProcessChildren(converter, element, result);
return result;
} else if (ExpressionTagNames::ENABLEMENT == name) {
CompositeExpression::Pointer result(new EnablementExpression(element));
this->ProcessChildren(converter, element, result);
return result;
} else if (ExpressionTagNames::EQUALS == name) {
Expression::Pointer result(new EqualsExpression(element));
return result;
} else if (ExpressionTagNames::REFERENCE == name) {
Expression::Pointer result(new ReferenceExpression(element));
return result;
}
return Expression::Pointer();
}