diff options
-rw-r--r-- | genx.c | 37 | ||||
-rw-r--r-- | genx.h | 8 |
2 files changed, 45 insertions, 0 deletions
@@ -2098,6 +2098,43 @@ genxStatus genxEndDocument(genxWriter w) return GENX_SUCCESS; } +genxStatus genxXmlDeclaration(genxWriter w, + constUtf8 ver, + constUtf8 enc, + constUtf8 stl) +{ + if (w->sequence != SEQUENCE_PRE_DOC) + return w->status = GENX_SEQUENCE_ERROR; + + if ((w->status = genxCheckText(w, ver)) != GENX_SUCCESS) + return w->status; + + if (enc != NULL && (w->status = genxCheckText(w, enc)) != GENX_SUCCESS) + return w->status; + + if (stl != NULL && (w->status = genxCheckText(w, stl)) != GENX_SUCCESS) + return w->status; + + SendCheck (w, "<?xml version=\""); + SendCheck (w, ver); + + if (enc != NULL) + { + SendCheck (w, "\" encoding=\""); + SendCheck (w, enc); + } + + if (stl != NULL) + { + SendCheck (w, "\" standalone=\""); + SendCheck (w, stl); + } + + SendCheck (w, "\" ?>\n"); + + return GENX_SUCCESS; +} + genxStatus genxComment(genxWriter w, constUtf8 text) { int i; @@ -195,6 +195,14 @@ genxStatus genxStartDocSender(genxWriter w, genxSender * sender); genxStatus genxEndDocument(genxWriter w); /* + * Write XML declaration. If encoding or standalone are NULL, then those + * attributes are omitted. + */ +genxStatus genxXmlDeclaration(genxWriter w, + constUtf8 version, + constUtf8 encoding, + constUtf8 standalone); +/* * Write a comment */ genxStatus genxComment(genxWriter w, constUtf8 text); |