るりまサーチ

最速Rubyリファレンスマニュアル検索!
504件ヒット [201-300件を表示] (0.288秒)

別のキーワード

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

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

REXML::Elements#inject(xpath = nil, initial = nil) {|element| ... } -> object (11006.0)

Enumerable#inject と同様、 各子要素に対し畳み込みをします。

...Enumerable#inject と同様、
各子要素に対し畳み込みをします。

xpath を指定した場合は、その XPath 文字列に
マッチする要素に対し同様の操作をします。

@param xpath XPath文字列
@see REXML::Elements#each...

REXML::Elements#empty? -> bool (11000.0)

子要素を持たない場合に true を返します。

子要素を持たない場合に true を返します。

REXML::Elements#index(element) -> Integer (11000.0)

element で指定した要素が何番目の子要素であるかを返します。

element で指定した要素が何番目の子要素であるかを返します。

element が子要素でない場合は -1 を返します。

返り値は 1-origin です。

@param element インデックスを知りたい要素(REXML::Element オブジェクト)
@see REXML::Element#[]

REXML::Element#namespace(prefix=nil) -> String (8018.0)

self の文脈で prefix が指している名前空間の URI を返します。

...ます。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/><y:d /></a>")
b = doc.elements['//b']
b.namespace # => "1"
b.namespace("y") # => "2"
b.namespace("z") # => nil
d = doc.elements['//y:d']
d.namespace # => "2"
//}...

REXML::Element#next_element -> Element | nil (8018.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::Element#root -> REXML::Element (8018.0)

self が属する文書のルート要素を返します。

...ist[][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/gran...

REXML::Element#root_node -> REXML::Document | REXML::Node (8018.0)

self が属する文書のルートノードを返します。

...[][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/children/gr...

REXML::Element#xpath -> String (8018.0)

文書上の対象の要素にのみマッチする xpath 文字列を返します。

...ます。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/><c/></a>')
c = doc.root.elements[2] # <a> .. </a> の中の <c/> 要素
c # => <c/>
c.xpath # => "/a/c"
doc = REXML::Document.new('<a><b/><b/></a>')
b = doc.root.elements[2] # <a> .. </a> の中の2番目の <b/>...

REXML::Attributes#[](name) -> String | nil (8012.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='&lt;'/>
</root>
EOS

a = doc.get_elements("/root/a").first

p a.attributes["att"] # =>...
<< < 1 2 3 4 5 ... > >>