るりまサーチ (Ruby 2.6.0)

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

モジュール

検索結果

<< 1 2 > >>

REXML::Parent#[]=(index, node) (100.0)

子ノード列上の指定した場所を node で置き換えます。

子ノード列上の指定した場所を node で置き換えます。

Array#[]= と同じ指定が可能です。

@param index 変更場所の index (Integer)
@param range 変更場所の範囲 (Range)
@param start 変更範囲の最初の位置 (Integer)
@param length 変更範囲の個数 (Integer)
@param node 置き換えるノード

REXML::Parent#[]=(range, node) (100.0)

子ノード列上の指定した場所を node で置き換えます。

子ノード列上の指定した場所を node で置き換えます。

Array#[]= と同じ指定が可能です。

@param index 変更場所の index (Integer)
@param range 変更場所の範囲 (Range)
@param start 変更範囲の最初の位置 (Integer)
@param length 変更範囲の個数 (Integer)
@param node 置き換えるノード

REXML::Parent#[]=(start, length, node) (100.0)

子ノード列上の指定した場所を node で置き換えます。

子ノード列上の指定した場所を node で置き換えます。

Array#[]= と同じ指定が可能です。

@param index 変更場所の index (Integer)
@param range 変更場所の範囲 (Range)
@param start 変更範囲の最初の位置 (Integer)
@param length 変更範囲の個数 (Integer)
@param node 置き換えるノード

REXML::DocType#write(output, indent = 0, transitive = false, ie_hack = false) -> () (82.0)

output に DTD を出力します。

...ます。指定しないでください。
@param ie_hack 無視されます。指定しないでください。

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

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

REXML::Document#write(output = $stdout, indent = -1, transitive = false, ie_hack = false, encoding=nil) -> () (82.0)

output に XML 文書を出力します。

output に XML 文書を出力します。

XML宣言、DTD、処理命令を(もしあるならば)含む文書を出力します。

注意すべき点として、
元の XML 文書が XML宣言を含んでいなくとも
出力される XML はデフォルトの XML 宣言を含んでいるべきであるが、
REXML は明示しない限り(つまりXML宣言を REXML::Document#add で
追加しない限り)
それをしない、ということである。XML-RPCのような利用法では
ネットワークバンドを少しでも節約する必要があるためである。

2.0.0以降ではキーワード引数による引数指定が可能です。

@param outpu...

絞り込み条件を変える

REXML::Document#write(output: $stdout, indent: -1, transitive: false, ie_hack: false, encoding: nil) -> () (82.0)

output に XML 文書を出力します。

output に XML 文書を出力します。

XML宣言、DTD、処理命令を(もしあるならば)含む文書を出力します。

注意すべき点として、
元の XML 文書が XML宣言を含んでいなくとも
出力される XML はデフォルトの XML 宣言を含んでいるべきであるが、
REXML は明示しない限り(つまりXML宣言を REXML::Document#add で
追加しない限り)
それをしない、ということである。XML-RPCのような利用法では
ネットワークバンドを少しでも節約する必要があるためである。

2.0.0以降ではキーワード引数による引数指定が可能です。

@param outpu...

REXML::Element#each_element_with_attribute(key, value = nil, max = 0, name = nil) {|element| ... } -> () (82.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::Element#write(output = $stdout, indent = -1, transitive = false, ie_hack = false) (82.0)

このメソッドは deprecated です。 REXML::Formatter を代わりに 使ってください。

このメソッドは deprecated です。 REXML::Formatter を代わりに
使ってください。

output にその要素を文字列化したものを(子要素を含め)出力します。

@param output 出力先(IO のように << で書き込めるオブジェクト)
@param indent インデントのスペースの数(-1 だとインデントしない)
@param transitive XMLではインデントのスペースでDOMが変化してしまう場合がある。
これに真を渡すと、XMLのDOMに余計な要素が加わらないように
空白の出力を適当に抑制するようになる
@par...

REXML::Element#add_attribute(attr) -> () (64.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) -> () (64.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_element(element, attrs = nil) -> Element (64.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_with_text(text = nil, max = 0, name = nil) {|element| ... } -> () (64.0)

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

...身(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
doc.root.each_element_with_text {|e|p e}
# >> <b> ... </>
# >> <c> ... </>
# >...

REXML::Entity#write(out, indent = -1) -> () (64.0)

実体宣言を文字列化したものを out に書き込みます。

実体宣言を文字列化したものを out に書き込みます。

@param out 出力先の IO オブジェクト
@param indent 利用されません。deprecated なパラメータです
@see REXML::Entity#to_s

REXML::XMLDecl#xmldecl(version, encoding, standalone) -> () (64.0)

内容を更新します。

内容を更新します。

@param version バージョン(文字列)
@param encoding エンコーディング(文字列 or nil)
@param standalone スタンドアロン文章かどうか("yes", "no", nil)

REXML::Child#bytes (58.0)

@todo

@todo

絞り込み条件を変える

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

self を out に出力します。

self を out に出力します。

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

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

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

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

output が返ります。

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

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

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

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

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

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

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

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

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

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

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

REXML::Attributes#get_attribute(name) -> Attribute | nil (46.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 (46.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::Child#parent=(other) (46.0)

other を親ノードに設定します。

other を親ノードに設定します。

other が元の親ノードと同じならばこのメソッドは何もしません。
self が親を持たない場合は単純に other を親ノードに設定します。
どちらでもない場合は、元の親ノードの子ノード列から self を取り除いて
から other を親ノードに設定します。

このメソッドだけでは other の子ノード集合に self は追加されません。
つまりこのメソッドを呼び出した直後は不完全な状態であり、親ノード側を
適切に設定する必要があります。

@param other 新たな親ノード
@see REXML::Child#parent

REXML::Child#replace_with(child) -> self (46.0)

親ノードの子ノード列上において、 self を child に置き換えます。

親ノードの子ノード列上において、 self を child に置き換えます。

@param child 置き換え後のノード
@see REXML::Parent#replace_child

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

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

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

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

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

REXML::DocType#attribute_of(element, attribute) -> String | nil (46.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::Element#add_namespace(prefix, uri) -> self (46.0)

名前空間を要素に追加します。

...る場合はそれが上書きされます。

@param prefix 名前空間の prefix
@param uri 名前空間の uri

//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new("a")
a.add_namespace("xmlns:foo", "bar" )
a.add_namespace("foo", "bar") # 上と同じ意味
a.add_namespace("twiddle...

REXML::Element#add_namespace(uri) (46.0)

名前空間を要素に追加します。

...る場合はそれが上書きされます。

@param prefix 名前空間の prefix
@param uri 名前空間の uri

//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new("a")
a.add_namespace("xmlns:foo", "bar" )
a.add_namespace("foo", "bar") # 上と同じ意味
a.add_namespace("twiddle...

REXML::Element#attribute(name, namespace = nil) -> REXML::Attribute | nil (46.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#context=(value) (46.0)

要素の「コンテキスト」を Hash で設定します。

要素の「コンテキスト」を Hash で設定します。

コンテキストとは、 text node (REXML::Text) での特別な文字、特に空白について
の取り扱いについての設定です。
以下の Symbol をハッシュのキーとして使います。

: :respect_whitespace
空白を考慮して欲しい要素の名前の集合を文字列の配列で指定します。
また、すべての要素で空白を考慮して欲しい場合には
:all を指定します。
デフォルト値は :all です。
REXML::Element#whitespace も参照してください。
: :compress_whitesp...

REXML::Element#delete_element(element) -> REXML::Element (46.0)

子要素を削除します。

...場合はそのうち1つが削除されます。

@param element 削除する要素
@see REXML::Elements#delete

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c id="1"/><d/><c/></a>'
doc.delete_element("/a/b")
doc.to_s # => "<a><c/><c id='1'/><d/><c/></a>"
doc.de...

絞り込み条件を変える

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

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

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

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

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

REXML::Element#get_text(path = nil) -> REXML::Text | nil (46.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 (46.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#[](index, name = nil) -> REXML::Element | nil (46.0)

index が指し示している要素を返します。

...取り出したい要素の index (整数)もしくは xpath (文字列)
@param name 子要素の名前(文字列)

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>'
doc.root.elements[1] # => <b/>
doc.root.elements['c'] # => <c id=...

REXML::Elements#[]=(index, element) (46.0)

集合に要素 element を追加/更新します。

...されます。

@param index 要素を更新する位置
@param element 要素(REXML::Elementオブジェクト)

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a/>'
doc.root.elements[10] = REXML::Element.new('b')
doc.root.to_s # => "<a><b/></a>"
doc.root.elements[1] # => <b...

絞り込み条件を変える

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

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

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

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

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

REXML::Elements#index(element) -> Integer (46.0)

element で指定した要素が何番目の子要素であるかを返します。

element で指定した要素が何番目の子要素であるかを返します。

element が子要素でない場合は -1 を返します。

返り値は 1-origin です。

@param element インデックスを知りたい要素(REXML::Element オブジェクト)
@see REXML::Element#[]

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

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

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

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

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

REXML::ExternalEntity#write(output, indent) -> () (46.0)

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

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

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

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

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

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

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

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

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

絞り込み条件を変える

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

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

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

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

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

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

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

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

REXML::Namespace#has_name?(other, ns = nil) -> bool (46.0)

self が other と ns で指定した名前を持っているならば真を返します。

self が other と ns で指定した名前を持っているならば真を返します。

ns が nil でない場合は名前空間も比較されます。
other が ":" を含んでいる(つまり prefix を含んでいる)場合は
REXML::Namespace#fully_expanded_name と other を比較します。
どちらでもない場合は other と REXML::Namespace#name を直接
比較します。

@param other 比較する名前(文字列)
@param ns 比較する名前空間(文字列)

REXML::Namespace#prefix=(value) (46.0)

prefix (前置修飾子) を設定します。

prefix (前置修飾子) を設定します。

@param value prefix文字列
@see REXML::Namespace#prefix

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

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

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

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

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

絞り込み条件を変える

REXML::Parent#insert_after(child1, child2) -> self (46.0)

child2 を child1 で指定したノードの後ろに挿入します。

child2 を child1 で指定したノードの後ろに挿入します。

child1 が REXML::Child のインスタンスであるならば、その
子ノードの後ろに挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定されるノードの
後ろに挿入されます。

挿入されるノード(child2)の親は self に変更されます。

@param child1 挿入場所の指定
@param child2 挿入されるノード

REXML::Parent#insert_before(child1, child2) -> self (46.0)

child2 を child1 で指定したノードの前に挿入します。

child2 を child1 で指定したノードの前に挿入します。

child1 が REXML::Child のインスタンスであるならば、その
子ノードの前に挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定されるノードの
前に挿入されます。

挿入されるノード(child2)の親は self に変更されます。

@param child1 挿入場所の指定
@param child2 挿入されるノード

REXML::Parent#replace_child(to_replace, replacement) -> () (46.0)

子ノード列上の to_replace を replacement に置き換えます。

子ノード列上の to_replace を replacement に置き換えます。

to_replace の parent は nil に、
replacement の parent は selfに変更されます。

@param to_replace 置き換え元のノード
@param replacement 置き換え先のノード

REXML::Text#raw=(value) (46.0)

"raw" モードの設定を変更します。

"raw" モードの設定を変更します。

raw モードについては REXML::Text.new を参考にしてください。

@param value 設定する真偽値
@see REXML::Text#raw

REXML::XMLDecl#encoding=(enc) (46.0)

エンコーディングを enc に設定します。

エンコーディングを enc に設定します。

enc に nil を渡すと XML 宣言では encoding が
指定されていない(デフォルトで UTF-8 が使われる)
ことになります。

@param enc エンコーディング(文字列 or nil)
@see REXML::XMLDecl#encoding=

絞り込み条件を変える

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

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

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

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

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

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

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

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

REXML::Attribute#namespace(arg = nil) -> String | nil (28.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#normalized=(value) (28.0)

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

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

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

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

REXML::Attributes#[](name) -> String | nil (28.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) (28.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#delete(attribute) -> REXML::Element (28.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::Attributes#delete_all(name) -> [REXML::Attribute] (28.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#to_s -> String (28.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::CData#value -> String (28.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::Child#next_sibling -> REXML::Node (28.0)

次の隣接ノードを返します。

次の隣接ノードを返します。

REXML::Node#next_sibling_node の別名です。

@see REXML::Child#next_sibling=

REXML::Child#next_sibling=(other) (28.0)

other を self の次の隣接ノードとします。

...ドが持つ子ノード列の self の後ろに
other を挿入します。

@param other 挿入するノード

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

a = REXML::Element.new("a")
b = a.add_element("b")
c = REXML::Element.new("c")
b.next_sibling = c
d = REXML::Element.new("d")
b.previous_sibli...

REXML::Child#parent -> REXML::Parent|nil (28.0)

親ノードを返します。

親ノードを返します。

ルートノードの場合は nil を返します。

@see REXML::Child#parent=

REXML::Child#previous_sibling -> REXML::Node (28.0)

前の隣接ノードを返します。

前の隣接ノードを返します。

REXML::Node#previous_sibling_node の別名です。

@see REXML::Child#previous_sibling=

REXML::Child#previous_sibling=(other) (28.0)

other を self の前の隣接ノードとします。

...ードが持つ子ノード列の self の前に
other を挿入します。

@param other 挿入するノード

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

a = REXML::Element.new("a")
b = a.add_element("b")
c = REXML::Element.new("c")
b.next_sibling = c
d = REXML::Element.new("d")
b.previous_sibli...

絞り込み条件を変える

REXML::Comment#string=(value) (28.0)

コメント文字列を設定します。

コメント文字列を設定します。

@param value 設定する文字列

REXML::DocType#add(child) -> () (28.0)

child を子ノード列の最後に追加します。

child を子ノード列の最後に追加します。

REXML::Parent#add を内部で呼び出します。
また、REXML::DocType#entities を更新します。

@param child 追加するノード

REXML::DocType#entity(name) -> String | nil (28.0)

name という実体参照名を持つ実体を文字列で返します。

name という実体参照名を持つ実体を文字列で返します。

返される文字列は非正規化(REXML::Entity#unnormalized 参照)
された文字列が返されます。

name という名前を持つ実体が存在しない場合には nil を返します。

@param name 実体参照名(文字列)

//emlist[][ruby]{
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE foo [
<!ENTITY bar "barbarbarbar">
]>
EOS
p doctype.entity("bar") # => "ba...

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

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

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

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

@param name 検索する記法名

REXML::Element#add_attributes(attrs) -> () (28.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#context -> {Symbol => object} | nil (28.0)

要素の「コンテキスト」を Hash で返します。

要素の「コンテキスト」を Hash で返します。

コンテキストとは text node (REXML::Text) での特別な文字、特に空白について
の取り扱いについての設定です。
以下の Symbol をハッシュのキーとして使います。

: :respect_whitespace
空白を考慮して欲しい要素の名前の集合を文字列の配列で指定します。
また、すべての要素で空白を考慮して欲しい場合には
:all を指定します。
デフォルト値は :all です。
REXML::Element#whitespace も参照してください。
: :compress_whitespac...

REXML::Element#delete_attribute(key) -> REXML::Attribute | nil (28.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#delete_namespace(namespace = "xmlns") -> self (28.0)

名前空間を要素から削除します。

...場合はデフォルトの名前空間を削除します。

@param namespace 削除する名前空間の prefix

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
doc.root.delete_namespace
doc.to_s # => "<a xmlns:foo='bar'/>"
doc.root.delet...

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

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

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

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

@param xpath XPath 文字列

REXML::Element#text=(text) (28.0)

「先頭の」テキストノードを text で置き換えます。

...ードが削除されます。

@param text 置き換え後のテキスト(文字列、REXML::Text, nil(削除))

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/></a>')
doc.to_s # => "<a><b/></a>"
doc.root.text = "Foo"; doc.to_s # => "<a><b/>Foo</a>"
doc.root.text = "Bar...

絞り込み条件を変える

REXML::Elements#<<(element = nil) -> REXML::Element (28.0)

要素 element を追加します。

...の要素が追加されます。

追加された要素が返されます。

@param element 追加する要素

//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new('a')
a.elements.add(REXML::Element.new('b')) # => <b/>
a.to_s # => "<a><b/></a>"
a.elements.add('c') # => <c/>
a.to_s #...

REXML::Elements#add(element = nil) -> REXML::Element (28.0)

要素 element を追加します。

...の要素が追加されます。

追加された要素が返されます。

@param element 追加する要素

//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new('a')
a.elements.add(REXML::Element.new('b')) # => <b/>
a.to_s # => "<a><b/></a>"
a.elements.add('c') # => <c/>
a.to_s #...

REXML::Elements#delete(element) -> Element (28.0)

element で指定した子要素を取り除きます。

...けることに注意してください。

@param element 削除する要素(REXML::Element, 整数, 文字列)

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c id="1"/></a>'
b = doc.root.elements[1]
doc.root.elements.delete b # => <b/>
doc.root.to_s...

REXML::Elements#delete_all(xpath) -> [REXML::Element] (28.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#each(xpath = nil) {|element| ... } -> [REXML::Elements] (28.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#to_a(xpath = nil) -> [REXML::Element] (28.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::Entity#normalized -> String | nil (28.0)

正規化された(normalized)実体の値を返します。

正規化された(normalized)実体の値を返します。

すなわち、一切の実体参照を展開していない値を返します。

外部実体(external entity)宣言の場合は nil を返します。

@see REXML::Entity#value, REXML::Entity#unnormalized

REXML::Entity#to_s -> String (28.0)

実体宣言を文字列化したものを返します。

実体宣言を文字列化したものを返します。

@see REXML::Entity#write

//emlist[][ruby]{
e = REXML::ENTITY.new("w", "wee");
p e.to_s # => "<!ENTITY w \"wee\">"
//}

REXML::Entity#unnormalized -> String | nil (28.0)

非正規化された(unnormalized)実体の値を返します。

非正規化された(unnormalized)実体の値を返します。

すなわち、self が属する DTD によってすべての実体参照(&ent; と %ent; の両方)
を展開した文字列を返します。

外部実体(external entity)宣言の場合は nil を返します。

@see REXML::Entity#value, REXML::Entity#normalized

REXML::Entity#value -> String | nil (28.0)

実体の値を返します。

実体の値を返します。

パラメータ実体参照(parameter entity)のみが展開され、
そうでない実体参照(general entity)は展開されて
いないような値が返されます。

外部実体(external entity)宣言の場合は nil を返します。

@see REXML::Entity#unnormalized, REXML::Entity#normalized

絞り込み条件を変える

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

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

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

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

デフォルト値は false です。

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

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

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

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

デフォルトは80です。

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

REXML::Instruction#==(other) -> bool (28.0)

other と self が同じ 処理命令である場合に真を返します。

other と self が同じ 処理命令である場合に真を返します。

同じとは、 REXML::Instruction#target と REXML::Instruction#content
が一致することを意味します。

@param other 比較対象

REXML::Instruction#content=(value) (28.0)

XML 処理命令の内容を変更します。

XML 処理命令の内容を変更します。

@param value 新たなデータ(文字列)

REXML::Instruction#target=(value) (28.0)

XML 処理命令のターゲットを value に変更します。

XML 処理命令のターゲットを value に変更します。

@param value 新たなターゲット(文字列)

絞り込み条件を変える

REXML::Namespace#expanded_name -> String (28.0)

REXML::Namespace#name= で設定された名前を返します。

REXML::Namespace#name= で設定された名前を返します。

name= で指定した名前が prefix を含んでいれば
prefix を含む名前を返し、そうでなければ
prefix を含まない名前を返します。

@see REXML::Namespace#prefix

REXML::Namespace#name=(name) (28.0)

名前を設定します。

名前を設定します。

prefix を持つ名前も持たない名前も受け付けます。

@param name 名前(文字列)

REXML::Namespace#prefix -> String (28.0)

prefix (前置修飾子) を返します。

prefix (前置修飾子) を返します。

@see REXML::Namespace#prefix=

REXML::Node#parent? -> bool (28.0)

子を持つノードであれば真を返します。

子を持つノードであれば真を返します。

REXML::Parent のサブクラスでは真を返します。
それ以外では偽を返します。

@see REXML::Parent#parent?

REXML::Node#to_s(indent = -1) -> String (28.0)

ノードを文字列に変換します。

ノードを文字列に変換します。

@param indent このパラメータは deprecated で、無視されます

絞り込み条件を変える

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

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

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

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

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

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

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

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

REXML::Parent#<<(object) -> () (28.0)

object を子ノード列の最後に追加します。

object を子ノード列の最後に追加します。

object の親ノードには self が設定されます。

@param object 追加するノード

REXML::Parent#add(object) -> () (28.0)

object を子ノード列の最後に追加します。

object を子ノード列の最後に追加します。

object の親ノードには self が設定されます。

@param object 追加するノード

REXML::Parent#delete(object) -> REXML::Child | nil (28.0)

object を子ノード列から削除します。

object を子ノード列から削除します。

削除されたノードの親は nil に設定されます。

削除したノードを返します。削除されなかった場合は nil を返します。

@param object 削除するノード

絞り込み条件を変える

<< 1 2 > >>