るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< < ... 2 3 4 >>

REXML::Element#get_text(path = nil) -> REXML::Text | nil (8019.0)

先頭のテキスト子ノードを返します。

...キスト子ノードを返します。

raw モードの設定は無視され、常に正規化されたテキストを返します。
REXML::Text#value も参照してください。

path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返し...
...xt

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
# doc.root (<p> ... </p>) は2つのテキストノード("some text " と " more text"
# を持っているが、前者を返す
doc.root.get_text.value # => "some text "
//}...

REXML::Text#to_s -> String (8019.0)

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

...トとして妥当です。

結果は REXML::Text.new で指定した entity_filter を反映しています。

@see REXML::Text#value

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

REXML::Attribute#write(output, indent = -1) -> object (8017.0)

output に self の情報を name='value' という形式で書き込みます。

...output に self の情報を name='value' という形式で書き込みます。

output が返ります。

@param output 書き込み先の IO オブジェクト
@param indent インデントレベル、ここでは無視される...

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

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

...d な文字列を渡す必要があります。

@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...

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

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

...ブロックを呼び出します。

個々の属性は REXML::Attribute オブジェクトで渡されます。

//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

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#text(path = nil) -> String | nil (8013.0)

先頭のテキスト子ノードの文字列を返します。

...いことに注意してください。

raw モードの設定は無視され、常に正規化されたテキストを返します。
REXML::Text#value も参照してください。

path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返し...
...トノードがない場合には nil を返します。

@param path XPath文字列
@see REXML::Element#get_text

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
# doc.root (<p> ... </p>) は2つのテキストノード("some te...

REXML::Entity#normalized -> String | nil (8007.0)

正規化された(normalized)実体の値を返します。

...正規化された(normalized)実体の値を返します。

すなわち、一切の実体参照を展開していない値を返します。

外部実体(external entity)宣言の場合は nil を返します。

@see REXML::Entity#value, REXML::Entity#unnormalized...

REXML::Entity#unnormalized -> String | nil (8007.0)

非正規化された(unnormalized)実体の値を返します。

...体の値を返します。

すなわち、self が属する DTD によってすべての実体参照(&ent; と %ent; の両方)
を展開した文字列を返します。

外部実体(external entity)宣言の場合は nil を返します。

@see REXML::Entity#value, REXML::Entity#normalized...
<< < ... 2 3 4 >>