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


C++ xmlTextReaderRead函数代码示例

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


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

示例1: SkipToEndElement

//
// libxml convenience function
//
static void SkipToEndElement(xmlTextReaderPtr reader)
{
	while (xmlTextReaderRead(reader) == 1)
	{
		if (xmlTextReaderNodeType(reader) == 15)
			return;
	}
}
开发者ID:KrisShannon,项目名称:pgadmin3,代码行数:11,代码来源:macros.cpp

示例2: r

bool XmlReader::Read() {
  end_element = false;

  bool r(xmlTextReaderRead(libxml_stuff->reader) == 1);
  while (r) {
    int const node_type = xmlTextReaderNodeType(libxml_stuff->reader);
    end_element = (node_type == XML_READER_TYPE_END_ELEMENT);

    if ((node_type == XML_READER_TYPE_END_ELEMENT)
      || (node_type == XML_READER_TYPE_ELEMENT)
      || (node_type == XML_READER_TYPE_TEXT))
      break;

    r = (xmlTextReaderRead(libxml_stuff->reader) == 1);
  }
  return r;
}
开发者ID:hatc,项目名称:image-proxy,代码行数:17,代码来源:libxml_util.cpp

示例3: m_relsByType

libvisio::VSDXRelationships::VSDXRelationships(librevenge::RVNGInputStream *input)
  : m_relsByType(), m_relsById()
{
  if (input)
  {
    const std::shared_ptr<xmlTextReader> reader(
      xmlReaderForStream(input, nullptr, nullptr, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET|XML_PARSE_RECOVER),
      xmlFreeTextReader);
    if (reader)
    {
      bool inRelationships = false;
      int ret = xmlTextReaderRead(reader.get());
      while (ret == 1)
      {
        const xmlChar *name = xmlTextReaderConstName(reader.get());
        if (name)
        {
          if (xmlStrEqual(name, BAD_CAST("Relationships")))
          {
            if (xmlTextReaderNodeType(reader.get()) == 1)
            {
              // VSD_DEBUG_MSG(("Relationships ON\n"));
              inRelationships = true;
            }
            else if (xmlTextReaderNodeType(reader.get()) == 15)
            {
              // VSD_DEBUG_MSG(("Relationships OFF\n"));
              inRelationships = false;
            }
          }
          else if (xmlStrEqual(name, BAD_CAST("Relationship")))
          {
            if (inRelationships)
            {
              VSDXRelationship relationship(reader.get());
              m_relsByType[relationship.getType()] = relationship;
              m_relsById[relationship.getId()] = relationship;
            }
          }
        }
        ret = xmlTextReaderRead(reader.get());
      }
    }
  }
}
开发者ID:LibreOffice,项目名称:libvisio,代码行数:45,代码来源:VSDXMLHelper.cpp

示例4: while

char *xccdf_detect_version_priv(xmlTextReader *reader)
{
	while (xmlTextReaderRead(reader) == 1 && xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT);
	const struct xccdf_version_info *ver_info = xccdf_detect_version_parser(reader);
	if (ver_info == NULL) {
		return NULL;
	}
	return oscap_strdup(xccdf_version_info_get_version(ver_info));
}
开发者ID:AxelNennker,项目名称:openscap,代码行数:9,代码来源:elements.c

示例5: _exml_read

static int _exml_read(EXML *xml, xmlTextReaderPtr reader)
{
	int empty;
	xmlChar *name, *value;

	if (!reader)
		return -1;

	exml_clear( xml );

	while( xmlTextReaderRead( reader ) == 1 ) {
		name = xmlTextReaderName(reader);
		value = xmlTextReaderValue(reader);
		empty = xmlTextReaderIsEmptyElement(reader);

		switch( xmlTextReaderNodeType(reader) ) {
			case XML_READER_TYPE_ELEMENT:
				exml_start(xml);
				exml_tag_set(xml, (char *) name);
		
				if (xmlTextReaderHasAttributes(reader)) {
					xmlTextReaderMoveToFirstAttribute(reader);
					do {
						xmlChar *attr_name, *attr_value;

						attr_name = xmlTextReaderName(reader);
						attr_value = xmlTextReaderValue(reader);

						exml_attribute_set(xml, (char *) attr_name, (char *) attr_value);

						xmlFree(attr_name);
						xmlFree(attr_value);
					} while( xmlTextReaderMoveToNextAttribute(reader) == 1 );
				}

				if (!empty)
					break;
			case XML_READER_TYPE_END_ELEMENT:
				exml_end(xml);
				break;
			case XML_READER_TYPE_WHITESPACE:
				break;
			case XML_READER_TYPE_TEXT:
				exml_value_set(xml, (char *) value);
				break;
		}
		xmlFree(name);
		xmlFree(value);
	}

	xmlTextReaderClose(reader);
	xmlFreeTextReader(reader);

	exml_goto_top( xml );

	return TRUE;
}
开发者ID:playya,项目名称:Enlightenment,代码行数:57,代码来源:exml.c

示例6: calloc

static xmlChar *xmlTextReaderReadEntireNodeValue(xmlTextReaderPtr reader) {
  xmlChar *buffer = calloc(1, sizeof(xmlChar));
  const xmlChar *snippet;
  int status;
  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ATTRIBUTE) {
    return xmlTextReaderValue(reader);
  }
  else if (xmlTextReaderIsEmptyElement(reader) == 0) {
    status = xmlTextReaderRead(reader);
    while (status && (xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT || xmlTextReaderNodeType(reader) == XML_READER_TYPE_CDATA || xmlTextReaderNodeType(reader) == XML_READER_TYPE_ENTITY_REFERENCE)) {
      snippet = xmlTextReaderConstValue(reader);
      buffer = realloc(buffer, (xmlStrlen(buffer) + xmlStrlen(snippet) + 1) * sizeof(xmlChar));
      xmlStrcat(buffer, snippet);
      status = xmlTextReaderRead(reader);
    }
  }
  return buffer;
}
开发者ID:bestdpf,项目名称:paper,代码行数:18,代码来源:enunciate-common.c

示例7: xmlTextReaderNodeType

const char *oscap_element_string_get(xmlTextReaderPtr reader)
{
	if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT ||
			xmlTextReaderNodeType(reader) == XML_READER_TYPE_ATTRIBUTE)
		xmlTextReaderRead(reader);
	if (xmlTextReaderHasValue(reader))
		return (const char *)xmlTextReaderConstValue(reader);
	return NULL;
}
开发者ID:galaris,项目名称:openscap,代码行数:9,代码来源:elements.c

示例8: xmlTextReaderRead

 bool XMLConversion::GetContentInt(int& value)
 {
   xmlTextReaderRead(_reader);
   const xmlChar* pvalue = xmlTextReaderConstValue(_reader);
   if(!pvalue)
     return false;
   value = atoi((const char*)pvalue);
   return true;
 }
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:9,代码来源:xml.cpp

示例9: XmlReader_read

/* @method Boolean XmlReader.read() */
METHOD XmlReader_read(Ctx *ctx, knh_sfp_t *sfp)
{
    xmlTextReaderPtr reader = (xmlTextReaderPtr) p_cptr(sfp[0]);
     if(reader == NULL) {
        KNH_THROWs(ctx, "XmlReader.read(): xmlReader is not readable");
    }
    int ret = xmlTextReaderRead(reader);
    KNH_RETURN_Int(ctx,sfp,ret);
}
开发者ID:matsuu,项目名称:konoha,代码行数:10,代码来源:xmlreader.c

示例10: XmlReader_read

//## @Native boolean XmlReader.read();
static KMETHOD XmlReader_read(KonohaContext *kctx, KonohaStack *sfp)
{
	xmlTextReaderPtr reader = getRawXmlReader(sfp[0]);
	int ret = 0;
	if(reader != NULL) {
		ret = xmlTextReaderRead(reader);
	}
	KReturnUnboxValue(ret);
}
开发者ID:Kouhei-Moriya,项目名称:konoha3,代码行数:10,代码来源:xml_glue.c

示例11: extractFile

/**
 * streamFile:
 * @filename: the file name to parse
 *
 * Parse and print information about an XML file.
 *
 * Returns the resulting doc with just the elements preserved.
 */
static xmlDocPtr
extractFile(const char *filename, const xmlChar *pattern) {
    xmlDocPtr doc;
    xmlTextReaderPtr reader;
    int ret;

    /*
     * build an xmlReader for that file
     */
    reader = xmlReaderForFile(filename, NULL, 0);
    if (reader != NULL) {
        /*
	 * add the pattern to preserve
	 */
        if (xmlTextReaderPreservePattern(reader, pattern, NULL) < 0) {
            fprintf(stderr, "%s : failed add preserve pattern %s\n",
	            filename, (const char *) pattern);
	}
	/*
	 * Parse and traverse the tree, collecting the nodes in the process
	 */
        ret = xmlTextReaderRead(reader);
        while (ret == 1) {
            ret = xmlTextReaderRead(reader);
        }
        if (ret != 0) {
            fprintf(stderr, "%s : failed to parse\n", filename);
	    xmlFreeTextReader(reader);
	    return(NULL);
        }
	/*
	 * get the resulting nodes
	 */
	doc = xmlTextReaderCurrentDoc(reader);
	/*
	 * Free up the reader
	 */
        xmlFreeTextReader(reader);
    } else {
        fprintf(stderr, "Unable to open %s\n", filename);
	return(NULL);
    }
    return(doc);
}
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:52,代码来源:reader3.c

示例12: get_vm2vm_from_xml22

/*Read values from XML22 file 读取XML22,虚拟机之间的流量信息文件*/
int get_vm2vm_from_xml22(char *filename) 
{
    xmlTextReaderPtr reader;
	xmlChar *name;
    
	int vd=-1,ret=0;
	
    reader = xmlNewTextReaderFilename(filename);
	
    if (reader != NULL) {
        ret = xmlTextReaderRead(reader);
		
		name = xmlTextReaderName(reader);/*获取reader的元素名称*/
		if (name == NULL)
			name = xmlStrdup(BAD_CAST "--");
		
		/*在这个例子中,我们需要确认文档是正确的类型。“DATA”是在这个示例中使用文档的根类型。*/
		if (xmlStrcmp(name, (xmlChar *) "DATA")) {
			fprintf(stderr,"document of the wrong type, root node != DATA");
			xmlFree(name);
			xmlFreeTextReader(reader);
			return ret;
		}		
		
        while (ret == 1) {
            process_XML22_Node(reader,&vd);
			
            ret = xmlTextReaderRead(reader);
	    }
        
		xmlFreeTextReader(reader);

        if (ret != 0) {
            printf("%s : failed to parse\n", filename);
        }
    
	} 
	else 
	    printf("Unable to open %s\n", filename);
    
	_xpthis->sd->v2v_total=vd+1;/*在全局共享数据区记录v2v的总数*/
	
	return ret;
}
开发者ID:suro1995,项目名称:scheduler-alogrithm,代码行数:45,代码来源:xmlproc.c

示例13: streamFile

/**
 * streamFile:
 * @filename: the file name to parse
 *
 * Parse and print information about an XML file.
 */
static void streamFile (const char *filename) {
	xmlTextReaderPtr reader;
	int ret;

	reader = xmlReaderForFile (filename, NULL, 0);
	if (reader != NULL) {
		ret = xmlTextReaderRead (reader);
		while (ret == 1) {
			processNode (reader);
			ret = xmlTextReaderRead (reader);
		}
		xmlFreeTextReader (reader);
		if (ret != 0) {
			fprintf (stderr, "%s : failed to parse\n", filename);
		}
	} else {
		fprintf (stderr, "Unable to open %s\n", filename);
	}
}
开发者ID:Unidata,项目名称:LDM,代码行数:25,代码来源:xmlreader.c

示例14: xmlTextReaderRead

void BEXMLTextReader::read ( )
{
	int ok = xmlTextReaderRead ( reader );
	if ( ok == 0 ) {
		last_node = true;
	} else if ( ok == kBE_XMLReaderError ) {
		throw BEXMLReaderInterface_Exception ( last_error() );
	}
	
}
开发者ID:SeAlgoAsoma,项目名称:BaseElements-Plugin,代码行数:10,代码来源:BEXMLTextReader.cpp

示例15: EPUB3CopyRootFilePathFromContainer

EXPORT EPUB3Error EPUB3CopyRootFilePathFromContainer(EPUB3Ref epub, char ** rootPath)
{
  assert(epub != NULL);

  if(epub->archive == NULL) return kEPUB3ArchiveUnavailableError;

  static const char *containerFilename = "META-INF/container.xml";

  void *buffer = NULL;
  uint32_t bufferSize = 0;
  uint32_t bytesCopied;

  xmlTextReaderPtr reader = NULL;
  EPUB3Bool foundPath = kEPUB3_NO;

  EPUB3Error error = kEPUB3Success;

  error = EPUB3CopyFileIntoBuffer(epub, &buffer, &bufferSize, &bytesCopied, containerFilename);
  if(error == kEPUB3Success) {
    reader = xmlReaderForMemory(buffer, bufferSize, "", NULL, XML_PARSE_RECOVER);
    if(reader != NULL) {
      int retVal;
      while((retVal = xmlTextReaderRead(reader)) == 1)
      {
        const char *rootFileName = "rootfile";
        const xmlChar *name = xmlTextReaderConstLocalName(reader);

        if(xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT && xmlStrcmp(name, BAD_CAST rootFileName) == 0) {
          xmlChar *fullPath = xmlTextReaderGetAttribute(reader, BAD_CAST "full-path");
          if(fullPath != NULL) {
            // TODD: validate that the full-path attribute is of the form path-rootless
            //       see http://idpf.org/epub/30/spec/epub30-ocf.html#sec-container-metainf-container.xml
            foundPath = kEPUB3_YES;
            *rootPath = strdup((char *)fullPath);
          } else {
            // The spec requires the full-path attribute
            error = kEPUB3XMLXDocumentInvalidError;
          }
          break;
        }
      }
      if(retVal < 0) {
        error = kEPUB3XMLParseError;
      }
      if(!foundPath) {
        error = kEPUB3XMLXElementNotFoundError;
      }
    } else {
      error = kEPUB3XMLReadFromBufferError;
    }
    EPUB3_FREE_AND_NULL(buffer);
  }
  xmlFreeTextReader(reader);
  return error;
}
开发者ID:UIKit0,项目名称:EPUB3Processor,代码行数:55,代码来源:EPUB3.c


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