るりまサーチ

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

別のキーワード

  1. pstore root?
  2. psych root
  3. document root
  4. pathname root?
  5. rexml/document root

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 > >>

REXML::XPath.first(element, path = nil, namespaces = {}, variables = {}) -> Node | nil (18167.0)

element の path で指定した XPath 文字列にマッチする最初のノードを 返します。

...nt.new(<<EOS)
<root xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS

a = doc.root.elements[1] # => <a> ... </>
b1 = REXML::XPath.first(a, "b")
b1.text # => "b1"

REXML::XPath.first(doc, "/root/a/x:c") # => <x:c/>
REXML::XPath.first(a, "x:c") # =>...
...<x:c/>
REXML::XPath.first(a, "y:c") # => nil
REXML::XPath.first(a, "y:c", {"y" => "1"}) # => <x:c/>
b2 = REXML::XPath.first(doc, "/root/a/b[text()=$v]", {}, {"v" => "b2"})
b2 # => <b> ... </>
b2.text # => "b2"
//}...

REXML::Element#root -> REXML::Element (18161.0)

self が属する文書のルート要素を返します。

...REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS

children = doc.get_elements("/root/children").first
children.name # => "children"
children.root.name # => "root"
grandchildren = doc.get_elements("/root/children/grandchildren").first
grandchildren.name # => "g...
...randchildren"
grandchildren.root.name # => "root"
//}...

REXML::Element#root_node -> REXML::Document | REXML::Node (6149.0)

self が属する文書のルートノードを返します。

...ML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS

children = doc.get_elements("/root/children").first
children.name # => "children"
children.root_node == doc # => true
grandchildren = doc.get_elements("/root/children/grandchildren").first
grandchildren.name # =>...
..."grandchildren"
grandchildren.root_node == doc # => true
//}...

REXML::Formatters::Default (48.0)

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

...XML::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.n...
...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_formatter.write(doc, output)
output.string
# => "<root>\n<children>\n <grandchildren />\n</children>\n</root...

REXML::Formatters::Transitive (48.0)

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

...<<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><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
transitive_formatter.write(REXML::XPath.first(doc, "/root/children"), output)
output.string
# => "<children\n>\n<grandchildren foo='bar'\n /...

絞り込み条件を変える

rdoc (36.0)

RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。

...ットを指定します。デフォルトは rdoc です。
markdown、rd、rdoc、tomdoc のいずれかから選択できます。

: --root root

Root
of the source tree documentation will be generated for. Set this
when building documentation outside the source directory. Default is
t...
...FAQ or other pages not associated with
a class live. Set this when you don't store such files at your
project root. NOTE: Do not use the same file name in the page dir
and the root of your project

: --copy-files path

path で指定したファイルかディレクトリを出力先のデ...
...です。

<tt>--output</tt> <i>name [, name]</i>::
specify the name of one or more output files. If multiple
files are present, the first is used as the index.

<tt>--quiet:</tt>:: do not output the names, sizes, byte counts,
index areas, or bit ratios of units...

REXML::Attributes#namespaces -> { String => String } (30.0)

self の中で宣言されている名前空間の集合を返します。

...quire 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p doc.root.attributes.namespaces
# => {"foo"=>"http://example.org/f...

REXML::Attributes#prefixes -> [String] (30.0)

self の中で宣言されている prefix の集合を 文字列の配列で返します。

...quire 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p doc.root.attributes.prefixes # => ["foo", "bar"]
p a.attributes.p...

REXML::Attributes#[](name) -> String | nil (24.0)

属性名nameの属性値を返します。

...]{
require 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS

a = doc.get_elements("/root/a").first

p a.attributes["att"] # => "<"
p a.attributes["bar:att"] # =>...
<< 1 2 3 > >>