るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.094秒)

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. t61string new
  4. matrix t
  5. fiddle sizeof_size_t

クラス

キーワード

検索結果

REXML::DocType#write(output, indent = 0, transitive = false, ie_hack = false) -> () (24215.0)

output に DTD を出力します。

...output に DTD を出力します。

このメソッドは deprecated です。REXML::Formatter で
出力してください。

@param output 出力先の IO オブジェクト
@param indent インデントの深さ。指定しないでください。
@param transitive 無視されます。指定...
.../emlist[][ruby]{
require
'rexml/document'

doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book
author CDATA #REQUIRED
t
itle CDATA #REQUIRED
publisher CDATA "foobar publisher">
<!ENTITY p "f...
...oobar publisher">
<!ENTITY % q "quzz">
]>
EOS

doctype.write(STDOUT)
# =>
# <!DOCTYPE books [
# <!ELEMENT book (comment)>
# ....
//}...

REXML::Formatters::Pretty (9020.0)

XMLドキュメントを(文字列として)見た目良く出力するクラスです。

...matters::Default
異なり見た目のためテキストの改行や空白を修正して出力します。

//emlist[][ruby]{
require
'rexml/document'
require
'rexml/formatters/pretty'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren foo='bar'/>
</children>
</root>
EOS

pretty...
..._formatter = REXML::Formatters::Pretty.new
output = StringIO.new
pretty_formatter.write(doc, output)
output.string
# => "<root>\n <children>\n <grandchildren foo='bar'/>\n </children>\n</root>"
# この出力結果は入力のXMLよりも空白が増えている
//}...

REXML::Formatters::Default (6032.0)

XMLドキュメントを(文字列として)出力するクラスです。

...rmatters::Pretty と
異なりテキストの改行や空白を修正せずにそのまま出力します。

//emlist[][ruby]{
require
'rexml/document'
require
'rexml/formatters/default'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren/>
</children>
</root>
EOS

default_formatter...
...= REXML::Formatters::Default.new
output = StringIO.new
default_formatter.write(doc, output)
output.string
# => "<root>\n<children>\n <grandchildren/>\n</children>\n</root>\n"

output = StringIO.new
default_formatter.write(REXML::XPath.first(doc, "/root/children"), output)
output.string
# => "<child...
...ren>\n <grandchildren/>\n</children>"

ie_hack_formatter = REXML::Formatters::Default.new(true)
output = StringIO.new
ie_hack_formatter.write(doc, output)
output.string
# => "<root>\n<children>\n <grandchildren />\n</children>\n</root>\n"
//}...

REXML::Formatters::Transitive (6026.0)

XMLドキュメントをテキストの内容を変えずに 多少の整形を加えて出力するクラスです。

...t[][ruby]{
require
'rexml/document'
require
'rexml/formatters/transitive'
doc = REXML::Document.new <<EOS
<root><children>
<grandchildren foo='bar' />
</children></root>
EOS

t
ransitive_formatter = REXML::Formatters::Transitive.new
output = StringIO.new
t
ransitive_formatter.write(doc, output)
output...
....string
# => "<root\n><children\n >\n<grandchildren foo='bar'\n />\n</children\n ></root\n>\n"
print output.string
# >> <root
# >> ><children
# >> >
# >> <grandchildren foo='bar'
# >> />
# >> </children
# >> ></root
# >> >

output = StringIO.new
t
ransitive_formatter.write(REXML::XPath.f...
...irst(doc, "/root/children"), output)
output.string
# => "<children\n>\n<grandchildren foo='bar'\n />\n</children\n>"
//}...