282件ヒット
[1-100件を表示]
(0.145秒)
種類
- インスタンスメソッド (176)
- 文書 (40)
- 特異メソッド (22)
- ライブラリ (22)
- クラス (22)
ライブラリ
- psych (11)
-
rexml
/ document (209)
クラス
-
REXML
:: Attribute (11) -
REXML
:: Attributes (33) -
REXML
:: CData (22) -
REXML
:: DocType (11) -
REXML
:: Element (66) -
REXML
:: Entity (22) -
REXML
:: Text (33)
キーワード
- Entity (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 5 . 0 (7) - Parser (11)
- Ruby用語集 (11)
- []= (11)
-
add
_ attribute (22) -
add
_ attributes (11) -
attributes
_ of (11) - each (11)
-
each
_ attribute (11) -
each
_ element _ with _ attribute (11) -
get
_ text (11) - new (22)
-
rdoc
/ parser / c (11) -
rexml
/ document (11) -
ruby 1
. 8 . 4 feature (11) - text (11)
-
to
_ s (22) -
to
_ string (11) - value= (11)
検索結果
先頭5件
-
REXML
:: Text # value -> String (27213.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 # => "< & foobar"
t.value # => "< & foobar"
//}... -
REXML
:: CData # value -> String (21225.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
:: Text # value=(val) (15255.0) -
テキストの内容を val に変更します。
...非正規化された(エスケープされていない)文字列を渡さなければ
なりません。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("a")
e.add_text("foo")
e[0].value = "bar"
e.to_s # => "<a>bar</a>"
e[0].value = "<a>"
e.to_s # => "<a><a></a>"
//}... -
rexml
/ document (12024.0) -
DOM スタイルの XML パーサ。
...REXML::Document.new で XML 文書から DOM ツリーを
構築し、ツリーのノードの各メソッドで文書の内容にアクセスします。
以下のプログラムではブックマークの XML からデータを取り出します。
//emlist[][ruby]{
require 'rexml/document'
req......uire 'pp'
Bookmark = Struct.new(:href, :title, :desc)
doc = REXML::Document.new(<<XML)
<?xml version="1.0" encoding="UTF-8" ?>
<xbel version="1.0">
<bookmark href="http://www.ruby-lang.org/ja/">
<title>オブジェクト指向スクリプト言語 Ruby</title>
<desc>Rubyの公式サイ......ef="https://github.com/rurema/bitclust">
<title>rurema/bitclust · GitHub</title>
</bookmark>
<bookmark href="https://rubygems.org/gems/bitclust-core" />
</xbel>
XML
bookmarks = REXML::XPath.match(doc, "/xbel/bookmark").map do |bookmark|
href = bookmark.attribute("href").value
title_ele... -
REXML
:: Element # get _ text(path = nil) -> REXML :: Text | nil (9124.0) -
先頭のテキスト子ノードを返します。
...REXML::Text#value も参照してください。
path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。
テキストノードがない場合には nil を返します。
@param path XPath文字列
@see REXML::Element#text
//emli......st[][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 # text(path = nil) -> String | nil (9118.0) -
先頭のテキスト子ノードの文字列を返します。
...REXML::Text#value も参照してください。
path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。
テキストノードがない場合には nil を返します。
@param path XPath文字列
@see REXML::Element#get_text
//e......mlist[][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 _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (6285.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...子要素を引数としてブロックを呼び出します。
key で指定した属性名の属性を持つ要素のみを対象とします。
value を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定すると......ます。
name を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。
max に 0 を指定すると、max の指定は無視されます(0個ではありません)。
@param key 属性名(文字列)
@param value 属性値(文......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| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }... -
REXML
:: Element # add _ attribute(key , value) -> () (6243.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...REXML::Attribute オブジェクトを
渡す方法です。
文字列2つで指定する場合、属性値は unnormalized な文字列を渡す必要があります。
@param key 属性名(文字列)
@param value 属性値(文字列)
@param attr 属性(REXML::Attribute オブジェクト)
//em......list[][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
:: Attributes # each {|name , value| . . . } -> () (6225.0) -
各属性の名前と値に対しブロックを呼び出します。
... expanded_name(REXML::Namespace#exapnded_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='<'/>
</root>
EOS
a = doc.get_elem......ents("/root/a").first
a.attributes.each do |name, value|
p [name, value]
end
# => ["foo:att", "1"]
# => ["bar:att", "2"]
# => ["att", "<"]
//}... -
REXML
:: Entity . new(name , value , parent=nil , reference=false) -> REXML :: Entity (6219.0) -
新たな Entity オブジェクトを生成して返します。
...新たな Entity オブジェクトを生成して返します。
name, value で実体の名前とその値を定義します。
parent はその entity オブジェクトが属するノードを渡します。
reference でその実体宣言がパラメータ実体(parameter entity)かどうか......(internal entity)宣言のみを実現できます。
それ以外の内容を保持する Entity オブジェクトが欲しい場合は、
文書に適切な DTD を含めておいてそれを REXML::Document.new で
パースするようにしてください。
配列を使うほうは rexml......ram name 実体参照の名前
@param value 参照の値
@param parent 親ノード
@param reference パラメータ実体であるかどうかの真偽値
@param array 初期化のための配列
=== 例
「>」「>」 の対応は以下のように実現されます。
REXML::Entity.new("gt"...