るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.146秒)
トップページ > クエリ:i[x] > クエリ:-[x] > クエリ:document[x] > クエリ:[][x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

REXML::Attributes#[](name) -> String | nil (21312.0)

属性名nameの属性値を返します。

...EXML::Attribute オブジェクトが必要な場合は
REXML::Attributes#get_attribute を使ってください。

nameという属性名の属性がない場合は nil を返します。

@param 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"] # => "<"
p a.attributes["bar:att"] # => "2"
//}...

REXML::Elements#[](index, name = nil) -> REXML::Element | nil (18336.0)

index が指し示している要素を返します。

...index が指し示している要素を返します。

i
ndex には整数もしくは文字列を指定できます。

i
ndex に整数を指定した場合は index 番目の子要素を返します。
i
ndex は 1-origin です。つまり
最初の要素の index は 1 であり、 0 ではあり...
...-origin です。

整数で指定した場合でも、XPathで指定した場合でも、
指定した要素が存在しない場合は nil を返します。

@param index 取り出したい要素の index (整数)もしくは xpath (文字列)
@param name 子要素の名前(文字列)

//emlist[]...
...[ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>'
doc.root.elements[1] # => <b/>
doc.root.elements['c'] # => <c id='1'/>
doc.root.elements[2,'c'] # => <c id='2'/>

doc = REXML::Document.new '<a><b><c /><a id="1"/></b></a>'
doc.root.element...

Psych::Handler#start_document(version, tag_directives, implicit) -> () (6337.0)

YAML ドキュメントの始まりで呼び出されます。

...version には YAML ドキュメントに宣言されているバージョンが
[major, minor] という配列で渡されます。宣言がない場合は空の配列が渡されます。

tag_directives には tag directive の配列が渡されます。
それぞれの tag は [prefix, suffix]...
...override してください。


@param version バージョン
@param tag_directives tag directive の配列
@param implicit ドキュメントが implicit に始まっているかどうか

=== 例

以下の YAML に対しては
%YAML 1.1
%TAG ! tag:tenderlovemaking.com,2009:
-
-- !squee
st...
...です
version # => [1, 1]
tag_directives # => tenderlovemaking.com,2009:"
i
mplicit # => false

以下の YAML に対しては
-
x
-
y
start_document に渡される引数は以下の通りです。
version # => []
tag_directives # => []
i
mplicit # =>...

REXML::Attributes#prefixes -> [String] (6218.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='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p doc.root.attributes.prefixes # => ["foo", "bar"]
p a.attributes.prefixes # => []
//}...

REXML::Elements#[]=(index, element) (6218.0)

集合に要素 element を追加/更新します。

...集合に要素 element を追加/更新します。

i
ndex で要素の更新する位置を指定します。
i
ndex には整数、文字列が指定できます。
整数を指定した場合は index 番目の要素を変更します(1-originです)。
文字列の場合は XPath としてマッ...
...素が存在しない場合は、
末尾に追加されます。

@param index 要素を更新する位置
@param element 要素(REXML::Elementオブジェクト)

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a/>'
doc.root.elements[10] = REXML::Element.new('b')
doc.root.to_...

絞り込み条件を変える

Psych::Nodes::Document.new(version=[], tag_directives=[], implicit=false) -> Psych::Nodes::Document (3535.0)

Document オブジェクトを生成します。

...
Document
オブジェクトを生成します。

version にはドキュメントのバージョンを指定します。
[major, minor] という配列で指定します。

tag_directives には tag directive の配列を指定します。
それぞれの tag は [prefix, suffix] という文字...
...表現します。

i
mplicit にはドキュメントが implicit に始まっているかどうかを
真偽値で指定します。

@param version YAML ドキュメントのバージョン
@param tag_directives tag directive の配列
@param implicit ドキュメントが implicit に始まって...
...YAML 1.1 のドキュメントで、
tag directive を1つ持ち、 implicit にドキュメントが開始
している Document オブジェクトを生成しています。

Psych::Nodes::Document.new(
[1,1],
tenderlovemaking.com,2009:",
true)

@see Psych::Handler#start_document...