当前位置: 首页>>代码示例>>C++>>正文


C++ XMLBuffer::append方法代码示例

本文整理汇总了C++中XMLBuffer::append方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLBuffer::append方法的具体用法?C++ XMLBuffer::append怎么用?C++ XMLBuffer::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLBuffer的用法示例。


在下文中一共展示了XMLBuffer::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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());
}
开发者ID:zeusever,项目名称:xqilla,代码行数:27,代码来源:XQDOMConstructor.cpp

示例2: addToPutSet

void XercesUpdateFactory::addToPutSet(const Node::Ptr &node, const LocationInfo *location, DynamicContext *context)
{
  Node::Ptr root = node->root(context);

  Sequence docURISeq = root->dmDocumentURI(context);
  const XMLCh *docuri = 0;
  if(!docURISeq.isEmpty()) {
    docuri = docURISeq.first()->asString(context);
  }

  PutItem item(docuri, root, location, context);

  std::pair<PutSet::iterator, bool> res = putSet_.insert(item);
  if(!res.second && !res.first->node->equals(item.node)) {
    if(context->getMessageListener() != 0) {
      context->getMessageListener()->warning(X("In the context of this expression"), res.first->location);
    }

    XMLBuffer buf;
    buf.append(X("Document writing conflict for URI \""));
    buf.append(item.uri);
    buf.append(X("\""));

    XQThrow3(ASTException, X("XercesUpdateFactory::addToPutSet"), buf.getRawBuffer(), location);
  }
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:26,代码来源:XercesUpdateFactory.cpp

示例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);
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:34,代码来源:XQFunctionCall.cpp

示例4: completeUpdate

void XercesUpdateFactory::completeUpdate(DynamicContext *context)
{
  completeDeletions(context);
  completeRevalidation(context);

  // Call the URIResolvers to handle the PutSet
  for(PutSet::iterator i = putSet_.begin(); i != putSet_.end(); ++i) {
    try {
      if(!context->putDocument(i->node, i->uri)) {
        XMLBuffer buf;
        buf.append(X("Writing of updated document failed for URI \""));
        buf.append(i->uri);
        buf.append(X("\""));

        XQThrow3(ASTException, X("XercesUpdateFactory::completeUpdate"), buf.getRawBuffer(), i->location);
      }
    }
    catch(XQException& e) {
      if(e.getXQueryLine() == 0) {
        e.setXQueryPosition(i->location);
      }
      throw e;
    }
  }
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:25,代码来源:XercesUpdateFactory.cpp

示例5: textEvent

void XercesSequenceBuilder::textEvent(const XMLCh *chars, unsigned int length)
{
  if(document_ == 0) {
    document_ = new (context_->getMemoryManager()) XPathDocumentImpl(XQillaImplementation::getDOMImplementationImpl(), context_->getMemoryManager());
  }

  if(currentNode_->getNodeType() == DOMNode::TEXT_NODE) {
    // Combine adjacent text nodes
    XMLBuffer buf;
    buf.append(chars, length);
    ((DOMText *)currentNode_)->appendData(buf.getRawBuffer());
  }
  else if(currentParent_ == 0 || length != 0) {
		// Text nodes with a zero length value can only exist
		// when they have no parent
    XMLBuffer buf;
    buf.append(chars, length);
    DOMText *node = document_->createTextNode(buf.getRawBuffer());

    if(currentParent_ != 0)
      currentParent_->appendChild(node);
    currentNode_ = node;
  }

  if(currentParent_ == 0) {
    seq_.addItem(new XercesNodeImpl(currentNode_, (XercesURIResolver*)context_->getDefaultURIResolver()));
    document_ = 0;
    currentNode_ = 0;
  }
}
开发者ID:kanbang,项目名称:Colt,代码行数:30,代码来源:XercesSequenceBuilder.cpp

示例6: 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;
}
开发者ID:kanbang,项目名称:Colt,代码行数:30,代码来源:XQAtomize.cpp

示例7: 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);
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:35,代码来源:FunctionLookup.cpp

示例8: 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;
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:26,代码来源:ForTuple.cpp

示例9: createUpdateList

PendingUpdateList UInsertAsLast::createUpdateList(DynamicContext *context) const
{
  Node::Ptr node = (Node*)target_->createResult(context)->next(context).get();

  if(node->dmNodeKind() != Node::element_string &&
     node->dmNodeKind() != Node::document_string)
    XQThrow(XPath2TypeMatchException,X("UInsertAsLast::createUpdateList"),
            X("It is a type error for the target expression of an insert as last expression not to be a single element "
              "or document [err:XUTY0005]"));

  Sequence alist(context->getMemoryManager());
  Sequence clist(context->getMemoryManager());

  Result value = source_->createResult(context);
  Item::Ptr item;
  while((item = value->next(context)).notNull()) {
    if(((Node*)item.get())->dmNodeKind() == Node::attribute_string) {
      if(!clist.isEmpty())
        XQThrow(ASTException,X("UInsertAsLast::createUpdateList"),
                X("Attribute nodes must occur before other nodes in the source expression for an insert as last expression [err:XUTY0004]"));

      //    b. No attribute node in $alist may have a QName whose implied namespace binding conflicts with a namespace
      //       binding in the "namespaces" property of $target [err:XUDY0023].  
      ATQNameOrDerived::Ptr qname = ((Node*)item.get())->dmNodeName(context);
      if(qname->getURI() != 0 && *(qname->getURI()) != 0) {
        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 insert as last 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("UInsertInto::createUpdateList"), buf.getRawBuffer(), this);
        }
      }

      alist.addItem(item);
    }
    else
      clist.addItem(item);
  }

  PendingUpdateList result;

  if(!alist.isEmpty()) {
    // 3. If $alist is not empty and into is specified, the following checks are performed:
    //    a. $target must be an element node [err:XUTY0022].
    if(node->dmNodeKind() == Node::document_string)
      XQThrow(XPath2TypeMatchException,X("UInsertInto::createUpdateList"),
              X("It is a type error if an insert expression specifies the insertion of an attribute node into a document node [err:XUTY0022]"));
    result.addUpdate(PendingUpdate(PendingUpdate::INSERT_ATTRIBUTES, node, alist, this));
  }
  if(!clist.isEmpty()) {
    result.addUpdate(PendingUpdate(PendingUpdate::INSERT_INTO_AS_LAST, node, clist, this));
  }

  return result;
}
开发者ID:kanbang,项目名称:Colt,代码行数:59,代码来源:UInsertAsLast.cpp

示例10: typeToBuffer

void AnyAtomicType::typeToBuffer(DynamicContext *context, XMLBuffer &buffer) const
{
  if(getTypeURI()) {
    buffer.append('{');
    buffer.append(getTypeURI());
    buffer.append('}');
  }
  buffer.append(getTypeName());
}
开发者ID:kanbang,项目名称:Colt,代码行数:9,代码来源:AnyAtomicType.cpp

示例11: 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);
}
开发者ID:kanbang,项目名称:Colt,代码行数:53,代码来源:URename.cpp

示例12: generateEvents

EventGenerator::Ptr XQQNameLiteral::generateEvents(EventHandler *events, DynamicContext *context,
                                                   bool preserveNS, bool preserveType) const
{
  XMLBuffer buf;
  if(prefix_ && *prefix_) {
    buf.append(prefix_);
    buf.append(':');
  }
  buf.append(localname_);
  events->atomicItemEvent(AnyAtomicType::QNAME, buf.getRawBuffer(), typeURI_, typeName_);
  return 0;
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:12,代码来源:XQLiteral.cpp

示例13: staticTypingOnce

void XQUserFunction::staticTypingOnce(StaticContext *context, StaticTyper *styper)
{
  // Avoid inifinite recursion for recursive functions
  // TBD Need to declare everything as being used - jpcs
  if(staticTyped_ != BEFORE) {
    if(staticTyped_ == DURING)
      recursive_ = true;

    XQGlobalVariable *global = 0;
    StaticTyper::PrologItem *breadcrumb = styper->getTrail();
    for(; breadcrumb; breadcrumb = breadcrumb->prev) {
      if(breadcrumb->global) global = breadcrumb->global;
      if(breadcrumb->function == this) break;
    }

    if(global && breadcrumb) {
      XMLBuffer buf;
      buf.append(X("The initializing expression for variable {"));
      buf.append(global->getVariableURI());
      buf.append(X("}"));
      buf.append(global->getVariableLocalName());
      buf.append(X(" depends on itself [err:XQST0054]"));
      XQThrow3(StaticErrorException, X("XQUserFunction::staticTypingOnce"), buf.getRawBuffer(), global);
    }

    return;
  }
  staticTyped_ = DURING;

  StaticTyper::PrologItem breadcrumb(this, styper->getTrail());
  AutoReset<StaticTyper::PrologItem*> autorReset2(styper->getTrail());
  styper->getTrail() = &breadcrumb;;

  GlobalVariables globalsUsed(XQillaAllocator<XQGlobalVariable*>(context->getMemoryManager()));
  {
    AutoReset<GlobalVariables*> autoReset(styper->getGlobalsUsed());
    styper->getGlobalsUsed() = &globalsUsed;
    staticTyping(context, styper);
  }

  if(!globalsUsed.empty()) {
    // Static type the global variables we depend on
    GlobalVariables::iterator it = globalsUsed.begin();
    for(; it != globalsUsed.end(); ++it) {
      (*it)->staticTypingOnce(context, styper);
    }

    // Re-static type this function definition
    staticTyping(context, styper);
  }

  staticTyped_ = AFTER;
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:53,代码来源:XQUserFunction.cpp

示例14: 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);
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:14,代码来源:FunctionRefImpl.cpp

示例15: 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;
 }
开发者ID:kanbang,项目名称:Colt,代码行数:14,代码来源:XQQuery.cpp


注:本文中的XMLBuffer::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。