22件ヒット
[1-22件を表示]
(0.147秒)
別のキーワード
ライブラリ
-
rexml
/ document (22)
クラス
-
REXML
:: Element (22)
検索結果
先頭2件
-
REXML
:: Element # text=(text) (21131.0) -
「先頭の」テキストノードを text で置き換えます。
...EXML::Text、nil のいずれかが指定できます。
REXML::Text オブジェクトを指定した場合には、それが設定され、
文字列を指定した場合には
REXML::Text.new(text, whitespace(), nil, raw())
で生成される Text オブジェクトが設定されます。
nil......、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"; doc.to_s # => "<a><b/>Bar</a>"
doc.root.add_element "c"
doc.root.text = "Baz"; do......c.to_s # => "<a><b/>Baz<c/></a>"
doc.root.text = nil; doc.to_s # => "<a><b/><c/></a>"
//}... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (6244.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...//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> ... </>
# >> <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> ... </>
//}...