本文整理汇总了C++中DOMNode::normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::normalize方法的具体用法?C++ DOMNode::normalize怎么用?C++ DOMNode::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::normalize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_bml_event
BehaviorRequestPtr BML::parse_bml_event( DOMElement* elem, const std::string& unique_id, BehaviorSyncPoints& behav_syncs, bool required, BmlRequestPtr request, SmartBody::SBScene* scene ) {
const XMLCh* tag = elem->getTagName();
// message (the event behavior) can be retrieved either via the attribute, or via the text content.
std::string msg = xml_parse_string( BMLDefs::ATTR_MESSAGE, elem, "");
std::string spNameOld = xml_parse_string( BMLDefs::ATTR_STROKE, elem, ""); // if 'stroke' is used, assume old-style command sent via VHMSG
std::string spNameNew = xml_parse_string( BMLDefs::ATTR_START, elem, ""); // if 'start' is used, assume Python style internally only
std::string localId = xml_parse_string( BMLDefs::ATTR_ID, elem, "");
DOMNode* child = elem->getFirstChild();
while (child)
{
DOMNode::NodeType type = child->getNodeType();
if (type == DOMNode::CDATA_SECTION_NODE)
{
child->normalize();
DOMText* textNode = dynamic_cast<DOMText*>(child);
const XMLCh* messageData = textNode->getNodeValue();
msg = xml_utils::xml_translate_string(messageData);
break;
}
child = child->getNextSibling();
}
if (msg != "" )
{
if (spNameNew.size() > 0)
{
// new style event sent via Python
return BehaviorRequestPtr( new EventRequest( unique_id, localId, "", msg, behav_syncs, spNameNew ) );
}
else
{
// old style command send via vhmsg
return BehaviorRequestPtr( new EventRequest( unique_id, localId, msg, "", behav_syncs, spNameOld ) );
}
}
else
{
xml_parse_error( BMLDefs::ATTR_MESSAGE, elem );
return BehaviorRequestPtr(); // a.k.a., NULL
}
}