るりまサーチ

最速Rubyリファレンスマニュアル検索!
143件ヒット [1-100件を表示] (0.198秒)

別のキーワード

  1. _builtin to_a
  2. matrix to_a
  3. to_a
  4. dbm to_a
  5. argf.class to_a

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

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

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

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

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

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

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

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

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

n
amespace で名前空間を、 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"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a
=...
....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#namespaces -> { String => String } (12231.0)

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

...ash を返します。

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

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

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

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

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

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

n
amespace で名前空間の URI を指定することで、その名前空間内で
n
ame という...
... nil を返します。

@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//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
.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
//}...

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

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

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

n
ame という名前を持つ属性がない場合は 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#length -> Integer (9131.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#delete_all(name) -> [REXML::Attribute] (6243.0)

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

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

削除された属性を配列で返します。

@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.delete_all("att") # => [att='&lt;']
a
# => <a foo:att='1' bar:att='2'/>
//}...

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

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

...anded_name(REXML::Namespace#exapnded_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.each do |name, value|
p [name, value]
end

# => ["foo:att", "1"]
# => ["bar:att", "2"]
# => ["att", "<"]
//}...

REXML::Attributes#size -> Integer (6131.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#delete(attribute) -> REXML::Element (3267.0)

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

...取り除きます。

a
ttribute で取り除く属性を指定します。
文字列もしくは REXML::Attribute オブジェクトを指定します

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

@param attribute 取り除く属性(文字列もしくは REXML::Attribute オブジェ...
...ml/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:att='2'/>
a
.attribute...
...s.delete("foo:att") # => <a bar:att='2'/>
a
ttr = a.attributes.get_attribute("bar:att")
a
.attributes.delete(attr) # => <a/>
//}...

絞り込み条件を変える

<< 1 2 > >>