33件ヒット
[1-33件を表示]
(0.121秒)
別のキーワード
ライブラリ
-
rexml
/ document (33)
クラス
-
REXML
:: Child (22) -
REXML
:: Element (11)
キーワード
-
next
_ sibling= (11) -
previous
_ sibling= (11)
検索結果
先頭3件
-
REXML
:: Element # add _ element(element , attrs = nil) -> Element (18219.0) -
子要素を追加します。
...ring => String } という Hash を渡すと、
追加する要素の属性を指定できます。
子要素の最後に追加されます。
返り値は追加された要素です。
@param element 追加する要素
@param attrs 追加する要素に設定する属性
//emlist[][ruby]{
requi......re '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_element 'my-tag', {'attr1'=>'val1', 'attr2'=>'val2'}
# => <my-tag attr1='val1' attr2='val2'/>
doc.root.to_s # => "<a><my-tag/><my-tag attr1=......'val1' attr2='val2'/></a>"
el = REXML::Element.new 'my-tag'
doc.root.add_element el # => <my-tag/>
doc.root.to_s # => "<a><my-tag/><my-tag attr1='val1' attr2='val2'/><my-tag/></a>"
//}
@see REXML::Elements#add, REXML::Element.new... -
REXML
:: Child # next _ sibling=(other) (6106.0) -
other を self の次の隣接ノードとします。
...ther を挿入します。
@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_sibling = d
p a.to_s # => "<a><d/><b/><c/></a>"
//}... -
REXML
:: Child # previous _ sibling=(other) (6106.0) -
other を 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_sibling = d
p a.to_s # => "<a><d/><b/><c/></a>"
//}...