るりまサーチ

最速Rubyリファレンスマニュアル検索!
84件ヒット [1-84件を表示] (0.017秒)
トップページ > クエリ:document[x] > クエリ:root[x] > 種類:クラス[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

REXML::Document (6025.0)

XMLの完全な文書(ドキュメント)を表すクラス。

...理命令(Processing Instruction, PI)、
DTD(文書型定義、Document Type Definition)、
などを含んでいます。
ドキュメントは直下の子ノードをただ一つ持っています(rootと呼び、
REXML::Document#root でアクセスできます)。
2つ目の要素を(REXML::Elem...

Psych::Nodes::Document (6013.0)

YAML ドキュメントを表すクラスです。

...またこの子ノードは以下のいずれかである必要があります。
* Psych::Nodes::Sequence
* Psych::Nodes::Mapping
* Psych::Nodes::Scalar
この唯一の子ノードは「ルート」とも呼ばれ、Psych::Nodes::Document#root
アクセスすることができます。...

REXML::Formatters::Default (55.0)

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

...quire '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
# => "<children>\n <grandchildren/>\n</children>"

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

REXML::Formatters::Transitive (55.0)

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

...xml/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.string
# => "<root\n>...
...foo='bar'\n />\n</children\n ></root\n>\n"
print output.string
# >> <root
# >> ><children
# >> >
# >> <grandchildren foo='bar'
# >> />
# >> </children
# >> ></root
# >> >

output = StringIO.new
transitive_formatter.write(REXML::XPath.first(doc, "/root/children"), output)
output.string
#...

REXML::Comment (37.0)

XML コメントを表すクラス。

...コメントとは <!-- と --> で挟まれたテキストです。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<!-- xx -->
<root>
<!-- yy -->
text
<!-- zz -->
</root>
EOS

doc[0].string # => " xx "
doc.root[1].string # => " yy "
doc.root[3].string # => " zz "
//}...

絞り込み条件を変える

REXML::Formatters::Pretty (37.0)

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

...re '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 <chil...
...dren>\n <grandchildren foo='bar'/>\n </children>\n</root>"
# この出力結果は入力のXMLよりも空白が増えている
//}...

REXML::Instruction (19.0)

XML 処理命令(XML Processing Instruction, XML PI)を表すクラス。

...
似た見た目を持っています。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<root />
EOS
doc[2] # => <?p-i xml-stylesheet ...?>
doc[2].target # => "xml-stylesheet"...