本文整理汇总了C++中DOMNode::getPreviousSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::getPreviousSibling方法的具体用法?C++ DOMNode::getPreviousSibling怎么用?C++ DOMNode::getPreviousSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::getPreviousSibling方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getText
string XmlElement::getText() const { // return the empty string if there is no text
DOMNode* first = base->getFirstChild();
while(first) {
if (first->getNodeType() == 3) {
char* ctext (XMLString::transcode(first->getNodeValue()));
string text(ctext);
XMLString::release(&ctext);
return text;
}
first = first->getPreviousSibling();
}
return string();
}
示例2: unrollList
void SortDeleteOperationsEngine::unrollList(XID_DOMDocument *sourceDoc, DOMNode *node) {
if (node->hasChildNodes()) {
DOMNode* child = node->getLastChild();
while(child!=NULL) {
unrollList(sourceDoc, child);
child=child->getPreviousSibling();
}
}
XID_t myXid = sourceDoc->getXidMap().getXIDbyNode(node);
std::map<XID_t, DOMNode*>::iterator p = operationBySourceNode.find((long)myXid);
if (p!=operationBySourceNode.end()) theList.push_back(p->second);
}
示例3: setText
void XmlElement::setText(const string& text) {
assert(doc != NULL && "Attempt to create text on a root node");
DOMNode* first = base->getFirstChild();
bool found = false;
while(first && !found) {
if (first->getNodeType() == 3) {
first->setTextContent(toUnicode(text));
found = true;
}
first = first->getPreviousSibling();
}
if (!found) {
DOMText* textNode = doc->createTextNode(toUnicode(text));
base->appendChild(textNode);
}
}
示例4: getPreviousLogicalSibling
// Returns the previous logical sibling with respect to the given node.
DOMNode* DOMElementImpl::getPreviousLogicalSibling(const DOMNode* n) const
{
DOMNode* prev = n->getPreviousSibling();
// If "n" has no previous sibling and its parent is an entity reference node we
// need to continue the search through the previous siblings of the entity
// reference as these are logically siblings of the given node.
if (prev == NULL) {
DOMNode* parent = n->getParentNode();
while (parent != NULL && parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) {
prev = parent->getPreviousSibling();
if (prev != NULL) {
break;
}
parent = parent->getParentNode();
}
}
return prev;
}
示例5: IConfigItemPtr
SYSTEM::IConfigItemPtr SYSTEM::CConfigItem::GetLastChild()
{
DOMNode *LastChild = ((DOMElement*)itemElement)->getLastChild();
if(LastChild == NULL)
return NULL;
while(LastChild != NULL && LastChild->getNodeType() == DOMNode::TEXT_NODE)
LastChild = LastChild->getPreviousSibling();
if(LastChild == NULL)
return NULL;
CConfigItem* item = new CConfigItem;
item->itemElement = LastChild;
item->doc = doc;
return IConfigItemPtr((IConfigItem*)item);
}
示例6: getLastChild
DOMElement * DOMElementImpl::getLastElementChild() const
{
DOMNode* n = getLastChild();
while (n != NULL) {
switch (n->getNodeType()) {
case DOMNode::ELEMENT_NODE:
return (DOMElement*) n;
case DOMNode::ENTITY_REFERENCE_NODE:
{
DOMElement* e = getLastElementChild(n);
if (e != NULL)
return e;
}
break;
default:
break;
}
n = n->getPreviousSibling();
}
return NULL;
}
示例7: while
DOMComment *XmlParser::getCommentNode(DOMElement *element) {
DOMNode *node = element;
do {
node = node->getPreviousSibling();
if (node == NULL) {
// cerr << "getCommentNode() - no prior comment sibling\n";
return NULL;
}
} while (node->getNodeType() == DOMNode::TEXT_NODE);
DOMComment *el = NULL;
if (node->getNodeType() == DOMNode::COMMENT_NODE) {
el = dynamic_cast< xercesc::DOMComment* >( node );
if (el == NULL) {
cerr << "getCommentNode() - cast failed\n";
}
}
else {
// cerr << "getCommentNode() - no comment found - type :" << node->getNodeType() << endl;
}
return el;
}
示例8: 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);
}
}