各位老板,想问一下,用tinyxml2怎么实现两个xml文本间的节点拷贝问题。
tinyxml2::XMLNode* elmtRoot = docXmltestPJ.FirstChild();
tinyxml2::XMLNode* elmtnode = elmtRoot->FirstChild();
vernier=elmtnode;
tinyxml2::XMLNode* copy = node->ShallowClone(&docXmlCommand);
docXmltestPJ.InsertAfterChild(vernier, copy);
在最后INsertAfterChild是函数总是报错,对两个参数的判断都是通不过。不知道是为什么
InsertAfterChild函数原型如下:
XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis )
{
TIXMLASSERT( addThis );
if ( addThis->_document != _document ) {
TIXMLASSERT( false );
return 0;
}
TIXMLASSERT( afterThis );
if ( afterThis->_parent != this ) {
TIXMLASSERT( false );
return 0;
}
addThis->_document != _document 和afterThis->_parent != this判断都是不对的,不知道该怎么写