るりまサーチ

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

別のキーワード

  1. tracer set_get_line_procs
  2. webrick/httpservlet do_get
  3. net/http get
  4. http get
  5. http get_print

ライブラリ

クラス

キーワード

検索結果

REXML::Element#get_elements(xpath) -> [REXML::Element] (18113.0)

xpath にマッチする要素を配列で返します。

...xpath にマッチする要素を配列で返します。

xpath には XPath 文字列を指定します。

@
param xpath XPath 文字列
@
see REXML::Elements#to_a...

REXML::Attributes#get_attribute(name) -> Attribute | nil (18.0)

name という名前の属性を取得します。

...

@
param name 属性名(文字列)
@
see REXML::Attributes#[]

//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("...

REXML::Attributes#get_attribute_ns(namespace, name) -> REXML::Attribute | nil (18.0)

namespace と name で特定される属性を返します。

...えてしまった場合でも、このメソッドを
使うことで属性を正しく指定することができます。

@
param namespace 名前空間(URI, 文字列)
@
param name 属性名(文字列)

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

a.attributes.get_attribute_ns("", "att") # => att='&lt;'
a.attributes.get_attribute_ns("http://example.org/foo", "att") # => foo:att='1'
a.a...

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

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

...e という属性名を持つ属性を指定できます。

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

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

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

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

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

...返します。

@
param name 属性名(文字列)

//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").fi...

絞り込み条件を変える

REXML::Attributes#[]=(name, value) (12.0)

指定した属性を更新します。

.../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.attributes["att"] = "9"
a.attributes["foo:attt"] = "8"
a # => <a foo:att='1' bar:att='2' att='9' foo:attt='8'/>
//}

@
see REXML::Attributes#add...

REXML::Attributes#delete(attribute) -> REXML::Element (12.0)

指定した属性を取り除きます。

...します。
文字列もしくは REXML::Attribute オブジェクトを指定します

self が属する要素(REXML::Element)を返します。

@
param attribute 取り除く属性(文字列もしくは REXML::Attribute オブジェクト)

//emlist[][ruby]{
require 'rexml/document'

doc = REXML...
...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

a.attributes.delete("att") # => <a foo:att='1' bar:att='2'/>
a.attributes.delete("foo:att") # => <a bar:att='2'/>
attr =...

REXML::Attributes#delete_all(name) -> [REXML::Attribute] (12.0)

name という名前を持つ属性をすべて削除します。

...ます。

@
param name 削除する属性の名前

//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").f...