るりまサーチ

最速Rubyリファレンスマニュアル検索!
143件ヒット [1-100件を表示] (0.124秒)
トップページ > クエリ:self[x] > クエリ:t[x] > クラス:REXML::Element[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

キーワード

検索結果

<< 1 2 > >>

REXML::Element#document -> REXML::Document | nil (6217.0)

self が属する文書(REXML::Document)オブジェクトを返します。

...self が属する文書(REXML::Document)オブジェクトを返します。

属する文書がない場合には nil を返します。...

REXML::Element#root -> REXML::Element (6217.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#delete_namespace(namespace = "xmlns") -> self (6202.0)

名前空間を要素から削除します。

...除します。

@param namespace 削除する名前空間の prefix

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
doc.root.delete_namespace
doc.to_s # => "<a xmlns:foo='bar'/>"
doc.root.delete_namespace 'foo'
doc.to_s # => "<a/>"
//}...

REXML::Element#whitespace -> bool (6129.0)

要素(self)内で空白が考慮されるならば真を返します。

...(self)内で空白が考慮されるならば真を返します。

これは、
* REXML::Element#context に :respect_whitespace も :compress_whitespace も
含まれない
* context の :respect_whitespace に self の要素名が含まれていて、
:compress_whitespace に self...

REXML::Element#has_elements? -> bool (6117.0)

self が一つでも子要素を持つならば true を返します。

...self が一つでも子要素を持つならば true を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b/><c>Text</c></a>")
doc.root.has_elements? # => true
doc.elements["/a/b"].has_elements? # => false
# /a/c はテキストノードしか...
...持たないので false である
doc.elements["/a/c"].has_elements? # => false
//}...

絞り込み条件を変える

REXML::Element#root_node -> REXML::Document | REXML::Node (6117.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/chil...
...dren/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root_node == doc # => true
//}...

REXML::Element#namespaces -> {String => String} (3217.0)

self の文脈で定義されている名前空間の情報を返します。

...self の文脈で定義されている名前空間の情報を返します。

対象の要素とその外側の要素で定義されている名前空間を、{ prefix => 識別子 }
というハッシュテーブルで返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Documen...
...t.new("<a xmlns:x='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>")
doc.elements['//b'].namespaces # => {"x"=>"1", "y"=>"2"}
//}...

REXML::Element#clone -> REXML::Element (3117.0)

self を複製して返します。

...self を複製して返します。

複製されるのは名前、属性、名前空間のみです。
子ノードは複製されません。...

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

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

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

prefix を省略すると、デフォルトの名前空間の URI を返します。

prefix で指示される名前空間の宣言が存在しない場合は nil を返します。

//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#prefixes -> [String] (3117.0)

self の文脈で定義されている prefix を文字列の配列を返します。

...self の文脈で定義されている prefix を文字列の配列を返します。

対象の要素とその外側の要素で定義されている prefix を返します。

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

絞り込み条件を変える

<< 1 2 > >>