diff options
-rw-r--r-- | project2/xml/transformHtml.cpp | 8 | ||||
-rw-r--r-- | project2/xml/transformHtml.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/project2/xml/transformHtml.cpp b/project2/xml/transformHtml.cpp index f6a0431..7c784bd 100644 --- a/project2/xml/transformHtml.cpp +++ b/project2/xml/transformHtml.cpp @@ -38,7 +38,12 @@ void HtmlDocument::writeTo(std::ostream & o, const std::string & encoding) const { xmlOutputBufferPtr buf = xmlOutputBufferCreateIO(xmlstrmwritecallback, xmlstrmclosecallback, &o, NULL); - htmlDocContentDumpFormatOutput(buf, doc, encoding.c_str(), 0); + if (method == "html") { + htmlDocContentDumpFormatOutput(buf, doc, encoding.c_str(), 0); + } + else { + xmlNodeDumpOutput(buf, doc, doc->children, 0, 0, encoding.c_str()); + } xmlOutputBufferClose(buf); } @@ -72,6 +77,7 @@ class TransformXmlToHtml : public TransformImpl<xmlpp::Document, HtmlDocument> { throw xmlpp::exception("Failed to perform transformation"); } result->contentType = (char*)(cur.get()->mediaType); + result->method = (char*)(cur.get()->method); } }; diff --git a/project2/xml/transformHtml.h b/project2/xml/transformHtml.h index 0a6c432..cdc8906 100644 --- a/project2/xml/transformHtml.h +++ b/project2/xml/transformHtml.h @@ -15,6 +15,7 @@ class HtmlDocument : public SourceOf<HtmlDocument>, public WritableContent, publ Glib::ustring getContentType() const; void writeTo(std::ostream &, const std::string & encoding) const; Glib::ustring contentType; + Glib::ustring method; }; #endif |