本文整理汇总了C++中PendingUpdate::getTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ PendingUpdate::getTarget方法的具体用法?C++ PendingUpdate::getTarget怎么用?C++ PendingUpdate::getTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PendingUpdate
的用法示例。
在下文中一共展示了PendingUpdate::getTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyReplaceElementContent
void XercesUpdateFactory::applyReplaceElementContent(const PendingUpdate &update, DynamicContext *context)
{
const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
DOMElement *domnode = (DOMElement*)nodeImpl->getDOMNode();
// 1. For each node $C that is a child of $target, the parent property of $C is set to empty.
DOMNode *child = domnode->getFirstChild();
while(child != 0) {
forDeletion_.insert(child);
child = child->getNextSibling();
}
const XMLCh *value = update.getValue().first()->asString(context);
if(value != 0 && *value != 0) {
// 2. The parent property of $text is set to $target.
// 3a. children is set to consist exclusively of $text. If $text is an empty sequence, then $target has
// no children.
// 3b. typed-value and string-value are set to the content property of $text. If $text is an empty sequence,
// then typed-value is an empty sequence and string-value is an empty string.
domnode->appendChild(domnode->getOwnerDocument()->createTextNode(value));
}
// 3c. upd:removeType($target) is invoked.
removeType(domnode);
addToPutSet(update.getTarget(), &update, context);
}
示例2: applyDelete
void XercesUpdateFactory::applyDelete(const PendingUpdate &update, DynamicContext *context)
{
const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
DOMNode *domnode = const_cast<DOMNode*>(nodeImpl->getDOMNode());
forDeletion_.insert(domnode);
addToPutSet(update.getTarget(), &update, context);
}
示例3: applyReplaceValue
void DbXmlUpdateFactory::applyReplaceValue(const PendingUpdate &update, DynamicContext *context)
{
const DbXmlNodeImpl *target = (const DbXmlNodeImpl*)update.getTarget().get();
if (!target->isUpdateAble())
return;
// This is slow, but effective...
// Create a new node with the replaced value and
// treat this like replaceNode
// This is ok because text and attribute nodes have no identity
DbXmlFactoryImpl *factory = (DbXmlFactoryImpl*)context->getItemFactory();
Node::Ptr newNode;
const XMLCh *value = update.getValue().first()->asString(context);
switch (target->getNodeType()) {
case nsNodeAttr: {
newNode = factory->
createAttrNode(target->getPrefix(),
target->getUri(),
target->getLocalName(),
value,
0, 0, // type name and URI
0, 0, NsNid(), 0, // cont, doc, nid, index
context);
break;
}
case nsNodeText:
case nsNodeComment:
case nsNodeCDATA: {
newNode = factory->
createTextNode(target->getNodeType(), value, context);
break;
}
case nsNodePinst: {
newNode = factory->
createPINode(target->getPITarget(), value, context);
break;
}
default:
DBXML_ASSERT(false);
break;
}
// now, replace...
Sequence seq(newNode);
PendingUpdate pu(PendingUpdate::REPLACE_NODE,
update.getTarget(),
seq,
&update);
if (target->getNodeType() == nsNodeAttr)
applyReplaceAttribute(pu, context);
else
applyReplaceNode(pu, context);
}
示例4: applyReplaceElementContent
void DbXmlUpdateFactory::applyReplaceElementContent(const PendingUpdate &update, DynamicContext *context)
{
const DbXmlNodeImpl *target = (const DbXmlNodeImpl*)update.getTarget().get();
// TBD: this check is commented out... need to re-check why.
// if (!target->isUpdateAble())
// return;
// use child axis to create nodes to mark for delete
DbXmlChildAxis children(0, target, 0);
Item::Ptr item;
while((item = children.next(context)).notNull()) {
const DbXmlNodeImpl *child = (const DbXmlNodeImpl*)item->
getInterface(DbXmlNodeImpl::gDbXml);
forDeletion_.insert(child);
}
// insert new content
const XMLCh *value = update.getValue().first()->asString(context);
if(value != 0 && *value != 0) {
// create text node
DbXmlConfiguration *conf = GET_CONFIGURATION(context);
OperationContext &oc = conf->getOperationContext();
Document *document = const_cast<Document*>(target->getDocument());
Node::Ptr content = ((DbXmlFactoryImpl*)context->getItemFactory())->
createTextNode(nsNodeText, value, context);
update_.insertText(*(const DbXmlNodeImpl*)content->
getInterface(DbXmlNodeImpl::gDbXml),
*target, 0,
*document, oc, context);
}
}
示例5: applyRename
void XercesUpdateFactory::applyRename(const PendingUpdate &update, DynamicContext *context)
{
const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
DOMNode *domnode = const_cast<DOMNode*>(nodeImpl->getDOMNode());
ATQNameOrDerived *qname = (ATQNameOrDerived*)update.getValue().first().get();
if(domnode->getNodeType() == DOMNode::PROCESSING_INSTRUCTION_NODE) {
DOMProcessingInstruction *newPI = domnode->getOwnerDocument()->
createProcessingInstruction(qname->getName(), domnode->getNodeValue());
domnode->getParentNode()->replaceChild(newPI, domnode);
domnode = newPI;
}
else {
// If $newName has an implied namespace binding that conflicts with an existing namespace binding
// in the namespaces property of $target, a dynamic error is raised [err:XUDY0024].
// If $target has a parent, and $newName has an implied namespace binding that conflicts with a
// namespace binding in the namespaces property of parent($target), a dynamic error is raised [err:XUDY0024].
domnode->getOwnerDocument()->renameNode(domnode, qname->getURI(), qname->getName());
if(qname->getURI() != 0 && *qname->getURI() != 0)
domnode->setPrefix(qname->getPrefix());
removeType(domnode);
}
// Deliberately create a new XercesNodeImpl, since the PI is actually
// replaced, not just renamed, meaning it is no longer attached to the tree
addToPutSet(nodeImpl, &update, context);
}
示例6: applyPut
void DbXmlUpdateFactory::applyPut(const PendingUpdate &update, DynamicContext *context)
{
DbXmlUri uri(update.getValue().first()->
asString(context), true);
if (uri.isDbXmlScheme()) {
const DbXmlNodeImpl *content =
(const DbXmlNodeImpl*)update.getTarget().get();
string cname = uri.getContainerName();
string docname = uri.getDocumentName();
DbXmlConfiguration *conf = GET_CONFIGURATION(context);
XmlManager &mgr = conf->getManager();
XmlContainer cont = ((Manager&)mgr).getOpenContainer(cname);
if (cont.isNull()) {
string msg = "Target container for fn:put -- ";
msg += cname;
msg += " -- must be open";
throw XmlException(XmlException::INVALID_VALUE,
msg);
}
OperationContext &oc = conf->getOperationContext();
XmlDocument doc = mgr.createDocument();
doc.setName(docname);
XmlEventReader *reader =
(XmlEventReader*)content->getEventReader(context);
DBXML_ASSERT(reader);
doc.setContentAsEventReader(*reader);
XmlUpdateContext uc = mgr.createUpdateContext();
// use internal interface to avoid additional transaction
int err = ((Container &)cont).addDocumentInternal(oc.txn(), doc, uc, 0);
if (err != 0)
throw XmlException(err);
}
}
示例7: applyInsertAttributes
void DbXmlUpdateFactory::applyInsertAttributes(const PendingUpdate &update, DynamicContext *context)
{
const DbXmlNodeImpl *parent = (const DbXmlNodeImpl*)update.getTarget().get();
if (!parent->isUpdateAble())
return;
insertAttributes(update, parent, context);
}
示例8: applyInsertInto
void DbXmlUpdateFactory::applyInsertInto(const PendingUpdate &update, DynamicContext *context)
{
const DbXmlNodeImpl *parent = (const DbXmlNodeImpl*)update.getTarget().get();
if (!parent->isUpdateAble())
return;
// 0 for next implies append
applyInserts(update, parent, 0, context, false);
}
示例9: renamePI
void DbXmlUpdateFactory::renamePI(const PendingUpdate &update,
const XMLCh *name,
DynamicContext *context)
{
DbXmlFactoryImpl *factory = (DbXmlFactoryImpl*)context->getItemFactory();
// create new attribute, using new name, old value
Node::Ptr newNode = factory->createPINode(
name,
((const DbXmlNodeImpl*)update.getTarget().get())->getValue(),
context);
// now, replace...
Sequence seq(newNode);
PendingUpdate pu(PendingUpdate::REPLACE_NODE,
update.getTarget(),
seq,
&update);
applyReplaceNode(pu, context);
}
示例10: applyInsertAsLast
void DbXmlUpdateFactory::applyInsertAsLast(const PendingUpdate &update, DynamicContext *context)
{
// NOTE: this is the same as applyInsertInto, which
// is implemented as append
const DbXmlNodeImpl *parent = (const DbXmlNodeImpl*)update.getTarget().get();
if (!parent->isUpdateAble())
return;
// 0 for next implies append
applyInserts(update, parent, 0, context, false);
}
示例11: applyInsertAfter
void XercesUpdateFactory::applyInsertAfter(const PendingUpdate &update, DynamicContext *context)
{
const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
DOMNode *domnode = const_cast<DOMNode*>(nodeImpl->getDOMNode());
DOMNode *before = domnode->getNextSibling();
Node::Ptr parentNode = nodeImpl->dmParent(context);
DOMNode *parent = domnode->getParentNode();
DOMDocument *doc = const_cast<DOMDocument*>(XPath2Utils::getOwnerDoc(domnode));
bool untyped = parentNode->dmNodeKind() == Node::element_string &&
XPath2Utils::equals(parentNode->getTypeName(), DocumentCache::g_szUntyped) &&
XPath2Utils::equals(parentNode->getTypeURI(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA);
bool containsElementOrText = false;
Result children = update.getValue();
Item::Ptr item;
while((item = children->next(context)).notNull()) {
const XercesNodeImpl *childImpl = (const XercesNodeImpl*)item->getInterface(Item::gXQilla);
DOMNode *newChild = importNodeFix(doc, const_cast<DOMNode*>(childImpl->getDOMNode()), /*deep*/true);
if(childImpl->dmNodeKind() == Node::element_string ||
childImpl->dmNodeKind() == Node::text_string) {
containsElementOrText = true;
}
// If the type-name property of parent($target) is xs:untyped, then upd:setToUntyped() is invoked on each
// element or attribute node in $content.
if(!untyped) setTypes(newChild, childImpl->getDOMNode());
// For each node in $content, the parent property is set to parent($target).
// The children property of parent($target) is modified to add the nodes in $content just before $target,
// preserving their order.
parent->insertBefore(newChild, before);
}
// If at least one of the nodes in $content is an element or text node, upd:removeType(parent($target)) is invoked.
if(containsElementOrText) {
removeType(parent);
}
addToPutSet(update.getTarget(), &update, context);
}
示例12: renameAttribute
void DbXmlUpdateFactory::renameAttribute(const PendingUpdate &update,
ATQNameOrDerived *qname,
DynamicContext *context)
{
DbXmlFactoryImpl *factory = (DbXmlFactoryImpl*)context->getItemFactory();
// create new attribute, using new name, old value
Node::Ptr newNode = factory->createAttrNode(
(qname->getURI() ? qname->getPrefix() : 0),
qname->getURI(),
qname->getName(),
((const DbXmlNodeImpl*)update.getTarget().get())->getValue(),
0, 0, // type name and URI
0, 0, NsNid(), 0, // cont, doc, nid, index
context);
// now, replace...
Sequence seq(newNode);
PendingUpdate pu(PendingUpdate::REPLACE_NODE,
update.getTarget(),
seq,
&update);
applyReplaceAttribute(pu, context);
}
示例13: applyInsertBefore
void DbXmlUpdateFactory::applyInsertBefore(const PendingUpdate &update, DynamicContext *context)
{
const DbXmlNodeImpl *next = (const DbXmlNodeImpl*)update.getTarget().get();
if (!next->isUpdateAble())
return;
Node::Ptr parent = next->dmParent(context);
NsDomNodeRef nextRef = next->getNsDomNode();
applyInserts(update,
(const DbXmlNodeImpl *)parent->getInterface(DbXmlNodeImpl::gDbXml),
nextRef.get(),
context,
false);
}
示例14: applyInsertAsFirst
void DbXmlUpdateFactory::applyInsertAsFirst(const PendingUpdate &update, DynamicContext *context)
{
const DbXmlNodeImpl *parent = (const DbXmlNodeImpl*)update.getTarget().get();
if (!parent->isUpdateAble())
return;
NsDomNodeRef parentRef = parent->getNsDomNode();
NsDomNodeRef nextRef = parentRef->getNsFirstChild();
if (!nextRef.get()) {
DbXmlConfiguration *conf = GET_CONFIGURATION(context);
parentRef->refreshNode(conf->getOperationContext(), true);
nextRef = parentRef->getNsFirstChild();
}
applyInserts(update, parent, nextRef.get(), context, true);
}
示例15: applyReplaceValue
void XercesUpdateFactory::applyReplaceValue(const PendingUpdate &update, DynamicContext *context)
{
const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
DOMNode *domnode = const_cast<DOMNode*>(nodeImpl->getDOMNode());
// 2. If $target is a text, comment, or processing instruction node: content of $target is set to $string-value.
domnode->setNodeValue(update.getValue().first()->asString(context));
if(domnode->getNodeType() == DOMNode::ATTRIBUTE_NODE) {
// 1. If $target is an attribute node:
// a. string-value of $target is set to $string-value. (done above)
// b. upd:removeType($target) is invoked.
removeType(domnode);
}
else if(domnode->getNodeType() == DOMNode::TEXT_NODE ||
domnode->getNodeType() == DOMNode::CDATA_SECTION_NODE) {
// 3. If $target is a text node, upd:removeType(parent($target)) is invoked.
if(domnode->getParentNode() != 0)
removeType(domnode->getParentNode());
}
addToPutSet(update.getTarget(), &update, context);
}