本文整理汇总了C++中DOMElement::replaceChild方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMElement::replaceChild方法的具体用法?C++ DOMElement::replaceChild怎么用?C++ DOMElement::replaceChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::replaceChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAttrib
bool XMLParserThread::
xmlParseZoomSettingsRequest( DOMNode* cur, DOMNode* out,
DOMDocument* reply, bool indent ) {
DOMElement* root = XMLUtility::createStandardReply( *reply, *cur,
"zoom_settings_reply" );
out->appendChild( root );
using XMLTool::getAttrib;
uint32 pixelSize = CylindricalProjection::NBR_PIXELS;
getAttrib( pixelSize, "pixel_size", cur, pixelSize );
if ( ! CylindricalProjection::isValidPixelSize( pixelSize ) ){
pixelSize = CylindricalProjection::NBR_PIXELS;
}
XMLZoomSettings::createReplyBody( *root, pixelSize, getClientSetting() );
// now we have created a zoom_settings_reply body, we need
// to check crc against the zoom_settings_request
//
// returns crc_ok if they match instead of entire zoom
// settings body
MC2String crcReceived;
getAttrib( crcReceived, "crc", cur, MC2String() );
MC2String crcCreated;
try {
getAttrib( crcCreated, "crc", XMLTool::findNode(
root, "zoom_levels" ) );
} catch ( const XMLTool::Exception& e ) {
mc2log << fatal
<< "xmlParseZoomSettingsRequest: No crc in created xml!" << endl;
MC2_ASSERT( false );
}
if ( crcCreated == crcReceived ) {
// first child must be zoom_levels
DOMNode* zoom_levels = XMLTool::findNode(
root, "zoom_levels" );
if ( ! XMLString::equals( zoom_levels->getNodeName(), "zoom_levels" ) ) {
mc2log << fatal << "[ZoomRequest] first child is not zoom levels!" << endl;
MC2_ASSERT( false );
}
// replace zoom_levels with crc_ok
root->replaceChild( reply->createElement( X( "crc_ok" ) ),
zoom_levels );
}
if ( indent ) {
XMLUtility::indentPiece( *root, 1 );
}
return true;
}