るりまサーチ (Ruby 2.4.0)

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

別のキーワード

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

ライブラリ

検索結果

REXML::Elements#size -> Integer (54394.0)

保持している要素の個数を返します。

保持している要素の個数を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
# doc.root は3つの要素と3つのテキストノードを持つため、6を返す
doc.root.size # => 6
# そのうち要素は3つであるため、以下は3を返す
doc.root.elements.size # => 3
//}

REXML::Attributes#size -> Integer (45358.0)

属性の個数を返します。

属性の個数を返します。


//emlist[][ruby]{
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.length # => 3
//}
...

REXML::Attributes#length -> Integer (58.0)

属性の個数を返します。

属性の個数を返します。


//emlist[][ruby]{
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.length # => 3
//}
...