22件ヒット
[1-22件を表示]
(0.117秒)
ライブラリ
-
rexml
/ document (22)
クラス
-
REXML
:: Attributes (11) -
REXML
:: Elements (11)
検索結果
-
REXML
:: Attributes # []=(name , value) (21219.0) -
指定した属性を更新します。
...を、value で値を更新します。
既に同じ名前の属性がある場合は上書きされ、
そうでない場合は属性が追加されます。
//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='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes["att"] = "9"
a.attributes["foo:attt"] = "8"
a # => <a foo:att='1' bar:att='2' att='9' foo:attt='8'/>
//}
@see REXML::Attributes#add... -
REXML
:: Elements # []=(index , element) (21207.0) -
集合に要素 element を追加/更新します。
...集合に要素 element を追加/更新します。
index で要素の更新する位置を指定します。
index には整数、文字列が指定できます。
整数を指定した場合は index 番目の要素を変更します(1-originです)。
文字列の場合は XPath としてマッ......位置
@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/>
doc.root.elements[1] = REXML::Element.new('c')
d......oc.root.to_s # => "<a><c/></a>"
doc.root.elements['c'] = REXML::Element.new('d')
doc.root.to_s # => "<a><d/></a>"
//}...