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

Function xmlTextWriterOutputNSDecl

ThirdParty/libxml2/vtklibxml2/xmlwriter.c:4332–4369  ·  view source on GitHub ↗

* xmlTextWriterOutputNSDecl: * @writer: the xmlTextWriterPtr * * Output the current namespace declarations. */

Source from the content-addressed store, hash-verified

4330 * Output the current namespace declarations.
4331 */
4332static int
4333xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer)
4334{
4335 xmlLinkPtr lk;
4336 xmlTextWriterNsStackEntry *np;
4337 int count;
4338 int sum;
4339
4340 sum = 0;
4341 while (!xmlListEmpty(writer->nsstack)) {
4342 xmlChar *namespaceURI = NULL;
4343 xmlChar *prefix = NULL;
4344
4345 lk = xmlListFront(writer->nsstack);
4346 np = (xmlTextWriterNsStackEntry *) xmlLinkGetData(lk);
4347
4348 if (np != 0) {
4349 namespaceURI = xmlStrdup(np->uri);
4350 prefix = xmlStrdup(np->prefix);
4351 }
4352
4353 xmlListPopFront(writer->nsstack);
4354
4355 if (np != 0) {
4356 count = xmlTextWriterWriteAttribute(writer, prefix, namespaceURI);
4357 xmlFree(namespaceURI);
4358 xmlFree(prefix);
4359
4360 if (count < 0) {
4361 xmlListDelete(writer->nsstack);
4362 writer->nsstack = NULL;
4363 return -1;
4364 }
4365 sum += count;
4366 }
4367 }
4368 return sum;
4369}
4370
4371/**
4372 * xmlFreeTextWriterNsStackEntry:

Callers 7

xmlTextWriterEndElementFunction · 0.85
xmlTextWriterStartPIFunction · 0.85
xmlTextWriterStartCDATAFunction · 0.85

Calls 7

xmlListEmptyFunction · 0.85
xmlListFrontFunction · 0.85
xmlLinkGetDataFunction · 0.85
xmlStrdupFunction · 0.85
xmlListPopFrontFunction · 0.85
xmlListDeleteFunction · 0.85

Tested by

no test coverage detected