本文整理汇总了C++中XMLBuffer::set方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLBuffer::set方法的具体用法?C++ XMLBuffer::set怎么用?C++ XMLBuffer::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLBuffer
的用法示例。
在下文中一共展示了XMLBuffer::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: XQThrow
TupleNode *ForTuple::staticResolution(StaticContext *context)
{
parent_ = parent_->staticResolution(context);
varURI_ = context->getUriBoundToPrefix(XPath2NSUtils::getPrefix(varQName_, context->getMemoryManager()), this);
varName_ = XPath2NSUtils::getLocalName(varQName_);
if(posQName_ && *posQName_) {
posURI_ = context->getUriBoundToPrefix(XPath2NSUtils::getPrefix(posQName_, context->getMemoryManager()), this);
posName_ = XPath2NSUtils::getLocalName(posQName_);
if(XPath2Utils::equals(posName_, varName_) && XPath2Utils::equals(posURI_, varURI_)) {
XMLBuffer errMsg;
errMsg.set(X("The positional variable with name {"));
errMsg.append(posURI_);
errMsg.append(X("}"));
errMsg.append(posName_);
errMsg.append(X(" conflicts with the iteration variable [err:XQST0089]"));
XQThrow(StaticErrorException,X("ForTuple::staticResolution"), errMsg.getRawBuffer());
}
}
expr_ = expr_->staticResolution(context);
return this;
}
示例3: staticResolution
ASTNode* XQFunctionCall::staticResolution(StaticContext *context)
{
if(uri_ == 0) {
if(prefix_ == 0 || *prefix_ == 0) {
uri_ = context->getDefaultFuncNS();
}
else {
uri_ = context->getUriBoundToPrefix(prefix_, this);
}
}
ASTNode *result = context->lookUpFunction(uri_, name_, *args_, this);
if(result == 0) {
XMLBuffer buf;
buf.set(X("A function called {"));
buf.append(uri_);
buf.append(X("}"));
buf.append(name_);
buf.append(X(" with "));
XPath2Utils::numToBuf(args_ ? (unsigned int)args_->size() : 0, buf);
buf.append(X(" arguments is not defined [err:XPST0017]"));
XQThrow(StaticErrorException, X("XQFunctionCall::staticResolution"), buf.getRawBuffer());
}
// Our arguments don't belong to us anymore
for(VectorOfASTNodes::iterator i = args_->begin(); i != args_->end(); ++i) {
*i = 0;
}
// Release this object
this->release();
return result->staticResolution(context);
}
示例4: next
Item::Ptr AtomizeResult::next(DynamicContext *context)
{
// for $item in (Expr) return
// typeswitch ($item)
// case $value as atomic value return $value
// default $node return fn:data($node)
Item::Ptr result = _sub->next(context);
while(result.isNull()) {
_sub = 0;
result = _parent->next(context);
if(result.isNull()) {
_parent = 0;
return 0;
}
if(result->isNode()) {
_sub = ((Node*)result.get())->dmTypedValue(context);
result = _sub->next(context);
}
else if(result->isFunction()) {
XMLBuffer buf;
buf.set(X("Sequence does not match type (xs:anyAtomicType | node())*"));
buf.append(X(" - found item of type "));
result->typeToBuffer(context, buf);
buf.append(X(" [err:XPTY0004]"));
XQThrow(XPath2TypeMatchException, X("AtomizeResult::next"), buf.getRawBuffer());
}
}
return result;
}
示例5: insertFunction
void FunctionLookup::insertFunction(FuncFactory *func)
{
// Use similar algorithm to lookup in order to detect overlaps
// in argument numbers
RefHash2KeysTableOfEnumerator<FuncFactory> iterator(const_cast<RefHash2KeysTableOf< FuncFactory >* >(&_funcTable));
//
// Walk the matches for the primary key (name) looking for overlaps:
// ensure func->max < min OR func->min > max
//
iterator.setPrimaryKey(func->getURINameHash());
while(iterator.hasMoreElements())
{
FuncFactory *entry= &(iterator.nextElement());
if ((func->getMaxArgs() < entry->getMinArgs()) ||
(func->getMinArgs() > entry->getMaxArgs()))
continue;
// overlap -- throw exception
XMLBuffer buf;
buf.set(X("Multiple functions have the same expanded QName and number of arguments {"));
buf.append(func->getURI());
buf.append(X("}"));
buf.append(func->getName());
buf.append(X("#"));
if(func->getMinArgs() >= entry->getMinArgs() &&
func->getMinArgs() <= entry->getMaxArgs())
XPath2Utils::numToBuf((unsigned int)func->getMinArgs(), buf);
else
XPath2Utils::numToBuf((unsigned int)entry->getMinArgs(), buf);
buf.append(X(" [err:XQST0034]."));
XQThrow2(StaticErrorException,X("FunctionLookup::insertFunction"), buf.getRawBuffer());
}
// Ok to add function
size_t secondaryKey = SECONDARY_KEY(func);
_funcTable.put((void*)func->getURINameHash(), (int)secondaryKey, func);
}
示例6: createResult
Result XQNameExpression::createResult(DynamicContext* context, int flags) const
{
AnyAtomicType::Ptr itemName = getExpression()->createResult(context)->next(context);
switch(itemName->getPrimitiveTypeIndex()) {
case AnyAtomicType::QNAME:
return (Item::Ptr)itemName;
case AnyAtomicType::STRING:
case AnyAtomicType::UNTYPED_ATOMIC:
try {
return (Item::Ptr)context->getItemFactory()->createDerivedFromAtomicType(AnyAtomicType::QNAME, itemName->asString(context), context);
}
catch(XQException &) {
XQThrow(ASTException,X("XQNameExpression::NameExpressionResult::createResult"),
X("The name expression cannot be converted to a xs:QName [err:XQDY0074]"));
}
default:
break;
}
XMLBuffer buf;
buf.set(X("The name expression must be a single xs:QName, xs:string or xs:untypedAtomic"));
buf.append(X(" - found item of type "));
itemName->typeToBuffer(context, buf);
buf.append(X(" [err:XPTY0004]"));
XQThrow(XPath2TypeMatchException, X("XQNameExpression::NameExpressionResult::createResult"), buf.getRawBuffer());
}
示例7: lookUpFunction
ASTNode* FunctionLookup::lookUpFunction(const XMLCh* URI, const XMLCh* fname,
const VectorOfASTNodes &args, XPath2MemoryManager* memMgr) const
{
if (this != g_globalFunctionTable) {
ASTNode *ret = g_globalFunctionTable->lookUpFunction(
URI, fname, args, memMgr);
if (ret)
return ret;
}
RefHash2KeysTableOfEnumerator<FuncFactory> iterator(const_cast<RefHash2KeysTableOf< FuncFactory >* >(&_funcTable));
//
// Walk the matches for the primary key (name) looking for matches
// based on allowable parameters
//
XMLBuffer key;
key.set(fname);
key.append(':');
key.append(URI);
iterator.setPrimaryKey(key.getRawBuffer());
size_t nargs = args.size();
while(iterator.hasMoreElements()) {
FuncFactory *entry= &(iterator.nextElement());
if (entry->getMinArgs() <= nargs &&
entry->getMaxArgs() >= nargs)
return entry->createInstance(args, memMgr);
}
return NULL;
}
示例8:
const ExternalFunction *FunctionLookup::lookUpExternalFunction(
const XMLCh* URI, const XMLCh* fname, size_t numArgs) const
{
size_t secondaryKey = numArgs;
XMLBuffer key;
key.set(fname);
key.append(':');
key.append(URI);
return _exFuncTable.get(key.getRawBuffer(), (int)secondaryKey);
}
示例9: generateEvents
EventGenerator::Ptr XQCommentConstructor::generateEvents(EventHandler *events, DynamicContext *context,
bool preserveNS, bool preserveType) const
{
XMLBuffer value;
getStringValue(m_value, value, context);
// Check for two dashes in a row, or a dash at the end
if(xslt_) {
XMLBuffer buf(value.getLen());
bool foundDash = false;
const XMLCh *ptr = value.getRawBuffer();
const XMLCh *end = ptr + value.getLen();
while(ptr != end) {
if(*ptr == chDash) {
if(foundDash) {
buf.append(' ');
}
foundDash = true;
}
else foundDash = false;
buf.append(*ptr);
++ptr;
}
if(foundDash) {
buf.append(' ');
}
value.set(buf.getRawBuffer());
}
else {
bool foundDash = false;
const XMLCh *ptr = value.getRawBuffer();
const XMLCh *end = ptr + value.getLen();
while(ptr != end) {
if(*ptr == chDash) {
if(foundDash) break;
foundDash = true;
}
else foundDash = false;
++ptr;
}
if(foundDash)
XQThrow(ASTException,X("DOM Constructor"),X("It is a dynamic error if the result of the content expression of "
"a computed comment constructor contains two adjacent hyphens or "
"ends with a hyphen. [err:XQDY0072]"));
}
events->commentEvent(value.getRawBuffer());
return 0;
}
示例10: X
virtual InputSource *resolveEntity(XMLResourceIdentifier* resourceIdentifier)
{
if(resourceIdentifier->getResourceIdentifierType() == XMLResourceIdentifier::UnKnown &&
XPath2Utils::equals(resourceIdentifier->getNameSpace(), m_PreviousModuleNamespace)) {
XMLBuffer buf;
buf.set(X("The graph of module imports contains a cycle for namespace '"));
buf.append(resourceIdentifier->getNameSpace());
buf.append(X("' [err:XQST0073]"));
XQThrow3(StaticErrorException, X("LoopDetector::resolveEntity"), buf.getRawBuffer(), m_location);
}
if(m_pParentResolver)
return m_pParentResolver->resolveEntity(resourceIdentifier);
return NULL;
}
示例11: partialApply
FunctionRef::Ptr FunctionRefImpl::partialApply(const Result &arg, unsigned int argNum, DynamicContext *context, const LocationInfo *location) const
{
if(getNumArgs() < argNum) {
XMLBuffer buf;
buf.set(X("The function item argument to fn:partial-apply() must have an arity of at least "));
XPath2Utils::numToBuf(argNum, buf);
buf.append(X(" - found item of type "));
typeToBuffer(context, buf);
buf.append(X(" [err:TBD]"));
XQThrow3(XPath2TypeMatchException, X("FunctionRefImpl::partialApply"), buf.getRawBuffer(), location);
}
return new FunctionRefImpl(this, arg, argNum - 1, context);
}
示例12: duplicateVariableError
static void duplicateVariableError(const XQGlobalVariable *existing, const XQGlobalVariable *bad,
MessageListener *mlistener)
{
if(mlistener) {
mlistener->warning(X("In the context of this variable declaration"), existing);
}
XMLBuffer buf;
buf.set(X("A variable with name {"));
buf.append(bad->getVariableURI());
buf.append(X("}"));
buf.append(bad->getVariableLocalName());
buf.append(X(" conflicts with an existing global variable [err:XQST0049]."));
XQThrow3(StaticErrorException, X("XQQuery::staticResolution"), buf.getRawBuffer(), bad);
}
示例13: regEx
const XMLCh *FunctionReplace::replace(const XMLCh *input, const XMLCh *pattern, const XMLCh *replacement, const XMLCh *options, MemoryManager *mm)
{
// Always turn off head character optimisation, since it is broken
XMLBuffer optionsBuf;
optionsBuf.set(options);
optionsBuf.append(chLatin_H);
//Now attempt to replace
RegularExpression regEx(pattern, optionsBuf.getRawBuffer(), mm);
#ifdef HAVE_ALLMATCHES
return regEx.replace(input, replacement, mm);
#else
return regEx.replace(input, replacement);
#endif
}
示例14: execute
Result FunctionRefImpl::execute(const VectorOfResults &args, DynamicContext *context, const LocationInfo *location) const
{
if(args.size() != getNumArgs()) {
XMLBuffer buf;
buf.set(X("The function item invoked does not accept "));
XPath2Utils::numToBuf((unsigned int)args.size(), buf);
buf.append(X(" arguments - found item of type "));
typeToBuffer(context, buf);
buf.append(X(" [err:XPTY0004]"));
XQThrow3(XPath2TypeMatchException, X("FunctionRefImpl::execute"), buf.getRawBuffer(), location);
}
FunctionRefScope scope(this, args, context);
AutoVariableStoreReset vsReset(context, &scope);
return instance_->createResult(context);
}
示例15: substitute
ASTNode *XQAtomize::staticTypingImpl(StaticContext *context)
{
_src.clear();
_src.getStaticType() = expr_->getStaticAnalysis().getStaticType();
_src.add(expr_->getStaticAnalysis());
if(expr_->getStaticAnalysis().isUpdating()) {
XQThrow(StaticErrorException,X("XQAtomize::staticTyping"),
X("It is a static error for an atomized expression "
"to be an updating expression [err:XUST0001]"));
}
if(_src.getStaticType().isType(StaticType::FUNCTION_TYPE) &&
_src.getStaticType().getMin() > 0) {
XMLBuffer buf;
buf.set(X("Sequence does not match type (xs:anyAtomicType | node())*"));
buf.append(X(" - the expression has a static type of "));
_src.getStaticType().typeToBuf(buf);
buf.append(X(" [err:XPTY0004]"));
XQThrow(XPath2TypeMatchException, X("XQAtomize::staticTyping"), buf.getRawBuffer());
}
if(!_src.getStaticType().containsType(StaticType::NODE_TYPE|StaticType::FUNCTION_TYPE)) {
// If the expression has no nodes, this function does nothing
return substitute(expr_);
}
if(doPSVI_) {
_src.getStaticType().substitute(StaticType::ELEMENT_TYPE | StaticType::ATTRIBUTE_TYPE,
StaticType(StaticType::ANY_ATOMIC_TYPE, 0, StaticType::UNLIMITED));
} else {
_src.getStaticType().substitute(StaticType::ELEMENT_TYPE | StaticType::ATTRIBUTE_TYPE,
StaticType::UNTYPED_ATOMIC_TYPE);
}
_src.getStaticType().substitute(StaticType::DOCUMENT_TYPE | StaticType::TEXT_TYPE,
StaticType::UNTYPED_ATOMIC_TYPE);
_src.getStaticType().substitute(StaticType::NAMESPACE_TYPE | StaticType::COMMENT_TYPE |
StaticType::PI_TYPE, StaticType::STRING_TYPE);
// Remove function types
_src.getStaticType() &= StaticType(StaticType::NODE_TYPE | StaticType::ANY_ATOMIC_TYPE, 0, StaticType::UNLIMITED);
return this;
}