本文整理汇总了C++中poco::xml::Node::attributes方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::attributes方法的具体用法?C++ Node::attributes怎么用?C++ Node::attributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::xml::Node
的用法示例。
在下文中一共展示了Node::attributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: it
std::map<std::string, std::string>
XmlHandler::get_attributes_from_tag(const std::string &xpath) {
std::map<std::string, std::string> attributes_map;
Poco::XML::NodeIterator it(pDoc, Poco::XML::NodeFilter::SHOW_ELEMENT);
Poco::XML::Node *pNode = it.nextNode();
Poco::XML::Node *detectorNode = pNode->getNodeByPath(xpath);
if (detectorNode) {
Poco::XML::NamedNodeMap *attributes = detectorNode->attributes();
for (unsigned int i = 0; i < attributes->length(); i++) {
Poco::XML::Node *attribute = attributes->item(i);
attributes_map.emplace(attribute->nodeName(), attribute->nodeValue());
}
}
return attributes_map;
}
示例2: load
bool Configure::load(void)
{
std::ifstream in(SystemInfo::instance().getExecutePath() + "\\config\\sys.xml");
Poco::XML::InputSource src(in);
Poco::XML::DOMParser parser;
try
{
Poco::AutoPtr<Poco::XML::Document> pDoc = parser.parse(&src);
Poco::XML::NodeIterator it(pDoc, Poco::XML::NodeFilter::SHOW_ALL);
Poco::XML::Node* pNode = it.nextNode();
while (pNode)
{
if(pNode->nodeName() == "EncodChannel")
{
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
m_encodeChannel = pNode->nodeValue();
Poco::XML::XMLString tt = Poco::XML::toXMLString(m_encodeChannel);
}
if(pNode->nodeName() == "InputTSPath")
{
getNetWorkPathAttr(pNode->attributes(),&m_inputTSPath);
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
m_inputTSPath.path = pNode->nodeValue();
m_inputTSPath.objectName = "o:";
}
if(pNode->nodeName() == "InputXMLPath")
{
getNetWorkPathAttr(pNode->attributes(),&m_inputXMLPath);
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
m_inputXMLPath.path = pNode->nodeValue();
m_inputXMLPath.objectName = "p:";
}
if(pNode->nodeName() == "OutputTSPath")
{
getNetWorkPathAttr(pNode->attributes(),&m_outputTSPath);
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
m_outputTSPath.path = pNode->nodeValue();
m_outputTSPath.objectName = "q:";
}
if(pNode->nodeName() == "OutputXMLPath")
{
getNetWorkPathAttr(pNode->attributes(),&m_outputXMLPath);
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
m_outputXMLPath.path = pNode->nodeValue();
m_outputXMLPath.objectName = "r:";
}
if(pNode->nodeName() == "OutputStream1")
{
getOutputStreamAttr(pNode->attributes(),&m_outputStream[0]);
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
}
if(pNode->nodeName() == "OutputStream2")
{
getOutputStreamAttr(pNode->attributes(),&m_outputStream[1]);
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
}
if(pNode->nodeName() == "OutputStream3")
{
getOutputStreamAttr(pNode->attributes(),&m_outputStream[2]);
pNode = it.nextNode();
if(pNode->nodeName() != "#text")
{
continue; //No text node present
}
//.........这里部分代码省略.........