您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xmlTextWriterStartDocument函数代码示例

51自学网 2021-06-03 11:47:17
  C++
这篇教程C++ xmlTextWriterStartDocument函数代码示例写得很实用,希望能帮到您。

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

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

示例1: xml_init

struct writer * xml_init(FILE * fh) {	struct writer * result;	struct xml_writer_private * priv;	priv = malloc( sizeof( *priv ) );	if ( ! priv ) {		fatalx("out of memory/n");		return NULL;	}	priv->xw = xmlNewTextWriterDoc(&(priv->doc), 0);	if ( ! priv->xw ) {		fatalx("cannot create xml writer/n");		return NULL;	}	xmlTextWriterSetIndent(priv->xw, 4);	if (xmlTextWriterStartDocument(priv->xw, NULL, MY_ENCODING, NULL) < 0 ) {		fatalx("cannot start xml document/n");		return NULL;	}	result = malloc( sizeof( struct writer ) );	if ( ! result ) {		fatalx("out of memory/n");		return NULL;	}	result->priv  = priv;	result->start = xml_start;	result->attr  = xml_attr;	result->data  = xml_data;	result->end   = xml_end;	result->finish= xml_finish;	return result;}
开发者ID:alexshavelev,项目名称:lldpd,代码行数:39,


示例2: xmlNewDoc

void XMLExporter::open(const std::string &_filename, const std::string &_element){	m_doc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);	m_node = xmlNewDocNode(m_doc, NULL, BAD_CAST "root", NULL);	xmlDocSetRootElement(m_doc, m_node);	m_writer = xmlNewTextWriterTree(m_doc,m_node, 0); 	xmlTextWriterStartDocument(m_writer, NULL, MY_ENCODING, NULL);//	xmlTextWriterStartElement(m_writer, BAD_CAST _element.c_str());	m_file = _filename;}
开发者ID:skirk,项目名称:3rdYearMajor,代码行数:10,


示例3: xmlTextWriterSetIndent

void xml_writer::init(bool indent) {  // maybe enable indenting  if (indent) {    xmlTextWriterSetIndent(pimpl->writer, 1);  }  // start the document  if (xmlTextWriterStartDocument(pimpl->writer, NULL, "UTF-8", NULL) < 0) {    throw write_error("error creating document element.");  }}
开发者ID:dgreyling,项目名称:cgimap,代码行数:11,


示例4: xmlTextWriterStartDocument

bool c_XMLWriter::t_startdocument(const String& version /* = "1.0" */,                                  const String& encoding /* = null_string */,                                  const String& standalone /* = null_string */) {  int ret = -1;  if (m_ptr) {    ret = xmlTextWriterStartDocument(m_ptr, (const char *)xmls(version),                                     (const char *)xmls(encoding),                                     (const char *)xmls(standalone));  }  return ret != -1;}
开发者ID:chethenry,项目名称:hiphop-php,代码行数:11,


示例5: xmlNewTextWriterFilename

XMLBBoxWriter::XMLBBoxWriter(const char* filename):frameCount(0){	open_success=true;	writer = xmlNewTextWriterFilename(filename, 0);	if (writer == NULL) {		printf("testXmlwriterFilename: Error creating the xml writer/n");		open_success=false;	}	rc=xmlTextWriterStartDocument(writer,NULL,ENCODING,NULL);	rc=xmlTextWriterStartElement(writer, BAD_CAST "dataset");}
开发者ID:HiranChathura,项目名称:ViDasa,代码行数:11,


示例6: xml_new_writer

void xml_new_writer(struct xml_writer_private *priv){	priv->xw = xmlNewTextWriterDoc(&(priv->doc), 0);	if (!priv->xw)		fatalx("lldpctl", "cannot create xml writer");	xmlTextWriterSetIndent(priv->xw, 4);	if (xmlTextWriterStartDocument(priv->xw, NULL, "UTF-8", NULL) < 0 )		fatalx("lldpctl", "cannot start xml document");}
开发者ID:alagoutte,项目名称:lldpd,代码行数:11,


示例7: startSBOLDocument

static void startSBOLDocument() {	resetProcessed();	createSBOLWriter();	xmlTextWriterStartDocument(WRITER, NULL, NULL, NULL);	xmlTextWriterStartElement(WRITER, xmlCharStrdup(NSPREFIX_RDF ":" NODENAME_RDF));	xmlTextWriterWriteAttribute(WRITER, xmlCharStrdup("xmlns:" NSPREFIX_RDF), xmlCharStrdup(NSURL_RDF));	xmlTextWriterWriteAttribute(WRITER, xmlCharStrdup("xmlns:" NSPREFIX_RDFS), xmlCharStrdup(NSURL_RDFS));	xmlTextWriterWriteAttribute(WRITER, xmlCharStrdup("xmlns:" NSPREFIX_SO),   xmlCharStrdup(NSURL_SO));	xmlTextWriterWriteAttribute(WRITER, xmlCharStrdup("xmlns:" NSPREFIX_SBOL), xmlCharStrdup(NSURL_SBOL));	indentMore();}
开发者ID:CytoComp,项目名称:libSBOLc,代码行数:11,


示例8: INSTANCE_METHOD_INJECTION_BUILTIN

bool c_XMLWriter::t_startdocument(CStrRef version /* = "1.0" */,                                  CStrRef encoding /* = null_string */,                                  CStrRef standalone /* = null_string */) {  INSTANCE_METHOD_INJECTION_BUILTIN(XMLWriter, XMLWriter::startdocument);  int ret = -1;  if (m_ptr) {    ret = xmlTextWriterStartDocument(m_ptr, (const char *)xmls(version),                                     (const char *)xmls(encoding),                                     (const char *)xmls(standalone));  }  return ret != -1;}
开发者ID:activeingredient,项目名称:hiphop-php,代码行数:12,


示例9: settingsXmlSave

// SAX save settingsshort int settingsXmlSave(const char *filename) {    int rc;    xmlTextWriterPtr writer;    // Create a new XmlWriter with no compression    writer = xmlNewTextWriterFilename(filename, 0);    if (writer == NULL) return 1;    // Start document with xml default encoding ISO 8859-1    rc = xmlTextWriterStartDocument(writer, NULL, XML_ENCODING, NULL);    if (rc < 0) return 2;    // Start root node "settings"    rc = xmlTextWriterStartElement(writer, BAD_CAST "settings");    if (rc < 0) return 2;	// Create child node "xap"    rc = xmlTextWriterStartElement(writer, BAD_CAST "xap");    if (rc < 0) return 2;    	// Write <xap> elements    rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "iface", "%s", hubConfig->interfacename);	if (rc < 0) return 4;	rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "instance", "%s", hubConfig->xap_addr.instance);	if (rc < 0) return 4;    rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "hbeatf", "%d", hubConfig->xap_hbeat);    if (rc < 0) return 4;	rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "uid", "%s", hubConfig->xap_uid);    if (rc < 0) return 4;    rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "port", "%d", hubConfig->xap_port);    if (rc < 0) return 4;                // Close node "xap"    rc = xmlTextWriterEndElement(writer);    if (rc < 0) return 5;        // Close the rest nodes pending to close    rc = xmlTextWriterEndDocument(writer);	if (rc < 0) return 5;	// Free the writer    xmlFreeTextWriter(writer);        // Cleanup function for the XML library.    xmlCleanupParser();        // this is to debug memory for regression tests    xmlMemoryDump();        return 0;}
开发者ID:homected,项目名称:homected4pi-v1.0,代码行数:53,


示例10: writeNode

static void writeNode(Serialization *serialization, DFNode *node, int depth){    switch (node->tag) {        case DOM_DOCUMENT: {            if (!serialization->html)                xmlTextWriterStartDocument(serialization->writer,"1.0","UTF-8","yes");            if (serialization->html)                xmlTextWriterWriteDTD(serialization->writer,(xmlChar *)"html",NULL,NULL,NULL);//            xmlTextWriterWriteDTD(writer,//                                  (xmlChar *)"html",//                                  (xmlChar *)"-//W3C//DTD XHTML 1.0 Strict//EN",//                                  (xmlChar *)"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd",//                                  NULL);            for (DFNode *child = node->first; child != NULL; child = child->next)                writeNode(serialization,child,0);            xmlTextWriterEndDocument(serialization->writer);            break;        }        case DOM_TEXT: {            if (serialization->indent && ((node->prev != NULL) || (node->next != NULL)))                xmlTextWriterWriteRawLen(serialization->writer,INDENT,1+depth);            if (serialization->html && (node->parent != NULL) && (node->parent->tag == HTML_STYLE)) {                xmlTextWriterWriteRaw(serialization->writer,(const xmlChar *)node->value);            }            else {                xmlTextWriterWriteString(serialization->writer,(const xmlChar *)node->value);            }            break;        }        case DOM_COMMENT: {            xmlTextWriterWriteComment(serialization->writer,(const xmlChar *)node->value);            break;        }        case DOM_CDATA: {            xmlTextWriterWriteCDATA(serialization->writer,(const xmlChar *)node->value);            break;        }        case DOM_PROCESSING_INSTRUCTION: {            xmlTextWriterWritePI(serialization->writer,                                 (const xmlChar *)node->target,                                 (const xmlChar *)node->value);            break;        }        default: {            if (node->parent == serialization->doc->docNode)                writeElement(serialization,node,0);            else                writeElement(serialization,node,depth);            break;        }    }}
开发者ID:apache,项目名称:incubator-corinthia,代码行数:52,


示例11: temporal_convert_parallel_passages

void temporal_convert_parallel_passages()// This was used to convert file NT_order_of_OT_Quotations_in_NT.pps to xml.// Then for converting NT_Parallel_Passages.pps.// Then for converting OT_Parallel_Passages.pps.{  bool set_opened = false;  xmlBufferPtr buffer = xmlBufferCreate();  xmlTextWriterPtr writer = xmlNewTextWriterMemory(buffer, 0);  xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);  xmlTextWriterSetIndent(writer, 1);  xmlTextWriterStartElement(writer, BAD_CAST "ot-parallel-passages");  ReadText rt("/home/joe/parallel-passages/OT_Parallel_Passages.pps", true);  for (unsigned int i = 0; i < rt.lines.size(); i++) {    if (rt.lines[i].find("//key ") == 0) {      rt.lines[i].erase(0, 5);      xmlTextWriterStartElement(writer, BAD_CAST "section");      xmlTextWriterWriteAttribute(writer, BAD_CAST "title", BAD_CAST rt.lines[i].c_str());    }    if (rt.lines[i].find("//ref ") == 0) {      if (!set_opened) {        xmlTextWriterStartElement(writer, BAD_CAST "set");        set_opened = true;      }      xmlTextWriterStartElement(writer, BAD_CAST "reference");      rt.lines[i].erase(0, 5);      ustring book, chapter, verse;      decode_reference(rt.lines[i], book, chapter, verse);      book = books_id_to_english(books_paratext_to_id(book));      xmlTextWriterWriteAttribute(writer, BAD_CAST "book", BAD_CAST book.c_str());      xmlTextWriterWriteAttribute(writer, BAD_CAST "chapter", BAD_CAST chapter.c_str());      xmlTextWriterWriteAttribute(writer, BAD_CAST "verse", BAD_CAST verse.c_str());      xmlTextWriterEndElement(writer);    }    if (rt.lines[i].empty() || (rt.lines[i].find("//com") == 0)) {      xmlTextWriterEndElement(writer);      set_opened = false;    }    if (rt.lines[i].empty()) {      xmlTextWriterEndElement(writer);    }  }  xmlTextWriterEndDocument(writer);  xmlTextWriterFlush(writer);  g_file_set_contents("/home/joe/ot-parallel-passages.xml", (const gchar *)buffer->content, -1, NULL);  if (writer)    xmlFreeTextWriter(writer);  if (buffer)    xmlBufferFree(buffer);}
开发者ID:alerque,项目名称:bibledit,代码行数:51,


示例12: xmlBufferCreate

/** * @short Prepares the response for propfinds *  * @param realpath Shared folder * @param urlpath URL of the requested propfind * @param depth Depth of query, 0 or 1. * @param props Properties of the query *  * @returns An onion_block with the XML data. */onion_block *onion_webdav_write_propfind(const char *basepath, const char *realpath, const char *urlpath, int depth, 																				 int props){	onion_block *data=onion_block_new();	xmlTextWriterPtr writer;	xmlBufferPtr buf;	buf = xmlBufferCreate();	if (buf == NULL) {		ONION_ERROR("testXmlwriterMemory: Error creating the xml buffer");		return data;	}	writer = xmlNewTextWriterMemory(buf, 0);	if (writer == NULL) {		ONION_ERROR("testXmlwriterMemory: Error creating the xml writer");		return data;	}	int error;	xmlTextWriterStartDocument(writer, NULL, "utf-8", NULL);	xmlTextWriterStartElement(writer, BAD_CAST "D:multistatus");		xmlTextWriterWriteAttribute(writer, BAD_CAST "xmlns:D" ,BAD_CAST "DAV:");			error=onion_webdav_write_props(writer, basepath, realpath, urlpath, NULL, props);			if (depth>0){				ONION_DEBUG("Get also all files");				DIR *dir=opendir(realpath);				if (!dir){					ONION_ERROR("Error opening dir %s to check files on it", realpath);				}				else{					struct dirent *de;					while ( (de=readdir(dir)) ){						if (de->d_name[0]!='.')							onion_webdav_write_props(writer, basepath, realpath, urlpath, de->d_name, props);					}					closedir(dir);				}			}		xmlTextWriterEndElement(writer);	xmlTextWriterEndElement(writer);			xmlTextWriterEndDocument(writer);	xmlFreeTextWriter(writer);		onion_block_add_str(data, (const char*)buf->content);	xmlBufferFree(buf);	if (error){		onion_block_free(data);		return NULL;	}	return data;}
开发者ID:hchtym,项目名称:onion,代码行数:61,


示例13: save_gpx

int save_gpx(const char *fname,GList *save_list){  time_t t=time(NULL);  struct tm tm;  GList *l;  xmlTextWriterPtr writer;  writer=xmlNewTextWriterFilename(fname,0);  if (!writer)    return 0;  xmlTextWriterStartDocument(writer,NULL,"UTF-8",NULL);  xmlTextWriterStartElement(writer,(xmlChar *)"gpx");  xmlTextWriterWriteAttribute(writer,(xmlChar *)"version",(xmlChar *)"1.0");  xmlTextWriterWriteAttribute(writer,(xmlChar *)"creator",(xmlChar *)PACKAGE " " VERSION);  xmlTextWriterWriteAttribute(writer,(xmlChar *)"xmlns:xsi",(xmlChar *)"http://www.w3.org/2001/XMLSchema-instance");  xmlTextWriterWriteAttribute(writer,(xmlChar *)"xmlns",			      (xmlChar *)"http://www.topografix.com/GPX/1/0");  xmlTextWriterWriteAttribute(writer,(xmlChar *)"xsi:schemaLocation",(xmlChar *)"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd");  tm=*gmtime(&t);  xmlTextWriterWriteFormatElement(writer,(xmlChar *)"time","%04d-%02d-%02dT%02d:%02d:%02d",			    tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,			    tm.tm_hour,tm.tm_min,tm.tm_sec);  xmlTextWriterStartElement(writer,(xmlChar *)"trk");  xmlTextWriterStartElement(writer,(xmlChar *)"trkseg");  for(l=g_list_first(save_list);l;l=g_list_next(l)) {    struct t_punkt32 *p=(struct t_punkt32 *)l->data;    xmlTextWriterStartElement(writer,(xmlChar *)"trkpt");    xmlTextWriterWriteFormatAttribute(writer,(xmlChar *)"lat","%f",				      p->latt);    xmlTextWriterWriteFormatAttribute(writer,(xmlChar *)"lon","%f",				      p->longg);    if (p->time) {      t=p->time;      tm=*gmtime(&t);      xmlTextWriterWriteFormatElement(writer,(xmlChar*)"time",				"%04d-%02d-%02dT%02d:%02d:%02d",				tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,				tm.tm_hour,tm.tm_min,tm.tm_sec);    }    if (p->speed>0)      xmlTextWriterWriteFormatElement(writer,(xmlChar *)"speed","%f",p->speed*1.852/3.6);    xmlTextWriterEndElement(writer); /* /trkpt */      }  xmlTextWriterEndElement(writer); /*trkseg */  xmlTextWriterEndElement(writer); /* trk */  xmlTextWriterEndElement(writer); /* gpx */  xmlTextWriterEndDocument(writer);  xmlFreeTextWriter(writer);  return 1;}
开发者ID:akemnade,项目名称:mumpot,代码行数:50,


示例14: xmls

bool c_XMLWriter::t_startdocument(const String& version /* = "1.0" */,                                  const String& encoding /* = null_string */,                                  const String& standalone /* = null_string */) {  int ret = -1;  if (m_ptr) {    const auto pencoding = encoding.empty() ? nullptr : xmls(encoding);    const auto pstandalone = standalone.empty() ? nullptr : xmls(standalone);    ret = xmlTextWriterStartDocument(m_ptr,                                     (const char *)xmls(version),                                     (const char *)pencoding,                                     (const char *)pstandalone);  }  return ret != -1;}
开发者ID:asvinours,项目名称:hhvm,代码行数:14,


示例15: xml_writer_write_start_document

/** * xml_writer_write_start_document: * @writer: A #XmlWriter * @version: the xml version ("1.0") or NULL for default ("1.0") * @encoding: the encoding or NULL for default * @standalone: yes" or "no" or NULL for default * * Starts a new xml document. You must be at the begging of a * stream for this to be successful. */voidxml_writer_write_start_document (XmlWriter   *writer,                                 const gchar *version,                                 const gchar *encoding,                                 const gchar *standalone){  XmlWriterPrivate *priv;    g_return_if_fail (XML_IS_WRITER (writer));    priv = writer->priv;    if (priv->writer)    xmlTextWriterStartDocument (priv->writer, version, encoding, standalone);}
开发者ID:chergert,项目名称:simply-news,代码行数:25,


示例16: xmlBufferCreate

char *gen_lote_xml(LOTE *lote, EVP_PKEY *key, X509 *cert){	int rc;	xmlTextWriterPtr writer;	xmlDocPtr doc;	xmlBufferPtr buf = xmlBufferCreate();	writer = xmlNewTextWriterDoc(&doc, 0);	if (writer == NULL)		return NULL;	xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);	rc = xmlTextWriterStartElement(writer, BAD_CAST "enviNFe");	if (rc < 0)		return NULL;	rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "xmlns",			BAD_CAST "http://www.portalfiscal.inf.br/nfe");	if (rc < 0)		return NULL;	rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "versao",			BAD_CAST NFE_VERSAO);	if (rc < 0)		return NULL;	rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "idLote",			"%d", lote->id);	if (rc < 0)		return NULL;	int indSinc = lote->qtd == 1? 1 : 0;	rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "indSinc",			"%d", indSinc);	if (rc < 0)		return NULL;	int i;	LOTE_ITEM *it = lote->nfes;	for (i = 0; i < lote->qtd; i++){		char *xml;		xml = generate_xml(it->nfe, key, cert);		printf("%s/n", xml);		rc = xmlTextWriterWriteRaw(writer, BAD_CAST xml);		if (rc < 0)			return NULL;		it = it->next;	}	rc = xmlTextWriterEndElement(writer);	if (rc < 0)		return NULL;	xmlTextWriterEndDocument(writer);	xmlNodeDump(buf, NULL, xmlDocGetRootElement(doc), 0, 0);	return (char*)buf->content;}
开发者ID:pablogallardo,项目名称:livrenfe,代码行数:48,


示例17: _exml_write

static int _exml_write(EXML *xml, xmlTextWriterPtr writer){	xmlTextWriterSetIndent( writer, 1 );	xmlTextWriterSetIndentString( writer, (xmlChar *) "/t" );	xmlTextWriterStartDocument( writer, NULL, NULL, NULL );	/* as of now, we do not write a DTD.  This will be in effect with a new	 * set of functions designed to manipulate the DTD, as well as added	 * capability for reading DTDs from orthogonal read sources */	_exml_write_element(xml->top, writer);	xmlTextWriterEndDocument( writer );	xmlFreeTextWriter( writer );	return TRUE;}
开发者ID:playya,项目名称:Enlightenment,代码行数:16,


示例18: FileWriterException

//-----------------------------------------void LegacyWriter::write() {//-----------------------------------------    #ifndef LIBXML_READER_ENABLED    throw FileWriterException( "LIBXML NOT FOUND" );    #endif    cout << "INFO Start writing the file (gexf v1.0).." << endl;    /*     * this initialize the library and check potential ABI mismatches     * between the version it was compiled for and the actual shared     * library used.     */    LIBXML_TEST_VERSION    /* Create a new XmlWriter for _filepath, with no compression. */    xmlTextWriterPtr writer = xmlNewTextWriterFilename(_filepath.c_str(), 0);    if (writer == NULL) {        throw FileWriterException( "Error creating the xml LegacyWriter" );    }    /* Start the document with the xml default for the version,     * encoding _ENCODING and the default for the standalone     * declaration. */    int rc = xmlTextWriterStartDocument(writer, NULL, _ENCODING, NULL);    if (rc < 0) {        throw FileWriterException( "Error at xmlTextWriterStartDocument" );    }    this->writeGexfNode(writer);        /* Here we could close the elements ORDER and EXAMPLE using the     * function xmlTextWriterEndElement, but since we do not want to     * write any other elements, we simply call xmlTextWriterEndDocument,     * which will do all the work. */    rc = xmlTextWriterEndDocument(writer);    if (rc < 0) {        throw FileWriterException( "Error at xmlTextWriterEndDocument" );    }    /* Close file and free memory buffers */    xmlFreeTextWriter(writer);    xmlCleanupParser();    cout << "INFO File written." << endl;}
开发者ID:ggutierrez,项目名称:cprel-packages,代码行数:47,


示例19: xmlNewTextWriterDoc

void ZXMLDoc::begin(){	/* Create a new XmlWriter for DOM, with no compression. */    writer = xmlNewTextWriterDoc(&doc, 0);    if (writer == NULL) {        printf("testXmlwriterDoc: Error creating the xml writer/n");        return;    }		/* Start the document with the xml default for the version,     * encoding ISO 8859-1 and the default for the standalone     * declaration. */    rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);    if (rc < 0) {        printf("testXmlwriterDoc: Error at xmlTextWriterStartDocument/n");        return;    }}
开发者ID:GunioRobot,项目名称:algae,代码行数:18,


示例20: axis2_libxml2_writer_wrapper_write_start_document

axis2_status_t AXIS2_CALLaxis2_libxml2_writer_wrapper_write_start_document(    axiom_xml_writer_t * writer,    const axutil_env_t * env){    axis2_libxml2_writer_wrapper_impl_t *wrapper_impl = NULL;    int status = 0;    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);    wrapper_impl = AXIS2_INTF_TO_IMPL(writer);    status = xmlTextWriterStartDocument(wrapper_impl->xml_writer, NULL, NULL, NULL);    if(status < 0)    {        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_START_DOCUMENT, AXIS2_FAILURE);        return AXIS2_FAILURE;    }    return AXIS2_SUCCESS;}
开发者ID:alexis-gruet,项目名称:axis2c-trunk,代码行数:18,


示例21: createDatabase

int createDatabase(){	time_t now;	struct tm * timeinfo;	int rc;	xmlTextWriterPtr writer;	writer = xmlNewTextWriterFilename(db_uri, 0);	if(writer == NULL){		printf("Error creating the xml writer/n");		return 1;	}	rc = xmlTextWriterStartDocument(writer, NULL, ENCODING, NULL);	if(rc < 0){		printf("Error starting the document/n");		return 1;	}	rc = xmlTextWriterStartElement(writer, BAD_CAST "remendo_db");	if(rc < 0){		printf("Error creating the root element in the XML file/n");		return 1;	}	now = time(0);	timeinfo = localtime (&now);	xmlChar string_date [80];	strftime(string_date,80,"%s",timeinfo);	rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "creation", string_date);	if(rc < 0){		printf("Error creating attribute of root element/n");		return 1;	}	rc = xmlTextWriterEndElement(writer);	if(rc < 0){		printf("Error ending the XML file/n");		return 1;	}	xmlFreeTextWriter(writer);	xmlCleanupParser();	return 0;}
开发者ID:Antergos,项目名称:remendo,代码行数:44,


示例22: encoding

cpXmlCmdOutput::cpXmlCmdOutput( const char* ResultDocumentFileName )   : encoding( (const xmlChar*) "ISO-8859-1" )   , cpXmlCmdNamespace( (const xmlChar*) "http://www.XmlCommandLine.org/cpXmlCmd/1.0" ){   /* Create a new XmlWriter for uri, with no compression. */   writer = xmlNewTextWriterFilename( ResultDocumentFileName, 0 );   if ( writer == NULL )      throw ::std::runtime_error( "Error creating the xml writer" );   /* Start the document with the xml default for the version,    * encoding ISO 8859-1 and the default for the standalone    * declaration. */   if ( xmlTextWriterStartDocument( writer, NULL, (const char*)encoding, NULL ) < 0 )      throw ::std::runtime_error( "Error starting the output document" );   // Start root element   if ( xmlTextWriterStartElementNS( writer, NULL, (xmlChar *) "cpXmlCmdLog", cpXmlCmdNamespace ) < 0 )      throw ::std::runtime_error( "Error writing to the output document" );}
开发者ID:jsprenkle,项目名称:cpXmlCmd,代码行数:19,


示例23: NOVA_EXP

void CResource::SerializeToXmlFile(const nstring &file){    xmlTextWriterPtr writer = NULL;    /* Create a new XmlWriter for uri, with no compression. */    if((writer = xmlNewTextWriterFilename(file.c_str(), 0)) == NULL)		NOVA_EXP("CResource::SerializeToXmlFile: Error creating the xml writer", BAD_OPERATION);	// automatic indentation for readability	xmlTextWriterSetIndent(writer, 1);	if(xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL) < 0)		NOVA_EXP("CResource::SerializeToXmlFile: xmlTextWriterStartDocument fail", BAD_OPERATION);	if(xmlTextWriterStartElement(writer, BAD_CAST "NovaResource") < 0)		NOVA_EXP("CResource::SerializeToXmlFile: xmlTextWriterStartElement fail", BAD_OPERATION);    if(xmlTextWriterWriteComment(writer, BAD_CAST "Common resource header") < 0)		NOVA_EXP("CResource::SerializeToXmlFile: xmlTextWriterWriteComment fail", BAD_OPERATION);	if(xmlTextWriterStartElement(writer, BAD_CAST "ResourceHeader") < 0)		NOVA_EXP("CResource::SerializeToXmlFile: xmlTextWriterStartElement fail", BAD_OPERATION);	if(xmlTextWriterWriteElement(writer, BAD_CAST "ResourceName", BAD_CAST mName.c_str()) < 0)		NOVA_EXP("CResource::SerializeToXmlFile: xmlTextWriterWriteElement fail", BAD_OPERATION);	if(xmlTextWriterWriteElement(writer, BAD_CAST "ResourceGroup", BAD_CAST mGroup.c_str()) < 0)		NOVA_EXP("CResource::SerializeToXmlFile: xmlTextWriterWriteElement fail", BAD_OPERATION);	if(xmlTextWriterStartElement(writer, BAD_CAST "ResourceData") < 0)		NOVA_EXP("CResource::SerializeToXmlFile: xmlTextWriterStartElement fail", BAD_OPERATION);// Resource manager attribute	if(xmlTextWriterWriteAttribute(writer, BAD_CAST "ResourceFactory", BAD_CAST GetCreator()->GetResourceFactoryName().c_str()) < 0)		NOVA_EXP("CImage::SerializeToXmlFileImpl: xmlTextWriterWriteAttribute fail", BAD_OPERATION);	SerializeToXmlFileImpl(writer);    xmlTextWriterEndDocument(writer);	xmlFreeTextWriter(writer);}
开发者ID:Siriuscoder,项目名称:NovaEngine,代码行数:41,


示例24: output

static voidoutput (char **roots){  xmlOutputBufferPtr ob = xmlOutputBufferCreateFd (1, NULL);  if (ob == NULL)    error (EXIT_FAILURE, 0,           _("xmlOutputBufferCreateFd: failed to open stdout"));  /* 'ob' is freed when 'xo' is freed.. */  CLEANUP_XMLFREETEXTWRITER xmlTextWriterPtr xo = xmlNewTextWriter (ob);  if (xo == NULL)    error (EXIT_FAILURE, 0,           _("xmlNewTextWriter: failed to create libxml2 writer"));  /* Pretty-print the output. */  XMLERROR (-1, xmlTextWriterSetIndent (xo, 1));  XMLERROR (-1, xmlTextWriterSetIndentString (xo, BAD_CAST "  "));  XMLERROR (-1, xmlTextWriterStartDocument (xo, NULL, NULL, NULL));  output_roots (xo, roots);  XMLERROR (-1, xmlTextWriterEndDocument (xo));}
开发者ID:noxdafox,项目名称:libguestfs,代码行数:22,


示例25: xmlTextWriterStartDocument

bool WebArchiveAndroid::saveWebArchive(xmlTextWriterPtr writer){    const char* const defaultXmlVersion = 0;    const char* const defaultEncoding = 0;    const char* const defaultStandalone = 0;    int result = xmlTextWriterStartDocument(writer, defaultXmlVersion, defaultEncoding, defaultStandalone);    if (result < 0) {        LOGD("saveWebArchive: Failed to start document.");        return false;    }    if (!saveArchive(writer, this))        return false;    result = xmlTextWriterEndDocument(writer);    if (result< 0) {        LOGD("saveWebArchive: Failed to end document.");        return false;    }    return true;}
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:23,


示例26: generate_report

int generate_report(char dst_dir[DIR_LENGTH_MAX], char filename[FILENAME_LENGTH_MAX]){  // for the xml writer, refer to http://xmlsoft.org/html/libxml-xmlwriter.html  char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";  strncat(dst_file, dst_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(dst_file) - 1);  strncat(dst_file, filename, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(dst_file) - 1);  xmlTextWriterPtr writer;  writer = xmlNewTextWriterFilename(dst_file, 0);  // set the output format of the XML file  xmlTextWriterSetIndent(writer, 1);  xmlTextWriterSetIndentString(writer,(unsigned char*) "	");  xmlTextWriterStartDocument(writer, NULL, NULL, NULL);  /* Write an element named "X_ORDER_ID" as child of HEADER. */  xmlTextWriterWriteFormatElement(writer,(unsigned char*) "COMMENT           ", "	in this output file, %d means NOT_PROCESSED; %d means NO_FILE; %d means ERROR; %d means OK	", MODULE_NOT_PROCESSED,                                  NO_FILE, MODULE_ERROR, MODULE_OK);  xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_GET_OPT       ", "	%d	", get_opt_OK);  xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_DETECT_FILE   ", "	%d	", detect_file_OK);  xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_PARSE_FILENAME", "	%d	", parse_filename_OK);  xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_CREATE_DIR    ", "	%d	", create_dir_OK);  xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_PARSE_XML     ", "	%d	", parse_XML_OK);  xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_SAVE_XML      ", "	%d	", save_XML_OK);  //  xmlTextWriterWriteFormatElement(writer, "OCG_CALL_EMU      ", " %d  ", call_emu_OK);  xmlTextWriterEndDocument(writer);  xmlFreeTextWriter(writer);  LOG_I(OCG, "A report of OCG is generated in directory /"%s/"/n/n", dst_dir);  return MODULE_OK;}
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:36,


示例27: create_file

void create_file(char *to, char *from, char *msg){	int rc;	xmlTextWriterPtr writer;	xmlDocPtr doc;	xmlNodePtr node, root;	xmlChar *tmp;	if(doc = xmlParseFile(to)){		root = xmlDocGetRootElement(doc);		xmlNodePtr pNode = xmlNewNode(0, (xmlChar*)"mes");		//xmlSetProp(pNode, (const xmlChar*) "id", (const xmlChar*) "val");		xmlSetProp(pNode, (const xmlChar*) "from", (const xmlChar*) from);		xmlNodeSetContent(pNode, (xmlChar*)msg);		xmlAddChild(root, pNode);		xmlSaveFileEnc(to, doc, MY_ENCODING);		xmlFreeDoc(doc);	}else{		doc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);		node = xmlNewDocNode(doc, NULL, BAD_CAST "inbox", NULL);		xmlDocSetRootElement(doc, node);		writer = xmlNewTextWriterTree(doc, node, 0);		rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);		rc = xmlTextWriterStartElement(writer, BAD_CAST "mes");		//rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "id", BAD_CAST "1");		rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "from", BAD_CAST from);		rc = xmlTextWriterEndAttribute(writer);		rc = xmlTextWriterWriteString(writer, (const xmlChar*) msg);		rc = xmlTextWriterEndElement(writer);		rc = xmlTextWriterEndDocument(writer);		xmlFreeTextWriter(writer);		xmlSaveFileEnc(to, doc, MY_ENCODING);		xmlFreeDoc(doc);	}}
开发者ID:h31,项目名称:NetworksCourseBackup,代码行数:36,



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


C++ xmlTextWriterStartElement函数代码示例
C++ xmlTextWriterEndElement函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。