本文整理汇总了C++中node::Ptr::notNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::notNull方法的具体用法?C++ Ptr::notNull怎么用?C++ Ptr::notNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node::Ptr
的用法示例。
在下文中一共展示了Ptr::notNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createUpdateList
PendingUpdateList URename::createUpdateList(DynamicContext *context) const
{
Node::Ptr node = (Node*)target_->createResult(context)->next(context).get();
if(node->dmNodeKind() != Node::element_string &&
node->dmNodeKind() != Node::attribute_string &&
node->dmNodeKind() != Node::processing_instruction_string)
XQThrow(XPath2TypeMatchException,X("URename::createUpdateList"),
X("It is a type error for the target expression of a rename expression not to be a single element, "
"attribute or processing instruction [err:XUTY0012]"));
ATQNameOrDerived::Ptr qname = (ATQNameOrDerived*)name_->createResult(context)->next(context).get();
// 3. The following checks are performed for error conditions:
// a. If $target is an element node, the "namespaces" property of $target must not include any namespace binding that conflicts
// with the implied namespace binding of $QName [err:XUDY0023].
if(node->dmNodeKind() == Node::element_string) {
ATAnyURIOrDerived::Ptr uri = FunctionNamespaceURIForPrefix::uriForPrefix(qname->getPrefix(), node, context, this);
if(uri.notNull() && !XPath2Utils::equals(uri->asString(context), qname->getURI())) {
XMLBuffer buf;
buf.append(X("Implied namespace binding for the rename expression (\""));
buf.append(qname->getPrefix());
buf.append(X("\" -> \""));
buf.append(qname->getURI());
buf.append(X("\") conflicts with those already existing on the target element [err:XUDY0023]"));
XQThrow3(DynamicErrorException, X("URename::createUpdateList"), buf.getRawBuffer(), this);
}
}
// b. If $target is an attribute node that has a parent, the "namespaces" property of parent($target) must not include any
// namespace binding that conflicts with the implied namespace binding of $QName [err:XUDY0023].
else if(node->dmNodeKind() == Node::attribute_string) {
Node::Ptr parentNode = node->dmParent(context);
if(parentNode.notNull() && qname->getURI() != 0 && *(qname->getURI()) != 0) {
ATAnyURIOrDerived::Ptr uri = FunctionNamespaceURIForPrefix::uriForPrefix(qname->getPrefix(), parentNode, context, this);
if(uri.notNull() && !XPath2Utils::equals(uri->asString(context), qname->getURI())) {
XMLBuffer buf;
buf.append(X("Implied namespace binding for the rename expression (\""));
buf.append(qname->getPrefix());
buf.append(X("\" -> \""));
buf.append(qname->getURI());
buf.append(X("\") conflicts with those already existing on the parent element of the target attribute [err:XUDY0023]"));
XQThrow3(DynamicErrorException, X("URename::createUpdateList"), buf.getRawBuffer(), this);
}
}
}
// c. If $target is processing instruction node, $QName must not include a non-empty namespace prefix. [err:XUDY0025].
else if(node->dmNodeKind() == Node::processing_instruction_string && !XPath2Utils::equals(qname->getPrefix(), XMLUni::fgZeroLenString))
XQThrow(XPath2TypeMatchException,X("URename::createUpdateList"),
X("The target of a rename expression is a processing instruction node, and the new name "
"expression returned a QName with a non-empty namespace prefix [err:XUDY0025]"));
return PendingUpdate(PendingUpdate::RENAME, node, qname, this);
}
示例2: resolveDocument
bool XercesURIResolver::resolveDocument(Sequence &result, const XMLCh* uri, DynamicContext* context, const QueryPathNode *projection)
{
Node::Ptr doc;
// Resolve the uri against the base uri
const XMLCh *systemId = uri;
XMLURL urlTmp(context->getMemoryManager());
if(urlTmp.setURL(context->getBaseURI(), uri, urlTmp)) {
systemId = context->getMemoryManager()->getPooledString(urlTmp.getURLText());
} else {
systemId = context->getMemoryManager()->getPooledString(uri);
}
// Check in the cache
DOMDocument *found = _documentMap.get((void*)systemId);
// Check to see if we can locate and parse the document
if(found == 0) {
try {
doc = const_cast<DocumentCache*>(context->getDocumentCache())->loadDocument(uri, context, projection);
found = (DOMDocument*)((DOMNode*)doc->getInterface(XercesConfiguration::gXerces));
_documentMap.put((void*)systemId, found);
_uriMap.put((void*)found, const_cast<XMLCh*>(systemId));
}
catch(const XMLParseException& e) {
XMLBuffer errMsg;
errMsg.set(X("Error parsing resource: "));
errMsg.append(uri);
errMsg.append(X(". Error message: "));
errMsg.append(e.getError());
errMsg.append(X(" [err:FODC0002]"));
XQThrow2(XMLParseException,X("XercesContextImpl::resolveDocument"), errMsg.getRawBuffer());
}
}
else {
doc = new XercesNodeImpl(found, (XercesURIResolver*)context->getDefaultURIResolver());
}
if(doc.notNull()) {
result.addItem(doc);
return true;
}
XMLBuffer errMsg;
errMsg.set(X("Error retrieving resource: "));
errMsg.append(uri);
errMsg.append(X(" [err:FODC0002]"));
XQThrow2(XMLParseException,X("XercesContextImpl::resolveDocument"), errMsg.getRawBuffer());
return false;
}