• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ XMLBuffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: item

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


示例2: XQThrow

EventGenerator::Ptr XQNamespaceConstructor::generateEvents(EventHandler *events, DynamicContext *context,
                                                      bool preserveNS, bool preserveType) const
{
  const XMLCh *nodeName = m_name->createResult(context)->next(context)->asString(context);
  if(*nodeName && !XMLChar1_0::isValidNCName(nodeName, XMLString::stringLen(nodeName)))
    XQThrow(ASTException,X("XQNamespaceConstructor::generateEvents"),
            X("The name for the namespace node must be either a zero-length string or a valid xs:NCName [err:XTDE0920]"));

  if(XPath2Utils::equals(nodeName, XMLUni::fgXMLNSString))
    XQThrow(ASTException,X("XQNamespaceConstructor::generateEvents"),
            X("The name for the namespace node must not be \"xmlns\" [err:XTDE0920]"));

  XMLBuffer value;
  getStringValue(m_children, value, context);

  if(value.getLen() == 0)
    XQThrow(ASTException,X("XQNamespaceConstructor::generateEvents"),
            X("The value for the namespace node must not be empty [err:XTDE0930]"));

  if(XPath2Utils::equals(nodeName, XMLUni::fgXMLString) &&
     !XPath2Utils::equals(value.getRawBuffer(), XMLUni::fgXMLURIName))
    XQThrow(ASTException,X("XQNamespaceConstructor::generateEvents"),
            X("The name for the namespace node must not be \"xml\"  when the value is not \"http://www.w3.org/XML/1998/namespace\" [err:XTDE0925]"));

  if(XPath2Utils::equals(value.getRawBuffer(), XMLUni::fgXMLURIName) &&
     !XPath2Utils::equals(nodeName, XMLUni::fgXMLString))
    XQThrow(ASTException,X("XQNamespaceConstructor::generateEvents"),
            X("The value for the namespace node must not be \"http://www.w3.org/XML/1998/namespace\"  when the name is not \"xml\" [err:XTDE0925]"));

  events->namespaceEvent(nodeName, value.getRawBuffer());
  return 0;
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:32,代码来源:XQNamespaceConstructor.cpp


示例3: completeDeletions

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


示例4: while

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


示例5: iterator

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


示例6: XQThrow

EventGenerator::Ptr XQAttributeConstructor::generateEvents(EventHandler *events, DynamicContext *context,
                                                      bool preserveNS, bool preserveType) const
{
  AnyAtomicType::Ptr itemName = m_name->createResult(context)->next(context);
  const ATQNameOrDerived* pQName = (const ATQNameOrDerived*)itemName.get();
  const XMLCh *prefix = pQName->getPrefix();
  const XMLCh *uri = pQName->getURI();
  const XMLCh *name = pQName->getName();

  if((uri==NULL && XPath2Utils::equals(name, XMLUni::fgXMLNSString)) ||
     XPath2Utils::equals(uri, XMLUni::fgXMLNSURIName))
    XQThrow(ASTException,X("DOM Constructor"),X("A computed attribute constructor cannot create a namespace declaration [err:XQDY0044]"));

  XMLBuffer value;
  getStringValue(m_children, value, context);

  const XMLCh *typeURI = SchemaSymbols::fgURI_SCHEMAFORSCHEMA;
  const XMLCh *typeName = ATUntypedAtomic::fgDT_UNTYPEDATOMIC;

  // check if it's xml:id
  static const XMLCh id[] = { 'i', 'd', 0 };
  if(XPath2Utils::equals(name, id) && XPath2Utils::equals(uri, XMLUni::fgXMLURIName)) {
    // If the attribute name is xml:id, the string value and typed value of the attribute are further normalized by 
    // discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters 
    // by a single space (#x20) character.
    XMLString::collapseWS(value.getRawBuffer(), context->getMemoryManager());
    typeURI = SchemaSymbols::fgURI_SCHEMAFORSCHEMA;
    typeName = XMLUni::fgIDString;
  }

  events->attributeEvent(emptyToNull(prefix), emptyToNull(uri), name, value.getRawBuffer(), typeURI, typeName);
  return 0;
}
开发者ID:kanbang,项目名称:Colt,代码行数:33,代码来源:XQAttributeConstructor.cpp


示例7: createResult

Result XQSimpleContent::createResult(DynamicContext* context, int flags) const
{
    // TBD separator - jpcs
    XMLBuffer value;
    XQDOMConstructor::getStringValue(getChildren(), value, context);
    return (Item::Ptr)context->getItemFactory()->createString(value.getRawBuffer(), context);
}
开发者ID:zeusever,项目名称:xqilla,代码行数:7,代码来源:XQDOMConstructor.cpp


示例8: getExpression

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


示例9: XQThrow

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

  if(node->dmNodeKind() == Node::document_string)
    XQThrow(XPath2TypeMatchException,X("UReplaceValueOf::createUpdateList"),
            X("The target expression of a replace expression does not return a single "
              "node that is not a document node [err:XUTY0008]"));
    
  XMLBuffer buf;
  XQDOMConstructor::getStringValue(expr_, buf, context);

  // If $target is a comment node, and $string contains two adjacent hyphens or ends with a hyphen, a dynamic error is raised [err:XQDY0072].
  if(node->dmNodeKind() == Node::comment_string) {
    bool foundOne = false;
    for(const XMLCh *str = buf.getRawBuffer(); *str; ++str) {
      if(*str == '-') {
        if(foundOne) {
          XQThrow(DynamicErrorException,X("UReplaceValueOf::createUpdateList"),
                  X("The replace value of expression would result in a comment node whose content contains two adjacent hyphens [err:XQDY0072]"));
        }
        else foundOne = true;
      }
      else {
        foundOne = false;
      }
    }

    if(foundOne) {
      XQThrow(DynamicErrorException,X("UReplaceValueOf::createUpdateList"),
              X("The replace value of expression would result in a comment node whose content ends with a hyphen [err:XQDY0072]"));
    }
  }
  // If $target is a processing instruction node, and $string contains the substring "?>", a dynamic error is raised [err:XQDY0026].
  else if(node->dmNodeKind() == Node::processing_instruction_string) {
    bool foundQuestion = false;
    for(const XMLCh *str = buf.getRawBuffer(); *str; ++str) {
      if(*str == '?') {
        foundQuestion = true;
      }
      else {
        if(foundQuestion && *str == '>') {
          XQThrow(DynamicErrorException,X("UReplaceValueOf::createUpdateList"),
                  X("The replace value of expression would result in a processing instruction node whose content includes the string \"?>\" [err:XQDY0026]"));
        }
        foundQuestion = false;
      }
    }
  }

  Item::Ptr value = context->getItemFactory()->createString(buf.getRawBuffer(), context);

  if(node->dmNodeKind() == Node::element_string) {
    return PendingUpdate(PendingUpdate::REPLACE_ELEMENT_CONTENT, node, value, this);
  }
  else {
    return PendingUpdate(PendingUpdate::REPLACE_VALUE, node, value, this);
  }
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:59,代码来源:UReplaceValueOf.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:

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


示例12: createSequence

Sequence FunctionConcat::createSequence(DynamicContext* context, int flags) const
{
  XMLBuffer result;
  for(unsigned int i = 1; i <= getNumArgs(); ++i) {
    Item::Ptr item = getParamNumber(i,context)->next(context);
    if(!item.isNull()) {
      result.append(item->asString(context));
    }
  }
  return Sequence(context->getItemFactory()->createString(result.getRawBuffer(), context), context->getMemoryManager());
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:11,代码来源:FunctionConcat.cpp


示例13: 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


示例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: getStringValue

bool XQDOMConstructor::getStringValue(const ASTNode *child, XMLBuffer &value, DynamicContext *context)
{
    bool bSomethingFound=false;
    Result childList = child->createResult(context);
    Item::Ptr item;
    bool addSpace = false;
    while((item = childList->next(context)) != NULLRCP) {
        if(addSpace) value.append(' ');
        else addSpace = true;
        value.append(item->asString(context));
        bSomethingFound=true;
    }
    return bSomethingFound;
}
开发者ID:zeusever,项目名称:xqilla,代码行数:14,代码来源:XQDOMConstructor.cpp


示例16: 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


示例17: 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


示例18: LEAVE_IF_ERROR

void
XMLInternalParser::LoadEntity (XMLDoctype::Entity *entity, ParseContext context)
{
  XMLDataSource *source;

  if (!datasource_handler)
    {
      skip_remaining_doctype = TRUE;
      return;
    }

  if (entity->GetValue ())
    LEAVE_IF_ERROR (datasource_handler->CreateInternalDataSource (source, entity->GetValue (), entity->GetValueLength ()));
  else
    {
      source = 0;

#ifdef XML_SUPPORT_EXTERNAL_ENTITIES
      if (load_external_entities)
        LEAVE_IF_ERROR (datasource_handler->CreateExternalDataSource (source, entity->GetPubid (), entity->GetSystem (), entity->GetBaseURL ()));

      if (!source)
#endif // XML_SUPPORT_EXTERNAL_ENTITIES
        {
          skip_remaining_doctype = TRUE;
          return;
        }
    }

  OpStackAutoPtr<XMLDataSource> anchor (source);

  if (source)
    {
      XMLBuffer *buffer = OP_NEW_L(XMLBuffer, (source, version == XMLVERSION_1_1));
      buffer->Initialize (32768);
      source->SetBuffer (buffer);

      XMLInternalParserState *state = OP_NEW_L(XMLInternalParserState, ());
      state->context = context;
      state->entity = entity;
      source->SetParserState (state);
      source->SetNextSource (current_source);

      blocking_source = source;

      anchor.release ();
      LEAVE (PARSE_RESULT_BLOCK);
    }
}
开发者ID:prestocore,项目名称:browser,代码行数:49,代码来源:xmlparser_entity.cpp


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


示例20: outputPrefixOrURI

inline void outputPrefixOrURI(const XMLCh *prefix, const XMLCh *uri, XMLBuffer &buffer)
{
  if(prefix != 0) {
    buffer.append(prefix);
    buffer.append(':');
  }
  else if(XPath2Utils::equals(uri, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) {
    buffer.append(X("xs:"));
  }
  else if(uri != 0) {
    buffer.append('{');
    buffer.append(uri);
    buffer.append('}');
  }
}
开发者ID:kanbang,项目名称:Colt,代码行数:15,代码来源:SequenceType.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XMLComment类代码示例发布时间:2022-05-31
下一篇:
C++ XMLAttributes类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap