55件ヒット
[1-55件を表示]
(0.164秒)
ライブラリ
-
rexml
/ document (55)
キーワード
- context (11)
-
each
_ element _ with _ text (11) -
get
_ text (11) -
next
_ element (11)
検索結果
先頭5件
-
REXML
:: Element # text(path = nil) -> String | nil (18451.0) -
先頭のテキスト子ノードの文字列を返します。
...::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 text " と " more text"
# を持っているが、前者を返す
doc.root.text # => "some text "
//}... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (12446.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...テキストを子ノードとして
持つすべての子要素を引数としてブロックを呼び出します。
text を指定すると、テキストの内容が text であるもののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対......)。
@param text テキストの中身(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
doc.root.each_element_with_text {|e|p e}
#......>> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >> <c> ... </>
doc.root.each_element_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ... </>
//}... -
REXML
:: Element # get _ text(path = nil) -> REXML :: Text | nil (6552.0) -
先頭のテキスト子ノードを返します。
...ML::Text#value も参照してください。
path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。
テキストノードがない場合には nil を返します。
@param path XPath文字列
@see REXML::Element#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 text " と " more text"
# を持っているが、前者を返す
doc.root.get_text.value # => "some text "
//}... -
REXML
:: Element # context -> {Symbol => object} | nil (6326.0) -
要素の「コンテキスト」を Hash で返します。
...Hash で返します。
コンテキストとは text node (REXML::Text) での特別な文字、特に空白について
の取り扱いについての設定です。
以下の Symbol をハッシュのキーとして使います。
: :respect_whitespace
空白を考慮して欲しい要素の......。
デフォルト値は :all です。
REXML::Element#whitespace も参照してください。
: :compress_whitespace
空白を無視して欲しい要素の名前の集合を文字列の配列で指定します。
この指定は :respect_whitespace での指定を上書きします。......すべての要素で空白を無視して欲しい場合には
:all を指定します。
REXML::Element#whitespace も参照してください。
: :ignore_whitespace_nodes
空白のみからなるノードを無視して欲しい要素の名前の集合を
文字列の配列で指定し... -
REXML
:: Element # next _ element -> Element | nil (208.0) -
次の兄弟要素を返します。
...次の兄弟要素を返します。
次の要素が存在しない場合は nil を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/>text<c/></a>'
doc.root.elements['b'].next_element # => <c/>
doc.root.elements['c'].next_element # => nil
//}...