るりまサーチ (Ruby 2.2.0)

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

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

検索結果

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

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

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

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

...定することができます。

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

REXML::Element#delete_attribute(key) -> REXML::Attribute | nil (36910.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_attribute("y:x", "bar"); e # => <E x='foo' y:x='bar'/>
e.de...

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

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

...値(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@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'/...

REXML::Parent#delete_at(index) -> REXML::Child | nil (36613.0)

子ノード列上の index で指定された場所の要素を取り除きます。

子ノード列上の index で指定された場所の要素を取り除きます。

取り除いだノードを返します。indexが範囲外である場合は何もせず
nil を返します。

絞り込み条件を変える

REXML::Attributes#each_attribute {|attribute| ... } -> () (36610.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 foo:att='1' bar:att=...

REXML::Attribute#xpath -> String (36310.0)

その属性を指定する xpath 文字列を返します。

その属性を指定する xpath 文字列を返します。

例えば "/foo/bar/@ns:r" という文字列を返します。

REXML::Attributes#delete(attribute) -> REXML::Element (27910.0)

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

...を返します。

@param attribute 取り除く属性(文字列もしくは 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 foo:att='1' bar:at...

REXML::DocType#attribute_of(element, attribute) -> String | nil (27910.0)

DTD 内の属性リスト宣言で、 element という名前の要素の attribute という 名前の属性のデフォルト値を返します。

...かの場合は nil を返します。

@param element 要素名(文字列)
@param attribute 属性名(文字列)

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

doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book...

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

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

...、各 Attribute オブジェクトの
REXML::Attribute#name と
REXML::Attribute#value で表現されます。

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

doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book...

絞り込み条件を変える

REXML::DocType#notation(name) -> REXML::NotationDecl | nil (27910.0)

DTD に含まれている記法宣言 (REXML::NotationDecl) で name という名前を持つものを返します。

DTD に含まれている記法宣言 (REXML::NotationDecl) で
name という名前を持つものを返します。

name という名前を持つ記法宣言が存在しない場合は nil を返します。

@param name 検索する記法名

REXML::DocType#notations -> [REXML::NotationDecl] (27910.0)

DTD に含まれている記法宣言 (REXML::NotationDecl) を 配列で返します。

DTD に含まれている記法宣言 (REXML::NotationDecl) を
配列で返します。

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

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

...場合は 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=...

REXML::Element#attributes -> REXML::Attributes (27910.0)

要素が保持している属性の集合を返します。

要素が保持している属性の集合を返します。

REXML::Element#cdatas -> [REXML::CData] (27910.0)

すべての cdata 子ノードの配列を返します。

すべての cdata 子ノードの配列を返します。

返される配列は freeze されます。

絞り込み条件を変える

REXML::Attribute#element -> REXML::Element (27610.0)

その属性が属する要素を返します。

その属性が属する要素を返します。

REXML::Attribute#element=(element) (27610.0)

self が属する要素を変更します。

self が属する要素を変更します。

@param element 変更先の要素(REXML::Element)

REXML::Attributes#delete_all(name) -> [REXML::Attribute] (27610.0)

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

...て削除します。

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

@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=...

REXML::CData#clone -> REXML::CData (27610.0)

self を複製して返します。

self を複製して返します。

親ノードの情報は複製されません。

REXML::Element#add_attribute(attr) -> () (27610.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

...key 属性名(文字列)
@param value 属性値(文字列)
@param attr 属性(REXML::Attribute オブジェクト)

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<e/>")
doc.root.add_attribute("a", "b"); doc.root # => <e a='b'/>
doc.root.add_attribute("x:a", "c"); doc.root # =...

絞り込み条件を変える

REXML::Element#add_attribute(key, value) -> () (27610.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

...key 属性名(文字列)
@param value 属性値(文字列)
@param attr 属性(REXML::Attribute オブジェクト)

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<e/>")
doc.root.add_attribute("a", "b"); doc.root # => <e a='b'/>
doc.root.add_attribute("x:a", "c"); doc.root # =...

REXML::Element#add_attributes(attrs) -> () (27610.0)

要素の属性を複数追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

...属性を指定します。

@param attrs 追加する属性の属性名と属性値の対の集合(Array or Hash)

//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("e")
e.add_attributes({"a" => "b", "c" => "d"})
e # => <e a='b' c='d'/>
e = REXML::Element.new("e")
e.add_attributes([...

REXML::Element#has_attributes? -> bool (27610.0)

要素が属性を1つ以上持っていれば真を返します。

要素が属性を1つ以上持っていれば真を返します。

REXML::Entity#ndata -> String | nil (27610.0)

解析対象外実体(unparsed entity)宣言である場合には その記法名(notation name)を返します。

解析対象外実体(unparsed entity)宣言である場合には
その記法名(notation name)を返します。

それ以外の場合は nil を返します。

REXML::AttlistDecl#element_name -> String (27310.0)

属性を定義しているエレメントの名前を返します。

属性を定義しているエレメントの名前を返します。

絞り込み条件を変える

REXML::AttlistDecl#include?(key) -> bool (27310.0)

key が属性名であるならば真を返します。

key が属性名であるならば真を返します。

@param key 属性名であるかどうか判定する文字列

REXML::Attribute#clone -> REXML::Element (27310.0)

self を複製し返します。

self を複製し返します。

REXML::Attribute#normalized=(value) (27310.0)

正規化された属性値を設定します。

正規化された属性値を設定します。

通常はライブラリが自動的にこの値を設定するので
ユーザはこれを使う必要はないでしょう。

@param value 正規化された属性値

REXML::Attribute#value -> String (27310.0)

正規化されていない属性値を返します。

正規化されていない属性値を返します。

属性値の正規化については XML の仕様を参考にしてください。

REXML::Attributes#length -> Integer (27310.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.attribu...

絞り込み条件を変える

REXML::CData#value -> String (27310.0)

テキスト文字列を返します。

...テキスト文字列を返します。

@see REXML::Text#value, REXML::Text#to_s

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root><![CDATA[foobar baz]]></root>
EOS
doc.root[0].class # => REXML::CData
doc.root[0].value # => "foobar baz"
//}...

REXML::Element#xpath -> String (27310.0)

文書上の対象の要素にのみマッチする xpath 文字列を返します。

...文書上の対象の要素にのみマッチする xpath 文字列を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/><c/></a>')
c = doc.root.elements[2] # <a> .. </a> の中の <c/> 要素
c # => <c/>
c.xpath # => "/a/c"
doc = REXML::Document.new('<a><b...

REXML::NotationDecl#public -> String | nil (27310.0)

公開識別子を返します。

公開識別子を返します。

宣言が公開識別子を含まない場合は nil を返します。

REXML::NotationDecl#public=(value) (27310.0)

公開識別子を value に変更します。

公開識別子を value に変更します。

@param value 設定する公開識別子(文字列)

REXML::Element#add_element(element, attrs = nil) -> Element (19210.0)

子要素を追加します。

...された要素です。

@param element 追加する要素
@param attrs 追加する要素に設定する属性

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a/>')
el = doc.root.add_element 'my-tag' # => <my-tag/>
doc.root.to_s # => "<a><my-tag/></a>"
el = doc.root.add_ele...

絞り込み条件を変える

REXML::Element#each_element(xpath = nil) {|element| ... } -> () (18910.0)

各子要素を引数としてブロックを呼び出します。

各子要素を引数としてブロックを呼び出します。

xpath に文字列を指定するとそれにマッチする子要素のみを対象とします。

@param xpath XPath 文字列

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

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

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

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

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

REXML::Elements#delete_all(xpath) -> [REXML::Element] (18910.0)

xpath で指定した XPath 文字列にマッチする要素をすべて取り除きます。

...チする要素をすべて取り除きます。

@param xpath 取り除く要素を指し示す XPath 文字列

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><c/><c/><c/><c/></a>')
doc.elements.delete_all("a/c") # => [<c/>, <c/>, <c/>, <c/>]
doc.to_s...

REXML::Elements#collect(xpath = nil) {|element| .. } -> [object] (18610.0)

Enumerable#collect と同様、 各子要素に対しブロックを呼び出し、その返り値の配列を返します。

Enumerable#collect と同様、
各子要素に対しブロックを呼び出し、その返り値の配列を返します。

xpath を指定した場合は、その XPath 文字列に
マッチする要素に対し同様の操作をします。

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

REXML::Parent#delete_if -> Enumerator (18610.0)

各子ノードに対しブロックを呼び出し、真を返したノードを削除します。

各子ノードに対しブロックを呼び出し、真を返したノードを削除します。

ブロックを省略した場合は Enumerator を返します。

絞り込み条件を変える

REXML::Parent#each_child -> Enumerator (18610.0)

各子ノードに対しブロックを呼び出します。

各子ノードに対しブロックを呼び出します。

ブロックを省略した場合は Enumerator を返します。

REXML::AttlistDecl#[](key) -> String | nil (18310.0)

key という属性名のデフォルト値を返します。

key という属性名のデフォルト値を返します。

key という名前の属性が存在しない、もしくは
デフォルト値を持たない場合は nil を返します。

REXML::AttlistDecl#each {|name, value| ... } -> () (18310.0)

それぞれの属性名、デフォルト値を引数として ブロックを順に呼び出します。

それぞれの属性名、デフォルト値を引数として
ブロックを順に呼び出します。

デフォルト値を持たない属性に関しては nil が渡されます。

REXML::AttlistDecl#node_type -> Symbol (18310.0)

Symbol :attlistdecl を返します。

Symbol :attlistdecl を返します。

REXML::Attribute#==(other) -> bool (18310.0)

属性の名前と値が other と一致する場合に真を返します。

属性の名前と値が other と一致する場合に真を返します。

絞り込み条件を変える

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

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

...間でなく、arg という名前空間
の 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_attrib...

REXML::Attribute#node_type -> Symbol (18310.0)

「:attribute」というシンボルを返します。

「:attribute」というシンボルを返します。

REXML::Attributes#<<(attribute) -> () (18310.0)

属性を追加/更新します。

属性を追加/更新します。

attribute で更新する属性(REXML::Attribute オブジェクト)を
指定します。既に同じ名前(REXML::Attribute#name)のオブジェクトが
存在する場合は属性が上書きされ、ない場合は追加されます。

@param attribute 追加(更新)する属性(REXML::Attribute オブジェクト)
@see REXML::Attributes#[]=

REXML::Attributes#[](name) -> String | nil (18310.0)

属性名nameの属性値を返します。

...い。

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

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

REXML::Attributes#[]=(name, value) (18310.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=...

絞り込み条件を変える

REXML::Attributes#add(attribute) -> () (18310.0)

属性を追加/更新します。

属性を追加/更新します。

attribute で更新する属性(REXML::Attribute オブジェクト)を
指定します。既に同じ名前(REXML::Attribute#name)のオブジェクトが
存在する場合は属性が上書きされ、ない場合は追加されます。

@param attribute 追加(更新)する属性(REXML::Attribute オブジェクト)
@see REXML::Attributes#[]=

REXML::Attributes#each {|name, value| ... } -> () (18310.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://example.org/bar">
<a foo:att='1' bar:att='...

REXML::Attributes#to_a -> [Attribute] (18310.0)

属性の配列を返します。

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

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a x='1' y='2' z='3' />")
doc.root.attributes.to_a # => [x='1', y='2', z='3']
//}...

REXML::Formatters::Pretty#compact -> bool (18310.0)

出力をコンパクトにするかどうかを返します。

出力をコンパクトにするかどうかを返します。

これが真の場合、出力の空白をできる限り削除しようとします。

デフォルト値は false です。

@see REXML::Formatters::Pretty#compact=

REXML::NotationDecl#system -> String | nil (18310.0)

システム識別子(URI)を返します。

システム識別子(URI)を返します。

宣言がシステム識別子を含まない場合は nil を返します。

絞り込み条件を変える

REXML::NotationDecl#system=(value) (18310.0)

システム識別子を変更します。

システム識別子を変更します。

@param value 設定するシステム識別子

REXML::AttlistDecl#write(out, indent = -1) -> () (18010.0)

self を out に出力します。

self を out に出力します。

@param out 出力先の IO オブジェクト
@param indent インデント数(無視されます)

REXML::Attribute#prefix -> String (18010.0)

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

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

//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new( "elns:myelement" )
e.add_attribute( "nsa:a", "aval" )
e.add_attribute( "b", "bval" )
p e.attributes.get_attribute( "a" ).prefix # -> "nsa"
p e.attributes.get_attribute( "b" ).prefix # -> "...

REXML::Attribute#remove -> () (18010.0)

self を所属する要素から取り除きます。

self を所属する要素から取り除きます。

REXML::Attribute#to_s -> String (18010.0)

正規化された属性値を返します。

正規化された属性値を返します。

属性値の正規化については XML の仕様を参考にしてください。

絞り込み条件を変える

REXML::Attribute#to_string -> String (18010.0)

"name='value'" という形式の文字列を返します。

..."name='value'" という形式の文字列を返します。

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

REXML::Attribute#write(output, indent = -1) -> object (18010.0)

output に self の情報を name='value' という形式で書き込みます。

output に self の情報を name='value' という形式で書き込みます。

output が返ります。

@param output 書き込み先の IO オブジェクト
@param indent インデントレベル、ここでは無視される

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

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

...返します。

返り値は名前空間の prefix をキーとし、URI を値とする
Hash を返します。

//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=...

REXML::Attributes#prefixes -> [String] (18010.0)

self の中で宣言されている prefix の集合を 文字列の配列で返します。

...返します。

self が属する要素より上位の要素で定義されているものは含みません。

//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='...

REXML::Attributes#size -> Integer (18010.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.attribu...

絞り込み条件を変える

REXML::CData#to_s -> String (18010.0)

テキスト文字列を返します。

...テキスト文字列を返します。

@see REXML::Text#value, REXML::Text#to_s

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root><![CDATA[foobar baz]]></root>
EOS
doc.root[0].class # => REXML::CData
doc.root[0].value # => "foobar baz"
//}...

REXML::Declaration#to_s -> String (18010.0)

ノードを文字列化します。

ノードを文字列化します。

REXML::Declaration#write(output, indent) -> () (18010.0)

output にノードを出力します。

output にノードを出力します。

このメソッドは deprecated です。REXML::Formatter で
出力してください。

@param output 出力先の IO オブジェクト
@param indent インデントの大きさ。無視されます。

REXML::Formatters::Default#write(node, output) -> () (18010.0)

XML のノード node を output に出力します。

XML のノード node を output に出力します。

node には任意のXMLノードを指定できます。

@param node 出力するノード
@param output 出力先(IO など << で出力できるオブジェクト)

REXML::Formatters::Pretty#compact=(c) (18010.0)

出力をコンパクトにするかどうかを設定します。

出力をコンパクトにするかどうかを設定します。

@param c コンパクトな出力をするかどうかを指定します。
@see REXML::Formatters::Pretty#compact

絞り込み条件を変える

REXML::Formatters::Pretty#width -> Integer (18010.0)

出力のページ幅を返します。

出力のページ幅を返します。

デフォルトは80です。

@see REXML::Formatters::Pretty#width=

REXML::Formatters::Pretty#width=(w) (18010.0)

出力のページ幅を設定します。

出力のページ幅を設定します。

@param w ページ幅の設定値
@see REXML::Formatters::Pretty#width

REXML::NotationDecl#name -> String (18010.0)

記法宣言の名前を返します。

記法宣言の名前を返します。

REXML::NotationDecl#to_s -> String (18010.0)

self を文字列化したものを返します。

self を文字列化したものを返します。

REXML::NotationDecl#write(output, indent = -1) (18010.0)

output へ self を文字列化して出力します。

output へ self を文字列化して出力します。

このメソッドは deprecated です。REXML::Formatter で
出力してください。

@param output 出力先の IO オブジェクト
@param indent インデントの大きさ。無視されます。

絞り込み条件を変える

REXML::Element#get_text(path = nil) -> REXML::Text | nil (9610.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 text</p>"
# doc.root (<p> ... </p>) は2つのテキストノード("some tex...

REXML::Element#text(path = nil) -> String | nil (9610.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> more text</p>"
# doc.root (<p> ... </p>) は2つのテキストノード("some te...

REXML::Elements#each(xpath = nil) {|element| ... } -> [REXML::Elements] (9610.0)

全ての子要素に対しブロックを呼び出します。

...ストノードなどはすべて無視されることに注意してください。

@param xpath XPath文字列

//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a><b/><c/><d/>sean<b/><c/><d/></a>'
# <b/>,<c/>,<d/>,<b/>,<c/>, <d/> がブロックに渡...

REXML::Elements#inject(xpath = nil, initial = nil) {|element| ... } -> object (9610.0)

Enumerable#inject と同様、 各子要素に対し畳み込みをします。

Enumerable#inject と同様、
各子要素に対し畳み込みをします。

xpath を指定した場合は、その XPath 文字列に
マッチする要素に対し同様の操作をします。

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

REXML::Elements#to_a(xpath = nil) -> [REXML::Element] (9610.0)

すべての子要素の配列を返します。

...XPath.match などと
異なり、要素以外の子ノードは無視されます。

@param xpath XPath文字列

//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
doc.root.elements.to_a # => [<b/>, <c/>]
doc.root.elements.to_...

絞り込み条件を変える

REXML::Parent#each -> Enumerator (9310.0)

各子ノードに対しブロックを呼び出します。

各子ノードに対しブロックを呼び出します。

ブロックを省略した場合は Enumerator を返します。

REXML::Parent#each_index -> Enumerator (9310.0)

各子ノードのインデックスに対しブロックを呼び出します。

各子ノードのインデックスに対しブロックを呼び出します。

ブロックが省略された場合は上のような繰り返しをする
Enumerator オブジェクトを返します。