浏览代码

cmXMLWriter: add Doctype() method

Daniel Pfeifer 10 年之前
父节点
当前提交
d740762181
共有 2 个文件被更改,包括 9 次插入0 次删除
  1. 7 0
      Source/cmXMLWriter.cxx
  2. 2 0
      Source/cmXMLWriter.h

+ 7 - 0
Source/cmXMLWriter.cxx

@@ -92,6 +92,13 @@ void cmXMLWriter::CData(std::string const& data)
   this->Output << "<![CDATA[" << data << "]]>";
 }
 
+void cmXMLWriter::Doctype(const char* doctype)
+{
+  this->CloseStartElement();
+  this->ConditionalLineBreak(!this->IsContent, this->Elements.size());
+  this->Output << "<!DOCTYPE " << doctype << ">";
+}
+
 void cmXMLWriter::ProcessingInstruction(const char* target, const char* data)
 {
   this->CloseStartElement();

+ 2 - 0
Source/cmXMLWriter.h

@@ -62,6 +62,8 @@ public:
 
   void CData(std::string const& data);
 
+  void Doctype(const char* doctype);
+
   void ProcessingInstruction(const char* target, const char* data);
 
   void FragmentFile(const char* fname);