本文整理汇总了C++中DOMNode::getLastChild方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::getLastChild方法的具体用法?C++ DOMNode::getLastChild怎么用?C++ DOMNode::getLastChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::getLastChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: previousNode
DOMNode* DOMNodeIteratorImpl::previousNode (DOMNode* node) {
if (fDetached)
throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);
DOMNode* result = 0;
// if we're at the root, return 0.
if (node == fRoot)
return 0;
// get sibling
result = node->getPreviousSibling();
if (!result) {
//if 1st sibling, return parent
result = node->getParentNode();
return result;
}
// if sibling has children, keep getting last child of child.
if (result->hasChildNodes()) {
while ((fExpandEntityReferences || result->getNodeType()!=DOMNode::ENTITY_REFERENCE_NODE) &&
result->hasChildNodes()) {
result = result->getLastChild();
}
}
return result;
}
示例2: ApplyDelta
void DeltaApplyEngine::ApplyDelta(XID_DOMDocument *IncDeltaDoc, int backwardNumber) {
DOMNode* deltaRoot = IncDeltaDoc->getDocumentElement(); // <delta_unit>
DOMNode* deltaElement ;
for ( deltaElement = deltaRoot->getLastChild(); backwardNumber > 0; deltaElement = deltaElement->getPreviousSibling(), backwardNumber-- ) {
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(gLS);
DOMDocument* backwardDeltaDoc = impl->createDocument(0, XMLString::transcode(""),0);
//DOMDocument* backwardDeltaDoc = DOMDocument::createDocument();
DOMNode* backwardDeltaElement = XyDelta::ReverseDelta(backwardDeltaDoc, deltaElement);
ApplyDeltaElement(backwardDeltaElement);
}
}
示例3: main
//.........这里部分代码省略.........
DOMText* E210 = doc->createTextNode(xInsertedText);
DOMNode* rt = doc->getDocumentElement();
DOMRange* range = ((DOMDocumentRange*)doc)->createRange();
//Tests start here
// Initial dom tree looks like :
// <Body><H1>TitleAnother Text</H1><P>Blah xyz</P></Body>
//i.e., Body(rt)
// _____________|________________
// | |
// ___H1(E11)___ P(E12)
// | | |
// "Title" "Another Text" "Blah xyz"
//test for start and end settings of a range
range->setStart(rt->getFirstChild(), 0);
TASSERT(range->getStartContainer() == rt->getFirstChild() );
TASSERT(range->getStartOffset() == 0);
range->setEnd(rt->getFirstChild(), 1);
TASSERT(range->getEndContainer() == rt->getFirstChild() );
TASSERT(range->getEndOffset() == 1);
//DOMNode* node = range->getCommonAncestorContainer();
TASSERT(range->getCommonAncestorContainer() == rt->getFirstChild());
//selection related test
range->selectNode(rt->getLastChild());
TASSERT(range->getStartContainer() == rt);
TASSERT(range->getStartOffset() == 1);
TASSERT(range->getEndContainer() == rt);
TASSERT(range->getEndOffset() == 2);
//insertion related tests
range->insertNode(E120);
//only end offset moves and new node gets into range as being inserted at boundary point
TASSERT(range->getStartContainer() == rt);
TASSERT(range->getStartOffset() == 1);
TASSERT(range->getEndContainer() == rt);
TASSERT(range->getEndOffset() == 3);
range->insertNode(E121);
//only end offset moves and new node gets into range as being inserted at boundary point
TASSERT(range->getStartContainer() == rt);
TASSERT(range->getStartOffset() == 1);
TASSERT(range->getEndContainer() == rt);
TASSERT(range->getEndOffset() == 4);
rt->insertBefore(E122, rt->getFirstChild());
//both offsets move as new node is not part of the range
TASSERT(range->getStartContainer() == rt);
TASSERT(range->getStartOffset() == 2);
TASSERT(range->getEndContainer() == rt);
TASSERT(range->getEndOffset() == 5);
//After above operations, now the tree looks like:
// <Body><Element3/><H1>TitleAnother Text</H1><Element2/><Element1/><P>Blah xyz</P></Body>
//i.e., Body(rt)
// _____________|_______________________________________________________________