るりまサーチ

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

別のキーワード

  1. _builtin name
  2. resolv each_name
  3. win32ole name
  4. openssl name
  5. net/imap name

ライブラリ

キーワード

検索結果

REXML::Element#attribute(name, namespace = nil) -> REXML::Attribute | nil (242.0)

name で指定される属性を返します。

...
name
で指定される属性を返します。

属性は REXML::Attribute オブジェクトの形で返します。

name
は "foo:bar" のように prefix を指定することができます。

name
space で名前空間の URI を指定することで、その名前空間内で
name
という...
...属性名を持つ属性を指定できます。

指定した属性名の属性がない場合は nil を返します。

@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="ht...
...://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
a.attribute("att") # => att='&lt;'
a.attribute("att", "http://example.org/bar") # => bar:att='2'
a.attribute("bar:att") # => bar:att='2'
a.attribu...

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

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

...ildren />
</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 # => "grandchildren"
grandchildren.root.name # => "root"
//}...

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

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

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