Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > rexml/documentライブラリ > REXML::DocTypeクラス > write
write(output, indent = 0, transitive = false, ie_hack = false) -> ()
[permalink][rdoc]output に DTD を出力します。
このメソッドは deprecated です。REXML::Formatter で出力してください。
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book
author CDATA #REQUIRED
title CDATA #REQUIRED
publisher CDATA "foobar publisher">
<!ENTITY p "foobar publisher">
<!ENTITY % q "quzz">
]>
EOS
doctype.write(STDOUT)
# =>
# <!DOCTYPE books [
# <!ELEMENT book (comment)>
# ....