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

Function xmlTextWriterEndDocument

ThirdParty/libxml2/vtklibxml2/xmlwriter.c:627–707  ·  view source on GitHub ↗

* xmlTextWriterEndDocument: * @writer: the xmlTextWriterPtr * * End an xml document. All open elements are closed, and * the content is flushed to the output. * * Returns the bytes written or -1 in case of error */

Source from the content-addressed store, hash-verified

625 * Returns the bytes written or -1 in case of error
626 */
627int
628xmlTextWriterEndDocument(xmlTextWriterPtr writer)
629{
630 int count;
631 int sum;
632 xmlLinkPtr lk;
633 xmlTextWriterStackEntry *p;
634
635 if (writer == NULL) {
636 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
637 "xmlTextWriterEndDocument : invalid writer!\n");
638 return -1;
639 }
640
641 sum = 0;
642 while ((lk = xmlListFront(writer->nodes)) != NULL) {
643 p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk);
644 if (p == 0)
645 break;
646 switch (p->state) {
647 case XML_TEXTWRITER_NAME:
648 case XML_TEXTWRITER_ATTRIBUTE:
649 case XML_TEXTWRITER_TEXT:
650 count = xmlTextWriterEndElement(writer);
651 if (count < 0)
652 return -1;
653 sum += count;
654 break;
655 case XML_TEXTWRITER_PI:
656 case XML_TEXTWRITER_PI_TEXT:
657 count = xmlTextWriterEndPI(writer);
658 if (count < 0)
659 return -1;
660 sum += count;
661 break;
662 case XML_TEXTWRITER_CDATA:
663 count = xmlTextWriterEndCDATA(writer);
664 if (count < 0)
665 return -1;
666 sum += count;
667 break;
668 case XML_TEXTWRITER_DTD:
669 case XML_TEXTWRITER_DTD_TEXT:
670 case XML_TEXTWRITER_DTD_ELEM:
671 case XML_TEXTWRITER_DTD_ELEM_TEXT:
672 case XML_TEXTWRITER_DTD_ATTL:
673 case XML_TEXTWRITER_DTD_ATTL_TEXT:
674 case XML_TEXTWRITER_DTD_ENTY:
675 case XML_TEXTWRITER_DTD_ENTY_TEXT:
676 case XML_TEXTWRITER_DTD_PENT:
677 count = xmlTextWriterEndDTD(writer);
678 if (count < 0)
679 return -1;
680 sum += count;
681 break;
682 case XML_TEXTWRITER_COMMENT:
683 count = xmlTextWriterEndComment(writer);
684 if (count < 0)

Callers

nothing calls this directly

Calls 10

xmlWriterErrMsgFunction · 0.85
xmlListFrontFunction · 0.85
xmlLinkGetDataFunction · 0.85
xmlTextWriterEndElementFunction · 0.85
xmlTextWriterEndPIFunction · 0.85
xmlTextWriterEndCDATAFunction · 0.85
xmlTextWriterEndDTDFunction · 0.85
xmlTextWriterEndCommentFunction · 0.85
xmlTextWriterFlushFunction · 0.85

Tested by

no test coverage detected