8件ヒット
[1-8件を表示]
(0.075秒)
別のキーワード
ライブラリ
- pathname (1)
-
rexml
/ document (7)
クラス
- Pathname (1)
-
REXML
:: Attributes (3) -
REXML
:: Element (4)
キーワード
- delete (1)
-
delete
_ namespace (1) -
has
_ elements? (1) - namespaces (1)
- prefixes (1)
- root? (1)
-
root
_ node (1)
検索結果
先頭5件
-
REXML
:: Element # root -> REXML :: Element (54499.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... -
REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node (18463.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... -
Pathname
# root? -> bool (18391.0) -
self がルートディレクトリであれば真を返します。判断は文字列操作によっ て行われ、ファイルシステムはアクセスされません。
self がルートディレクトリであれば真を返します。判断は文字列操作によっ
て行われ、ファイルシステムはアクセスされません。
//emlist[例][ruby]{
require 'pathname'
Pathname('/').root? # => true
Pathname('/im/sure').root? # => false
//} -
REXML
:: Element # delete _ namespace(namespace = "xmlns") -> self (343.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=... -
REXML
:: Attributes # prefixes -> [String] (142.0) -
self の中で宣言されている prefix の集合を 文字列の配列で返します。
self の中で宣言されている prefix の集合を
文字列の配列で返します。
self が属する要素より上位の要素で定義されているものは含みません。
//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... -
REXML
:: Attributes # namespaces -> { String => String } (124.0) -
self の中で宣言されている名前空間の集合を返します。
self の中で宣言されている名前空間の集合を返します。
返り値は名前空間の prefix をキーとし、URI を値とする
Hash を返します。
//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.ge... -
REXML
:: Attributes # delete(attribute) -> REXML :: Element (76.0) -
指定した属性を取り除きます。
指定した属性を取り除きます。
attribute で取り除く属性を指定します。
文字列もしくは 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"
x... -
REXML
:: Element # has _ elements? -> bool (70.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? # => f...