るりまサーチ

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

別のキーワード

  1. rexml/document new
  2. rexml/document clone
  3. rexml/document to_s
  4. rexml/document node_type

検索結果

<< < 1 2 3 >>

REXML::Formatters::Transitive (8018.0)

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

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

transitive_formatter = REXML::Formatters::Transitive.new
output = StringIO.new
transitive_formatter.write(doc, output)
output...
...>> <root
# >> ><children
# >> >
# >> <grandchildren foo='bar'
# >> />
# >> </children
# >> ></root
# >> >

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

REXML::Formatters::Pretty (8012.0)

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

...//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.strin...

REXML::Entity#to_s -> String (8006.0)

実体宣言を文字列化したものを返します。

...実体宣言を文字列化したものを返します。

@see REXML::Entity#write

//emlist[][ruby]{
e = REXML::ENTITY.new("w", "wee");
p e.to_s # => "<!ENTITY w \"wee\">"
//}...
<< < 1 2 3 >>