MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlNewTextWriter

Function xmlNewTextWriter

ThirdParty/libxml2/vtklibxml2/xmlwriter.c:169–219  ·  view source on GitHub ↗

* xmlNewTextWriter: * @out: an xmlOutputBufferPtr * * Create a new xmlNewTextWriter structure using an xmlOutputBufferPtr * NOTE: the @out parameter will be deallocated when the writer is closed * (if the call succeed.) * * Returns the new xmlTextWriterPtr or NULL in case of error */

Source from the content-addressed store, hash-verified

167 * Returns the new xmlTextWriterPtr or NULL in case of error
168 */
169xmlTextWriterPtr
170xmlNewTextWriter(xmlOutputBufferPtr out)
171{
172 xmlTextWriterPtr ret;
173
174 ret = (xmlTextWriterPtr) xmlMalloc(sizeof(xmlTextWriter));
175 if (ret == NULL) {
176 xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
177 "xmlNewTextWriter : out of memory!\n");
178 return NULL;
179 }
180 memset(ret, 0, sizeof(xmlTextWriter));
181
182 ret->nodes = xmlListCreate(xmlFreeTextWriterStackEntry,
183 xmlCmpTextWriterStackEntry);
184 if (ret->nodes == NULL) {
185 xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
186 "xmlNewTextWriter : out of memory!\n");
187 xmlFree(ret);
188 return NULL;
189 }
190
191 ret->nsstack = xmlListCreate(xmlFreeTextWriterNsStackEntry,
192 xmlCmpTextWriterNsStackEntry);
193 if (ret->nsstack == NULL) {
194 xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
195 "xmlNewTextWriter : out of memory!\n");
196 xmlListDelete(ret->nodes);
197 xmlFree(ret);
198 return NULL;
199 }
200
201 ret->out = out;
202 ret->ichar = xmlStrdup(BAD_CAST " ");
203 ret->qchar = '"';
204
205 if (!ret->ichar) {
206 xmlListDelete(ret->nodes);
207 xmlListDelete(ret->nsstack);
208 xmlFree(ret);
209 xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
210 "xmlNewTextWriter : out of memory!\n");
211 return NULL;
212 }
213
214 ret->doc = xmlNewDoc(NULL);
215
216 ret->no_doc_free = 0;
217
218 return ret;
219}
220
221/**
222 * xmlNewTextWriterFilename:

Callers 3

xmlNewTextWriterFilenameFunction · 0.85
xmlNewTextWriterMemoryFunction · 0.85

Calls 5

xmlWriterErrMsgFunction · 0.85
xmlListCreateFunction · 0.85
xmlListDeleteFunction · 0.85
xmlStrdupFunction · 0.85
xmlNewDocFunction · 0.85

Tested by

no test coverage detected