るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

REXML::XPath.first(element, path = nil, namespaces = {}, variables = {}) -> Node | nil (18349.0)

element の path で指定した XPath 文字列にマッチする最初のノードを 返します。

...ルート要素からの
位置でマッチするノードを探します。
path を省略すると "*" を指定したことになります。

namespace
で名前空間の対応付けを指定します。

variable で XPath 内の変数に対応する値を指定できます。
XPathインジェ...
...マッチするノードがない場合には nil を返します。

@param element 要素(REXML::Element)
@param path XPath文字列
@param namespace 名前空間とURLの対応付け
@param variables 変数名とその値の対応付け

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::D...
...<a> ... </>
b1 = REXML::XPath.first(a, "b")
b1.text # => "b1"

REXML::XPath.first(doc, "/root/a/x:c") # => <x:c/>
REXML::XPath.first(a, "x:c") # => <x:c/>
REXML::XPath.first(a, "y:c") # => nil
REXML::XPath.first(a, "y:c", {"y" => "1"}) # => <x:c/>
b2 = REXML::XPath.first(doc, "/root/a/b[text()=$v]",...

REXML::Attributes#namespaces -> { String => String } (12206.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::Attributes#get_attribute_ns(namespace, name) -> REXML::Attribute | nil (364.0)

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

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

namespace
で名前空間を、 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 = 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.attributes.get_attribute_...

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

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

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

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

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

namespace
で名前空間の 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::Attributes#each {|name, value| ... } -> () (137.0)

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

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

名前には expanded_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://examp...
...le.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", "<"]
//}...

絞り込み条件を変える

Ruby用語集 (30.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...関係が
なく、再定義もできない。
代入式「n = 1」における「=」は代入演算子である。
「str.size」「user&.name」といったメソッド呼び出しにおける
「.」「&.」も演算子である。
「[*0..9]」におけるいわゆる splat 展開の...
...n development
テストコードを先に記述してから機能を実装するプログラミング手法。

: テストファースト
: test-first programming
テスト駆動開発において、まず最初にテストコードを記述すること。

: データ型
: data type
一般...
...クラス定義、メソッド定義の外側である。

トップレベルでは main が self となる。

===[a:na] な

: 名前空間
: namespace
メソッドや定数の名前の衝突を避ける仕組み。
クラスやモジュールは一つの名前空間を作る。

: 名前重...

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

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

...="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.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => [...