るりまサーチ

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

別のキーワード

  1. rexml/document namespace
  2. rake namespace
  3. element add_namespace
  4. rexml/document add_namespace
  5. namespace name=

ライブラリ

クラス

キーワード

検索結果

REXML::XPath.first(element, path = nil, namespaces = {}, variables = {}) -> Node | nil (18249.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 } (6106.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 (135.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 (119.0)

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

...きます。

namespace
で名前空間の URI を指定することで、その名前空間内で
name という属性名を持つ属性を指定できます。

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

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

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

...: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...

絞り込み条件を変える

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

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

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

Ruby用語集 (12.0)

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

...n development
テストコードを先に記述してから機能を実装するプログラミング手法。

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

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

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

===[a:na] な

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

: 名前重...