396件ヒット
[1-100件を表示]
(0.122秒)
ライブラリ
-
rexml
/ document (385) -
rexml
/ streamlistener (11)
クラス
-
REXML
:: Attributes (132) -
REXML
:: CData (22) -
REXML
:: Element (143) -
REXML
:: Elements (66) -
REXML
:: Instruction (22)
モジュール
キーワード
- [] (22)
- []= (22)
-
add
_ attribute (22) -
add
_ element (11) - attribute (11)
- content (11)
- delete (22)
-
delete
_ all (11) - each (22)
-
each
_ attribute (11) -
each
_ element _ with _ attribute (11) -
each
_ element _ with _ text (11) - entitydecl (11)
-
get
_ attribute (11) -
get
_ attribute _ ns (11) -
get
_ text (11) - length (11)
- namespaces (11)
-
next
_ element (11) - prefixes (11)
-
root
_ node (11) - size (22)
- target (11)
- text (11)
- text= (11)
-
to
_ a (11) -
to
_ s (11) - value (11)
- xpath (11)
検索結果
先頭5件
- REXML
:: Element # root -> REXML :: Element - REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node - REXML
:: Elements # delete(element) -> Element - REXML
:: Element # add _ element(element , attrs = nil) -> Element - REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> ()
-
REXML
:: Element # root -> REXML :: Element (21268.0) -
self が属する文書のルート要素を返します。
...self が属する文書のルート要素を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children").first
children.name # => "children"
children.root.name......# => "root"
grandchildren = doc.get_elements("/root/children/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root.name # => "root"
//}... -
REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node (9356.0) -
self が属する文書のルートノードを返します。
...self が属する文書のルートノードを返します。
通常はその要素が属する文書(REXML::Document) オブジェクトが
返されます。
その要素が属する REXML::Document オブジェクトが存在しない
場合は木構造上のルートノードが返されま......emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children").first
children.name # => "children"
children.root_node == doc # => true
grandchildren = doc.get_elements("/root/child......ren/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root_node == doc # => true
//}... -
REXML
:: Elements # delete(element) -> Element (6367.0) -
element で指定した子要素を取り除きます。
...element で指定した子要素を取り除きます。
element には、REXML::Element、整数、文字列が指定できます。
Element オブジェクトを指定した場合は、その子要素を取り除きます。
整数を指定した場合には element 番目の子要素を削除し......m 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 # => "<a><c/><c id='1'/></a>......"
doc.elements.delete("a/c[@id='1']") # => <c id='1'/>
doc.root.to_s # => "<a><c/></a>"
doc.root.elements.delete 1 # => <c/>
doc.root.to_s # => "<a/>"
doc.root.elements.delete '/a'
doc.root.to_s # => ""
//}... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (6355.0) -
子要素を追加します。
...子要素を追加します。
element として追加する要素を指定します。
REXML::Element オブジェクトもしくは文字列を指定します。
element として REXML::Element オブジェクトを指定した場合、それが追加されます。
文字列を指定した場......m 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_element 'my-tag', {'attr1'=>'val1'......>'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::Elemen... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (6267.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...を呼び出します。
key で指定した属性名の属性を持つ要素のみを対象とします。
value を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max......(文字列)
@param value 属性値(文字列)
@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='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }
# >> <b id='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1', 0, 'd'){|e| p e }
# >> <d id='1'/>
//}... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (6267.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> ... </>
//}... -
REXML
:: Attributes # delete(attribute) -> REXML :: Element (6249.0) -
指定した属性を取り除きます。
...REXML::Attribute オブジェクトを指定します
self が属する要素(REXML::Element)を返します。
@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:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.delete("att") # => <a foo:att='1' bar:att='2'/>
a.attributes.delete("foo:att") # => <a bar:att='2'/>
attr = a.attribute......s.get_attribute("bar:att")
a.attributes.delete(attr) # => <a/>
//}... -
REXML
:: Element # next _ element -> Element | nil (6225.0) -
次の兄弟要素を返します。
...次の兄弟要素を返します。
次の要素が存在しない場合は nil を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/>text<c/></a>'
doc.root.elements['b'].next_element # => <c/>
doc.root.elements['c'].next_element # => nil
//}... -
REXML
:: Attributes # delete _ all(name) -> [REXML :: Attribute] (6137.0) -
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='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.delete_all("att") # => [att='<'......]
a # => <a foo:att='1' bar:att='2'/>
//}... -
REXML
:: Attributes # length -> Integer (6131.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='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
p a.attributes.length # => 3
//}...