るりまサーチ

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

別のキーワード

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

検索結果

<< 1 2 3 ... > >>

REXML::Element#attribute(name, namespace = nil) -> REXML::Attribute | nil (18467.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...
...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.attribute("baz") # => nil
//}...

Gem::Specification.attribute(name) -> () (18202.0)

デフォルト値を指定したアクセサを定義するために使用します。

...フォルト値を指定したアクセサを定義するために使用します。

以下の副作用があります。

* クラス変数 @@attributes, @@default_value を変更します。
* 通常の属性書き込みメソッドを定義します。
* デフォルト値を持つ属性読...

Gem::Specification.attribute_names -> Array (12201.0)

属性名の配列を返します。

属性名の配列を返します。

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

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

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

name
space で名前空間を、 name で prefix を含まない属性名を
指定します。

指定された属性が存在しない場合は nil を返します。

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

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

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

doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"...
....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.attributes.get_attribute_ns("http://example.org/baz", "att") # => nil
a.attributes.get_attribute_ns("http://example.org/foo", "at...

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

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

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

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

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

a.attributes.get_attribute("att") # => att='&lt;'
a.attributes.get_attribute("foo:att") # => foo:att='1'
//}...

絞り込み条件を変える

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

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

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

個々の属性は REXML::Attribute オブジェクトで渡されます。

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

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

a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}...

REXML::Attribute#namespace(arg = nil) -> String | nil (9124.0)

属性の名前空間の URI を返します。

...//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("xmlns:ns", "http://www.example.com/ns")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").prefix # => "ns"
p e.attributes.get_attribute("r").namespace # => "http://www.example.com/ns"
//}...

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

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

...p://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/foo", "bar"=>"http://example.org/bar"}
p a.attributes.namespaces
# => {}
//}...

REXML::DocType#attributes_of(element) -> [REXML::Attribute] (6247.0)

DTD 内の属性リスト宣言で、 element という名前の要素に対し宣言されている 属性の名前とデフォルト値を REXML::Attribute の配列で返します。

...宣言されている
属性の名前とデフォルト値を REXML::Attribute の配列で返します。

名前とデフォルト値のペアは、各 Attribute オブジェクトの
REXML::Attribute#name
REXML::Attribute#value で表現されます。

//emlist[][ruby]{
require 'rexml/docume...
...CDATA #REQUIRED
title CDATA #REQUIRED
publisher CDATA "foobar publisher">
]>
EOS

p doctype.attributes_of("book")
# => [author='', title='', publisher='foobar publisher']
p doctype.attributes_of("book")[0].name # => "author"
p doctype.attributes_of("book")[0].value # => ""
//}...

REXML::Element#each_element_with_attribute(key, value = nil, max = 0, name = nil) {|element| ... } -> () (6238.0)

特定の属性を持つすべての子要素を引数としてブロックを呼び出します。

...lueである
もののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name
を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。

max に 0 を指...
...
@param name xpath文字列

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b id='1'/><c id='2'/><d id='1'/><e/></a>")
doc.root.each_element_with_attribute('id'){|e| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1')...
...{|e| p e }
# >> <b id='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1', 0, 'd'){|e| p e }
# >> <d id='1'/>
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>