るりまサーチ

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

別のキーワード

  1. rexml/document new
  2. rexml/document write
  3. rexml/document to_s
  4. rexml/document clone
  5. rexml/document node_type

ライブラリ

モジュール

検索結果

<< 1 2 3 > >>

REXML::Elements#each(xpath = nil) {|element| ... } -> [REXML::Elements] (26138.0)

全ての子要素に対しブロックを呼び出します。

...ックを呼び出します。

REXML::XPath.each などとは異なり、要素以外の
テキストノードなどはすべて無視されることに注意してください。

@param xpath XPath文字列

//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.ne...
...ブロックに渡される
doc.root.elements.each {|e|p e}
# <b/>, <b/> がブロックに渡される
doc.root.elements.each('b') {|e|p e} #-> Yields b, b elements
# <b/>,<c/>,<d/>,<b/>,<c/>,<d/> がブロックに渡される
doc.root.elements.each('child::node()') {|e|p e}
# <b/>,<c/>,<d/>,"se...
...an",<b/>,<c/>,<d/> がブロックに渡される
REXML::XPath.each(doc.root, 'child::node()'){|node| p node }
//}...

REXML::Attributes#each {|name, value| ... } -> () (26114.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='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

a.attributes.each do |name, value|
p [name,...

REXML::Parent#each -> Enumerator (26105.0)

各子ノードに対しブロックを呼び出します。

各子ノードに対しブロックを呼び出します。

ブロックを省略した場合は Enumerator を返します。

REXML::Parent#each {|object| ... } -> () (26105.0)

各子ノードに対しブロックを呼び出します。

各子ノードに対しブロックを呼び出します。

ブロックを省略した場合は Enumerator を返します。

REXML::AttlistDecl#each {|name, value| ... } -> () (26102.0)

それぞれの属性名、デフォルト値を引数として ブロックを順に呼び出します。

それぞれの属性名、デフォルト値を引数として
ブロックを順に呼び出します。

デフォルト値を持たない属性に関しては nil が渡されます。

絞り込み条件を変える

REXML::Element#each_element_with_attribute(key, value = nil, max = 0, name = nil) {|element| ... } -> () (14132.0)

特定の属性を持つすべての子要素を引数としてブロックを呼び出します。

...'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'/>
# >> <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| ... } -> () (14132.0)

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

...][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#each_attribute {|attribute| ... } -> () (14114.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='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

a.attributes.each_attribute do |attr|
p [at...

REXML::Parent#each_child -> Enumerator (14105.0)

各子ノードに対しブロックを呼び出します。

各子ノードに対しブロックを呼び出します。

ブロックを省略した場合は Enumerator を返します。
<< 1 2 3 > >>