るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 > >>

REXML::Attributes#namespaces -> { String => String } (25.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] (25.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 (19.0)

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

...トが必要な場合は
REXML::Attributes
#get_attribute を使ってください。

nameという属性名の属性がない場合は nil を返します。

@param name 属性名(文字列)

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

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://examp...
...le.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"] # => "2"
//}...

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

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

...[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["att"] = "9"
a.attributes["foo:attt"] = "8"...

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

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

...[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.delete("att") # => <a foo:att='1' bar:a...

絞り込み条件を変える

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

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

...[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.delete_all("att") # => [att='&lt;']
a # =>...

REXML::Attributes#each {|name, value| ... } -> () (19.0)

各属性の名前と値に対しブロックを呼び出します。

...][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.each do |name, value|
p [name, value]
end...

REXML::Attributes#each_attribute {|attribute| ... } -> () (19.0)

各属性に対しブロックを呼び出します。

...][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.each_attribute do |attr|
p [attr.namespac...

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

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("/root/a").first

a.attr...
<< 1 2 > >>