本文整理汇总了C++中poco::xml::Node::getNodeValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::getNodeValue方法的具体用法?C++ Node::getNodeValue怎么用?C++ Node::getNodeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::xml::Node
的用法示例。
在下文中一共展示了Node::getNodeValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAttributeValueByName
/*
* Get attribute's value by name from a Node
*/
std::string LoadGroupXMLFile::getAttributeValueByName(Poco::XML::Node *pNode,
std::string attributename,
bool &found) {
// 1. Init
Poco::AutoPtr<Poco::XML::NamedNodeMap> att = pNode->attributes();
found = false;
std::string value = "";
// 2. Loop to find
for (unsigned long i = 0; i < att->length(); ++i) {
Poco::XML::Node *cNode = att->item(i);
if (cNode->localName().compare(attributename) == 0) {
value = cNode->getNodeValue();
found = true;
break;
}
} // ENDFOR
return value;
}
示例2: getAttribute
string ofXml::getAttribute(const string& path) const {
Poco::XML::Node *e;
if(element) {
if(path.find("[@") == string::npos) {
// we need to create a proper path
string attributePath = "[@" + path + "]";
e = element->getNodeByPath(attributePath);
} else {
e = element->getNodeByPath(path);
}
} else {
ofLogWarning("ofXml") << "getAttribute(): no element set yet";
return "";
}
if(e) {
return e->getNodeValue(); // this will be the value of the attribute
}
return "";
}
示例3: svgtiny_parse_text
svgtiny_code svgtiny_parse_text(Poco::XML::Element *text,
struct svgtiny_parse_state state)
{
float x, y, width, height;
float px, py;
Poco::XML::Element *child;
svgtiny_parse_position_attributes(text, state,
&x, &y, &width, &height);
svgtiny_parse_font_attributes(text, &state);
svgtiny_parse_transform_attributes(text, &state);
px = state.ctm.a * x + state.ctm.c * y + state.ctm.e;
py = state.ctm.b * x + state.ctm.d * y + state.ctm.f;
/* state.ctm.e = px - state.origin_x; */
/* state.ctm.f = py - state.origin_y; */
/*struct css_style style = state.style;
style.font_size.value.length.value *= state.ctm.a;*/
//for (child = text->children; child; child = child->next) {
//for( child = (Poco::XML::Element*) text->FirstChild( false ); child; child = (Poco::XML::Element*) child->NextSibling( false ) ) {
Poco::XML::NodeIterator it(text, Poco::XML::NodeFilter::SHOW_ELEMENT | Poco::XML::NodeFilter::SHOW_TEXT);
Poco::XML::Node* pNode = it.nextNode();
while (pNode) {
svgtiny_code code = svgtiny_OK;
if (pNode->getNodeValue().compare("text") == 0)
{
struct svgtiny_shape *shape = svgtiny_add_shape(&state);
if (!shape)
return svgtiny_OUT_OF_MEMORY;
//shape->text = strdup((const char *) child->content);
shape->text = strdup((const char *) pNode->getNodeValue().c_str());
shape->text_x = px;
shape->text_y = py;
state.diagram->shape_count++;
}
//else if (strcmp((const char *) child->Value(), "tspan") == 0)
else if (pNode->getNodeValue().compare("tspan") == 0)
{
code = svgtiny_parse_text(child, state);
}
pNode = it.nextNode();
if (code == svgtiny_OK)
return code;
}
return svgtiny_OK;
}