るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. bigdecimal to_i
  5. ipaddr to_i

検索結果

<< 1 2 3 > >>

REXML::Text#value -> String (18213.0)

テキストの内容を非正規化(すべての実体をアンエスケープ)された状態で返します。

...

このメソッドの返り値では raw モードや entity_filter は無視されます。

@see REXML::Text#raw, REXML::Text#to_s

//emlist[][ruby]{
require 'rexml/document'
t = REXML::Text.new("< & foobar", false, nil, false)
t.to_s # => "&lt; &amp; foobar"
t.value # => "< & foobar"
//}...

REXML::CData#value -> String (15225.0)

テキスト文字列を返します。

...テキスト文字列を返します。

@see REXML::Text#value, REXML::Text#to_s

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root><![CDATA[foobar baz]]></root>
EOS
doc.root[0].class # => REXML::CData
doc.root[0].value # => "foobar baz"
//}...

REXML::Attributes#each_attribute {|attribute| ... } -> () (9218.0)

各属性に対しブロックを呼び出します。

...ttribute オブジェクトで渡されます。

//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").firs...
...t

a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}...

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

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

...を呼び出します。

key で指定した属性名の属性を持つ要素のみを対象とします。
value
を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max...
...)
@param value 属性値(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列

//emlist[][ruby]{
require '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|...
...>> <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::DocType#attributes_of(element) -> [REXML::Attribute] (6224.0)

DTD 内の属性リスト宣言で、 element という名前の要素に対し宣言されている 属性の名前とデフォルト値を REXML::Attribute の配列で返します。

...ト値を REXML::Attribute の配列で返します。

名前とデフォルト値のペアは、各 Attribute オブジェクトの
REXML::Attribute#name と
REXML::Attribute#value で表現されます。

//emlist[][ruby]{
require 'rexml/document'

doctype = REXML::Document.new(<<EOS).doctype
<!...
...<!ATTLIST book
author CDATA #REQUIRED
title CDATA #REQUIRED
publisher CDATA "foobar publisher">
]>
EOS

p doctype.attributes_of("book")
# => [author='', title='', publisher='foobar publisher']
p doctype.attributes_of("book")[0].name # => "author"
p doctype.attributes_o...
...f("book")[0].value # => ""
//}...

絞り込み条件を変える

REXML::Attribute#to_string -> String (6222.0)

"name='value'" という形式の文字列を返します。

..."name='value'" という形式の文字列を返します。

//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").to_string # => "ns:r='rval'"
//}...

REXML::Element#add_attribute(key, value) -> () (6219.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

...:Attribute オブジェクトを
渡す方法です。

文字列2つで指定する場合、属性値は unnormalized な文字列を渡す必要があります。

@param key 属性名(文字列)
@param value 属性値(文字列)
@param attr 属性(REXML::Attribute オブジェクト)

//emlist[][...
...ruby]{
require 'rexml/document'
doc = REXML::Document.new("<e/>")
doc.root.add_attribute("a", "b"); doc.root # => <e a='b'/>
doc.root.add_attribute("x:a", "c"); doc.root # => <e a='b' x:a='c'/>
doc.root.add_attribute(REXML::Attribute.new("b", "d"))
doc.root # => <e a='b' x:a='c' b='d'/>
//}...

REXML::Element#add_attributes(attrs) -> () (6130.0)

要素の属性を複数追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

..."value1", "name2" => "value2", ... }
という形で、配列の場合は
[ ["name1", "value1"], ["name2", "value2"], ... }
という形で追加/更新する属性を指定します。

@param attrs 追加する属性の属性名と属性値の対の集合(Array or Hash)

//emlist[][ruby]{
requir...
...e 'rexml/document'
e = REXML::Element.new("e")
e.add_attributes({"a" => "b", "c" => "d"})
e # => <e a='b' c='d'/>
e = REXML::Element.new("e")
e.add_attributes([["a", "b"], ["c", "d"]])
e # => <e a='b' c='d'/>
//}...

REXML::Element#add_attribute(attr) -> () (6119.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

...:Attribute オブジェクトを
渡す方法です。

文字列2つで指定する場合、属性値は unnormalized な文字列を渡す必要があります。

@param key 属性名(文字列)
@param value 属性値(文字列)
@param attr 属性(REXML::Attribute オブジェクト)

//emlist[][...
...ruby]{
require 'rexml/document'
doc = REXML::Document.new("<e/>")
doc.root.add_attribute("a", "b"); doc.root # => <e a='b'/>
doc.root.add_attribute("x:a", "c"); doc.root # => <e a='b' x:a='c'/>
doc.root.add_attribute(REXML::Attribute.new("b", "d"))
doc.root # => <e a='b' x:a='c' b='d'/>
//}...

REXML::Entity (6048.0)

XML における実体(エンティティ、entity)の宣言(declaration)を表わすクラス。

...ィ、entity)の宣言(declaration)を表わすクラス。

DTD(REXML::DocType)内の実体宣言に対応するものです。

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<EOS)
<!DOCTYPE document [
<!ENTITY f "foo bar baz">
<!ENTITY x SYSTEM "x.txt">
<!ENTITY y SYSTEM "...
...NG>
<!ENTITY % z "zzz">
<!ENTITY zz "%z;%z;&f;">
]>
EOS

entities = doc.doctype.entities
# f は 内部実体名なので、external や ref は nil である
p entities["f"].name # => "f"
p entities["f"].value # => "foo bar baz"
p entities["f"].external # => nil
p entities["f"].ref # => nil

# x...
... value が nil で、
# external や ref が文字列を返してくる。
# しかし解析対象実体(parsed entity)なので ndata は nil を返す
p entities["x"].name # => "x"
p entities["x"].value # => nil
p entities["x"].external # => "SYSTEM"
p entities["x"].ref # => "x.txt"
p entities[...

絞り込み条件を変える

<< 1 2 3 > >>