* xmlBufDumpEntityDecl: * @buf: an xmlBufPtr output * @ent: An entity table * * This will dump the content of the entity table as an XML DTD definition */
| 744 | * This will dump the content of the entity table as an XML DTD definition |
| 745 | */ |
| 746 | static void |
| 747 | xmlBufDumpEntityDecl(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 | * * |
no test coverage detected