るりまサーチ

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

別のキーワード

  1. _builtin nil?
  2. object nil?
  3. nilclass nil?
  4. object nil
  5. _builtin nil

検索結果

<< 1 2 > >>

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

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

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

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

@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//emlist[][ruby]{
require 'rexml/document'

doc =...
...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::Element#each_element_with_text(text = nil, max = 0, name = nil) {|element| ... } -> () (209.0)

テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。

...h_element_with_text {|e|p e}
# >> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >> <c> ... </>
doc.root.each_element_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ... </>
//}...

REXML::Element#get_text(path = nil) -> REXML::Text | nil (209.0)

先頭のテキスト子ノードを返します。

...で指定される
テキストノードの文字列を返します。

テキストノードがない場合には nil を返します。

@param path XPath文字列
@see REXML::Element#text

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this is bold!</b> more...

REXML::Element#text(path = nil) -> String | nil (209.0)

先頭のテキスト子ノードの文字列を返します。

...で指定される
テキストノードの文字列を返します。

テキストノードがない場合には nil を返します。

@param path XPath文字列
@see REXML::Element#get_text

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this is bold!</b>...

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

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

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

key で指定した属性名の属性を持つ要素のみを対象とします。
value を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。

max に 0 を指定すると、max の指定は無視されます(0個ではありません)。

@param key 属性名(文字列)
@param value 属性値(文字列)
...

絞り込み条件を変える

REXML::Element.new(arg = UNDEFINED, parent = nil, context = nil) -> REXML::Element (203.0)

要素オブジェクトを生成します。

...要素オブジェクトを生成します。

arg が文字列の場合、新たな要素の名前は arg に設定されます。
arg が REXML::Element オブジェクトの場合は、
新たな要素の名前、属性、context が arg のもので初期化されます。

parent で親ノー...
...また、すべての要素で空白を考慮して欲しい場合には
:all を指定します。
デフォルト値は :all です。
REXML::Element
#whitespace も参照してください。
: :compress_whitespace
空白を無視して欲しい要素の名前の集合を文字列の配...
...whitespace での指定を上書きします。
すべての要素で空白を無視して欲しい場合には
:all を指定します。
REXML::Element
#whitespace も参照してください。
: :ignore_whitespace_nodes
空白のみからなるノードを無視して欲しい要素の名...

REXML::Element#namespace(prefix=nil) -> String (114.0)

self の文脈で prefix が指している名前空間の URI を返します。

...在しない場合は nil を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/><y:d /></a>")
b = doc.elements['//b']
b.namespace # => "1"
b.namespace("y") # => "2"
b.namespace("z") # => nil
d = doc.elements['//y:d...

REXML::Element#next_element -> Element | nil (114.0)

次の兄弟要素を返します。

...次の兄弟要素を返します。

次の要素が存在しない場合は nil を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/>text<c/></a>'
doc.root.elements['b'].next_element # => <c/>
doc.root.elements['c'].next_element # => nil
//}...

REXML::Element#delete_attribute(key) -> REXML::Attribute | nil (108.0)

要素から key という属性名の属性を削除します。

...名の属性が存在しない場合は削除されずに、nil を返します。

@param key 削除する要素(文字列(属性名) or REXML::Attributeオブジェクト)

//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("E")
e.add_attribute("x", "foo"); e # => <E x='foo'/>
e.add...

REXML::Element#document -> REXML::Document | nil (108.0)

self が属する文書(REXML::Document)オブジェクトを返します。

...self が属する文書(REXML::Document)オブジェクトを返します。

属する文書がない場合には nil を返します。...

絞り込み条件を変える

<< 1 2 > >>