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

Function xmlBufDumpEntityDecl

ThirdParty/libxml2/vtklibxml2/xmlsave.c:746–788  ·  view source on GitHub ↗

* xmlBufDumpEntityDecl: * @buf: an xmlBufPtr output * @ent: An entity table * * This will dump the content of the entity table as an XML DTD definition */

Source from the content-addressed store, hash-verified

744 * This will dump the content of the entity table as an XML DTD definition
745 */
746static void
747xmlBufDumpEntityDecl(xmlOutputBufferPtr buf, xmlEntityPtr ent) {
748 if ((ent->etype == XML_INTERNAL_PARAMETER_ENTITY) ||
749 (ent->etype == XML_EXTERNAL_PARAMETER_ENTITY))
750 xmlOutputBufferWrite(buf, 11, "<!ENTITY % ");
751 else
752 xmlOutputBufferWrite(buf, 9, "<!ENTITY ");
753 xmlOutputBufferWriteString(buf, (const char *) ent->name);
754 xmlOutputBufferWrite(buf, 1, " ");
755
756 if ((ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
757 (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) ||
758 (ent->etype == XML_EXTERNAL_PARAMETER_ENTITY)) {
759 if (ent->ExternalID != NULL) {
760 xmlOutputBufferWrite(buf, 7, "PUBLIC ");
761 xmlOutputBufferWriteQuotedString(buf, ent->ExternalID);
762 xmlOutputBufferWrite(buf, 1, " ");
763 } else {
764 xmlOutputBufferWrite(buf, 7, "SYSTEM ");
765 }
766 xmlOutputBufferWriteQuotedString(buf, ent->SystemID);
767 }
768
769 if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
770 if (ent->content != NULL) { /* Should be true ! */
771 xmlOutputBufferWrite(buf, 7, " NDATA ");
772 if (ent->orig != NULL)
773 xmlOutputBufferWriteString(buf, (const char *) ent->orig);
774 else
775 xmlOutputBufferWriteString(buf, (const char *) ent->content);
776 }
777 }
778
779 if ((ent->etype == XML_INTERNAL_GENERAL_ENTITY) ||
780 (ent->etype == XML_INTERNAL_PARAMETER_ENTITY)) {
781 if (ent->orig != NULL)
782 xmlOutputBufferWriteQuotedString(buf, ent->orig);
783 else
784 xmlBufDumpEntityContent(buf, ent->content);
785 }
786
787 xmlOutputBufferWrite(buf, 2, ">\n");
788}
789
790/************************************************************************
791 * *

Callers 2

xhtmlNodeDumpOutputFunction · 0.85

Calls 4

xmlOutputBufferWriteFunction · 0.85
xmlBufDumpEntityContentFunction · 0.85

Tested by

no test coverage detected