種類
- インスタンスメソッド (307)
- 特異メソッド (44)
- クラス (37)
- モジュール (10)
- 定数 (9)
クラス
-
REXML
:: AttlistDecl (7) -
REXML
:: Attribute (16) -
REXML
:: Attributes (16) -
REXML
:: CData (4) -
REXML
:: Child (11) -
REXML
:: Comment (9) -
REXML
:: Declaration (2) -
REXML
:: DocType (18) -
REXML
:: Document (21) -
REXML
:: Element (44) -
REXML
:: ElementDecl (1) -
REXML
:: Elements (14) -
REXML
:: Entity (13) -
REXML
:: ExternalEntity (3) -
REXML
:: Formatters :: Default (2) -
REXML
:: Formatters :: Pretty (5) -
REXML
:: Formatters :: Transitive (1) -
REXML
:: Instruction (8) -
REXML
:: NotationDecl (8) -
REXML
:: Parent (29) -
REXML
:: ParseException (4) -
REXML
:: Parsers :: PullEvent (15) -
REXML
:: Parsers :: PullParser (7) -
REXML
:: Parsers :: SAX2Parser (8) -
REXML
:: Parsers :: StreamParser (2) -
REXML
:: Parsers :: UltraLightParser (3) -
REXML
:: Text (13) -
REXML
:: XMLDecl (18) -
REXML
:: XPath (3)
モジュール
-
REXML
:: EntityConst (5) -
REXML
:: Namespace (8) -
REXML
:: Node (7) -
REXML
:: SAX2Listener (17) -
REXML
:: Security (4) -
REXML
:: StreamListener (14)
キーワード
- << (4)
- <=> (2)
- == (4)
- AMP (1)
- APOS (1)
- AttlistDecl (1)
- Attribute (1)
- Attributes (1)
- BaseParser (1)
- CData (1)
- Child (1)
- Comment (1)
- DECLARATION (1)
-
DEFAULT
_ ENTITIES (1) -
DEFAULT
_ VERSION (1) - Declaration (1)
- Default (1)
- DocType (1)
- Document (1)
- Element (1)
- ElementDecl (1)
- Elements (1)
- Encoding (1)
- Entity (1)
- EntityConst (1)
- ExternalEntity (1)
- Functions (1)
- GT (1)
- IOSource (1)
- Instruction (1)
- LT (1)
- Namespace (1)
- Node (1)
- NotationDecl (1)
- Output (1)
- Parent (1)
- ParseException (1)
- Pretty (1)
- PullEvent (1)
- PullParser (1)
- QUOT (1)
- REXML (1)
- SAX2Listener (1)
- SAX2Parser (1)
- Security (1)
- Source (1)
- SourceFactory (1)
- StreamListener (1)
- StreamParser (1)
- Text (1)
- Transitive (1)
- TreeParser (1)
- UNDEFINED (1)
- UltraLightParser (1)
- UndefinedNamespaceException (1)
- XMLDecl (1)
- XMLTokens (1)
- XPath (1)
- XPathParser (1)
- [] (6)
- []= (5)
- add (5)
-
add
_ attribute (2) -
add
_ attributes (1) -
add
_ element (1) -
add
_ namespace (2) - attlistdecl (2)
- attlistdecl? (1)
- attribute (1)
-
attribute
_ of (1) - attributes (1)
-
attributes
_ of (1) - bytes (1)
- cdata (2)
- cdata? (1)
- cdatas (1)
- characters (1)
- children (1)
- clone (9)
- collect (1)
- comment (2)
- comment? (1)
- comments (1)
- compact (1)
- compact= (1)
- content (1)
- content= (1)
- context (3)
- context= (1)
- deafen (1)
-
deep
_ clone (1) - default (1)
- delete (3)
-
delete
_ all (2) -
delete
_ at (1) -
delete
_ attribute (1) -
delete
_ element (1) -
delete
_ if (2) -
delete
_ namespace (1) - doctype (4)
- doctype? (1)
-
doctype
_ end (1) - document (2)
- dowrite (1)
- each (7)
-
each
_ attribute (1) -
each
_ child (2) -
each
_ element (1) -
each
_ element _ with _ attribute (1) -
each
_ element _ with _ text (1) -
each
_ index (2) -
each
_ recursive (1) - element (1)
- element= (1)
-
element
_ name (1) - elementdecl (2)
- elementdecl? (1)
- elements (1)
- empty? (3)
- encoding (2)
- encoding= (1)
-
end
_ document (1) -
end
_ element (1) -
end
_ element? (1) -
end
_ prefix _ mapping (1) - entities (1)
- entity (2)
-
entity
_ expansion _ limit (2) -
entity
_ expansion _ limit= (2) -
entity
_ expansion _ text _ limit (2) -
entity
_ expansion _ text _ limit= (2) - entitydecl (2)
- entitydecl? (1)
-
event
_ type (1) - external (1)
-
external
_ id (1) -
find
_ first _ recursive (1) - first (1)
-
get
_ attribute (1) -
get
_ attribute _ ns (1) -
get
_ elements (1) -
get
_ text (1) -
has
_ attributes? (1) -
has
_ elements? (1) -
has
_ name? (1) -
has
_ next? (1) -
has
_ text? (1) - include? (1)
- index (2)
-
index
_ in _ parent (1) - inject (1)
-
insert
_ after (1) -
insert
_ before (1) - instruction (1)
- instruction? (1)
- instructions (1)
- length (2)
- line (1)
- listen (5)
-
local
_ name (1) - match (1)
- matches? (1)
- name (5)
- name= (1)
- namespace (2)
- namespaces (3)
- ndata (1)
- new (28)
-
next
_ element (1) -
next
_ sibling (1) -
next
_ sibling= (1) -
next
_ sibling _ node (1) -
node
_ type (9) - normalize (1)
- normalized (1)
- normalized= (1)
- notation (1)
- notationdecl (2)
- notationdecl? (1)
- notations (1)
- nowrite (1)
- parent (1)
- parent= (1)
- parent? (2)
- parse (3)
-
parse
_ stream (1) - peek (1)
- position (1)
- prefix (2)
- prefix= (1)
- prefixes (2)
-
previous
_ element (1) -
previous
_ sibling (1) -
previous
_ sibling= (1) -
previous
_ sibling _ node (1) -
processing
_ instruction (1) - progress (1)
- pubid (1)
- public (2)
- public= (1)
- pull (1)
- push (1)
- raw (2)
- raw= (1)
- ref (1)
- remove (2)
-
replace
_ child (1) -
replace
_ with (1) - rewind (1)
- root (2)
-
root
_ node (1) - size (3)
-
stand
_ alone? (2) - standalone (1)
- standalone= (1)
-
start
_ document (1) -
start
_ element (1) -
start
_ element? (1) -
start
_ prefix _ mapping (1) - string (1)
- string= (1)
- system (2)
- system= (1)
-
tag
_ end (1) -
tag
_ start (1) - target (1)
- target= (1)
- text (2)
- text= (1)
- text? (1)
- texts (1)
-
to
_ a (3) -
to
_ s (10) -
to
_ string (1) - unnormalize (1)
- unnormalized (1)
- unshift (2)
- value (4)
- value= (1)
- version (2)
- version= (1)
- whitespace (1)
- width (1)
- width= (1)
- write (11)
- writeencoding (1)
- writethis (1)
-
xml
_ decl (1) - xmldecl (3)
- xmldecl? (1)
- xpath (2)
検索結果
先頭5件
-
REXML
:: ParseException # context -> [Integer , Integer , Integer] (36307.0) -
パースエラーが起きた(XML上の)場所を返します。
...の)場所を返します。
要素3個の配列で、
[position, lineno, line]
という形で返します。
position, line は
REXML::ParseException#position
REXML::ParseException#line
と同じ値です。
lineno は IO#lineno が返す意味での行数です。
通常は line と同じ値... -
REXML
:: Document . entity _ expansion _ text _ limit -> Integer (36304.0) -
実体参照の展開による文字列の増分(テキストのバイト数)の 最大値を指定します。
...トは 10240 (byte) です。
このメソッドは Ruby 2.1 から deprecated になりました。
REXML::Security.entity_expansion_text_limit を使ってください。
@see REXML::Document.entity_expansion_text_limit=,
http://www.ruby-lang.org/ja/news/2013/02/22/rexml-dos-2013-02-22/... -
REXML
:: Document . entity _ expansion _ text _ limit=(val) (36304.0) -
実体参照の展開による文字列の増分(テキストのバイト数)の 最大値を指定します。
...トは 10240 (byte) です。
このメソッドは Ruby 2.1 から deprecated になりました。
REXML::Security.entity_expansion_text_limit= を使ってください。
@see REXML::Document.entity_expansion_text_limit
http://www.ruby-lang.org/ja/news/2013/02/22/rexml-dos-2013-02-22/... -
REXML
:: Security . entity _ expansion _ text _ limit -> Integer (36304.0) -
実体参照の展開による文字列の増分(テキストのバイト数)の 最大値を指定します。
...せ、処理を中断します。
実体参照の展開処理を使った DoS 攻撃に対抗するための
仕組みです。
デフォルトは 10240 (byte) です。
@see REXML::Document.entity_expansion_text_limit=,
http://www.ruby-lang.org/ja/news/2013/02/22/rexml-dos-2013-02-22/... -
REXML
:: Security . entity _ expansion _ text _ limit=(val) (36304.0) -
実体参照の展開による文字列の増分(テキストのバイト数)の 最大値を指定します。
...させ、処理を中断します。
実体参照の展開処理を使った DoS 攻撃に対抗するための
仕組みです。
デフォルトは 10240 (byte) です。
@see REXML::Document.entity_expansion_text_limit
http://www.ruby-lang.org/ja/news/2013/02/22/rexml-dos-2013-02-22/... -
REXML
:: Element # delete _ element(element) -> REXML :: Element (28204.0) -
子要素を削除します。
...子要素を削除します。
element で削除する要素を指定できます。整数、文字列、REXML::Element
オブジェクトのいずれかが指定できます。
REXML::Element を指定すると、その要素が削除されます。
整数を指定すると、element 番目の......素がマッチする場合はそのうち1つが削除されます。
@param element 削除する要素
@see REXML::Elements#delete
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c id="1"/><d/><c/></a>'
doc.delete_element("/a/b")
doc.to_s # => "<a><c/><c id='1'/... -
REXML
:: Element # texts -> [REXML :: Texts] (27904.0) -
すべてのテキスト子ノードの配列を返します。
すべてのテキスト子ノードの配列を返します。
返される配列は freeze されます。 -
REXML
:: Attributes # namespaces -> { String => String } (27604.0) -
self の中で宣言されている名前空間の集合を返します。
...ます。
返り値は名前空間の prefix をキーとし、URI を値とする
Hash を返します。
//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' at... -
REXML
:: Child # next _ sibling -> REXML :: Node (27604.0) -
次の隣接ノードを返します。
...次の隣接ノードを返します。
REXML::Node#next_sibling_node の別名です。
@see REXML::Child#next_sibling=... -
REXML
:: DocType # namespaces -> nil (27604.0) -
nil を返します。
nil を返します。 -
REXML
:: Element # namespaces -> {String => String} (27604.0) -
self の文脈で定義されている名前空間の情報を返します。
...義されている名前空間を、{ prefix => 識別子 }
というハッシュテーブルで返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a xmlns:x='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>")
doc.elements['//b'].namespaces # => {"x"=>"1", "y"=>"2"}
//}... -
REXML
:: Element # text=(text) (27604.0) -
「先頭の」テキストノードを text で置き換えます。
...ノードが追加されます。
text には文字列、REXML::Text、nil のいずれかが指定できます。
REXML::Text オブジェクトを指定した場合には、それが設定され、
文字列を指定した場合には
REXML::Text.new(text, whitespace(), nil, raw())
で生成さ......初のテキストノードが削除されます。
@param text 置き換え後のテキスト(文字列、REXML::Text, nil(削除))
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/></a>')
doc.to_s # => "<a><b/></a>"
doc.root.text = "Foo"; doc.to_s # => "<a><b/>Foo</a>"... -
REXML
:: Node # next _ sibling _ node -> REXML :: Node | nil (27604.0) -
次の兄弟ノードを返します。
次の兄弟ノードを返します。
次の兄弟ノードが存在しない場合(ノードがルートである場合や、
最後のノードである場合)は nil を返します。 -
REXML
:: Parent # insert _ after(child1 , child2) -> self (27604.0) -
child2 を child1 で指定したノードの後ろに挿入します。
...ドの後ろに挿入します。
child1 が REXML::Child のインスタンスであるならば、その
子ノードの後ろに挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定される... -
REXML
:: Parsers :: PullEvent # end _ element? -> bool (27604.0) -
XML要素の終了タグなら真を返します。
XML要素の終了タグなら真を返します。 -
REXML
:: SAX2Listener # end _ document -> () (27604.0) -
ドキュメントの末尾で呼び出されるコールバックメソッドです。
ドキュメントの末尾で呼び出されるコールバックメソッドです。 -
REXML
:: SAX2Listener # end _ element(uri , localname , qname) -> () (27604.0) -
要素が終了した(閉じられた)ときに呼び出されるコールバックメソッドです。
要素が終了した(閉じられた)ときに呼び出されるコールバックメソッドです。
@param uri 名前空間のURI文字列が渡されます。対応する名前空間が存在しない場合は
nil が渡されます
@param localname 接頭辞を取り除いた要素名文字列が渡されます
@param qname 修飾名(qualified-name)文字列、つまり接頭辞を含む文字列が渡されます -
REXML
:: StreamListener # text(text) -> () (27604.0) -
XML文書内のテキストをパースしたときに呼び出されるコールバックメソッドです。
XML文書内のテキストをパースしたときに呼び出されるコールバックメソッドです。
@param text テキストが文字列で渡されます -
REXML
:: Text # doctype -> REXML :: DocType | nil (27604.0) -
テキストノードが属する文書の DTD を返します。
...テキストノードが属する文書の DTD を返します。
そのような文書(REXML::Document)が存在しない、すなわち
テキストノードの親ノードを辿っても REXML::Document に到達しない、
場合には nil を返します。
@see REXML::DocType... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (27466.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...字列)
@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> .... -
REXML
:: Text # value=(val) (27412.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
:: ParseException # line -> Integer (27307.0) -
パースエラーが起きた(XML上の)場所を行数で返します。
パースエラーが起きた(XML上の)場所を行数で返します。 -
REXML
:: Child # next _ sibling=(other) (27304.0) -
other を self の次の隣接ノードとします。
...ther を挿入します。
@param other 挿入するノード
//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new("a")
b = a.add_element("b")
c = REXML::Element.new("c")
b.next_sibling = c
d = REXML::Element.new("d")
b.previous_sibling = d
p a.to_s # => "<a><d/><b/><c/></a>"
//}... -
REXML
:: DocType # context -> { Symbol => object } (27304.0) -
DTD が属する文書の「コンテキスト」を返します。
...DTD が属する文書の「コンテキスト」を返します。
具体的には親ノードである REXML::Document オブジェクトの
REXML::Element#context を返します。
コンテキストの具体的な内容については REXML::Element#context を
参照してください。... -
REXML
:: DocType # external _ id -> String | nil (27304.0) -
DTD が外部サブセットを用いている場合は "SYSTEM", "PUBLIC" の いずれかの文字列を返します。
...t[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
EOS
doctype.name # => "html"
doctype.external_id # => "PUBLIC"
doctype = REXML::Document.new(<<EO... -
REXML
:: Document # expanded _ name -> String (27304.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Document # name -> String (27304.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Document . entity _ expansion _ limit -> Integer (27304.0) -
実体参照の展開回数の上限を返します。
...実体参照の展開回数の上限を返します。
XML 文書(REXML::Document)ごとの展開回数がこの値を越えると
例外を発生させ、処理を中断します。
実体参照の展開処理を使った DoS 攻撃に対抗するための
仕組みです。
デフォルトは 1......0000 です。
このメソッドは Ruby 2.1 から deprecated になりました。
REXML::Security.entity_expansion_limit を使ってください。
@see REXML::Document.entity_expansion_limit=... -
REXML
:: Document . entity _ expansion _ limit=(val) (27304.0) -
実体参照の展開回数の上限を指定します。
...を指定します。
XML 文書(REXML::Document)ごとの展開回数がこの値を越えると
例外を発生させ、処理を中断します。
デフォルトは 10000 です。
このメソッドは Ruby 2.1 から deprecated になりました。
REXML::Security.entity_expansion_limit=......を使ってください。
@param val 設定する上限値(整数)
@see REXML::Document.entity_expansion_limit... -
REXML
:: Element # context -> {Symbol => object} | nil (27304.0) -
要素の「コンテキスト」を Hash で返します。
...要素の「コンテキスト」を Hash で返します。
コンテキストとは text node (REXML::Text) での特別な文字、特に空白について
の取り扱いについての設定です。
以下の Symbol をハッシュのキーとして使います。
: :respect_whitespace......。
また、すべての要素で空白を考慮して欲しい場合には
:all を指定します。
デフォルト値は :all です。
REXML::Element#whitespace も参照してください。
: :compress_whitespace
空白を無視して欲しい要素の名前の集合を文字列の......ect_whitespace での指定を上書きします。
すべての要素で空白を無視して欲しい場合には
:all を指定します。
REXML::Element#whitespace も参照してください。
: :ignore_whitespace_nodes
空白のみからなるノードを無視して欲しい要素... -
REXML
:: Element # context=(value) (27304.0) -
要素の「コンテキスト」を Hash で設定します。
...要素の「コンテキスト」を Hash で設定します。
コンテキストとは、 text node (REXML::Text) での特別な文字、特に空白について
の取り扱いについての設定です。
以下の Symbol をハッシュのキーとして使います。
: :respect_whitespac......。
また、すべての要素で空白を考慮して欲しい場合には
:all を指定します。
デフォルト値は :all です。
REXML::Element#whitespace も参照してください。
: :compress_whitespace
空白を無視して欲しい要素の名前の集合を文字列の......ect_whitespace での指定を上書きします。
すべての要素で空白を無視して欲しい場合には
:all を指定します。
REXML::Element#whitespace も参照してください。
: :ignore_whitespace_nodes
空白のみからなるノードを無視して欲しい要素... -
REXML
:: Element # get _ text(path = nil) -> REXML :: Text | nil (27304.0) -
先頭のテキスト子ノードを返します。
...ます。
REXML::Text#value も参照してください。
path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。
テキストノードがない場合には nil を返します。
@param path XPath文字列
@see REXML::Element#tex......t
//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 # has _ text? -> bool (27304.0) -
要素がテキストノードを子ノードとして持つ場合に true を返します。
要素がテキストノードを子ノードとして持つ場合に true を返します。 -
REXML
:: Element # next _ element -> Element | nil (27304.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
//}... -
REXML
:: Element # text(path = nil) -> String | nil (27304.0) -
先頭のテキスト子ノードの文字列を返します。
...ます。
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 text " と " more text"
# を持っているが、前者を返す
doc.root.text # => "some text "
//}... -
REXML
:: Elements # index(element) -> Integer (27304.0) -
element で指定した要素が何番目の子要素であるかを返します。
...element で指定した要素が何番目の子要素であるかを返します。
element が子要素でない場合は -1 を返します。
返り値は 1-origin です。
@param element インデックスを知りたい要素(REXML::Element オブジェクト)
@see REXML::Element#[]... -
REXML
:: Entity # external -> String | nil (27304.0) -
実体が外部実体(external entity)宣言である場合は "SYSTEM" もしくは "PUBLIC" という文字列を返します。
実体が外部実体(external entity)宣言である場合は
"SYSTEM" もしくは "PUBLIC" という文字列を返します。
内部実体(internal entity)宣言である場合には nil を返します。 -
REXML
:: ExternalEntity # write(output , indent) -> () (27304.0) -
output へ self を文字列化して出力します。
...output へ self を文字列化して出力します。
このメソッドは deprecated です。REXML::Formatter で
出力してください。
@param output 出力先の IO オブジェクト
@param indent インデントの大きさ。無視されます。... -
REXML
:: ExternalEntity . new(src) -> REXML :: ExternalEntity (27304.0) -
新たな ExternalEntity オブジェクトを生成します。
新たな ExternalEntity オブジェクトを生成します。
@param src 宣言文字列 -
REXML
:: Namespace # expanded _ name -> String (27304.0) -
REXML::Namespace#name= で設定された名前を返します。
...REXML::Namespace#name= で設定された名前を返します。
name= で指定した名前が prefix を含んでいれば
prefix を含む名前を返し、そうでなければ
prefix を含まない名前を返します。
@see REXML::Namespace#prefix... -
REXML
:: Namespace # fully _ expanded _ name -> String (27304.0) -
完全修飾名を返します。
完全修飾名を返します。 -
REXML
:: Node # index _ in _ parent -> Insteger (27304.0) -
self の親における index を返します。
...self の親における index を返します。
返される index は 1-origin です。
ノードが親を持たない(REXML::Child でない)場合は例外を発生させます。... -
REXML
:: Parent # each _ index -> Enumerator (27304.0) -
各子ノードのインデックスに対しブロックを呼び出します。
各子ノードのインデックスに対しブロックを呼び出します。
ブロックが省略された場合は上のような繰り返しをする
Enumerator オブジェクトを返します。 -
REXML
:: Parent # each _ index {|index| . . . } -> () (27304.0) -
各子ノードのインデックスに対しブロックを呼び出します。
各子ノードのインデックスに対しブロックを呼び出します。
ブロックが省略された場合は上のような繰り返しをする
Enumerator オブジェクトを返します。 -
REXML
:: Parent # index(child) -> Integer | nil (27304.0) -
child の子ノード列上での位置を返します。
child の子ノード列上での位置を返します。
child が子ノードでない場合には nil を返します。 -
REXML
:: Parsers :: PullEvent # text? -> bool (27304.0) -
テキストノードなら真を返します。
テキストノードなら真を返します。 -
REXML
:: Parsers :: PullParser # has _ next? -> bool (27304.0) -
未処理のイベントが残っている場合に真を返します。
...未処理のイベントが残っている場合に真を返します。
@see REXML::Parsers::PullParser#empty?... -
REXML
:: Security . entity _ expansion _ limit -> Integer (27304.0) -
実体参照の展開回数の上限を返します。
...す。
XML 文書(REXML::Document)ごとの展開回数がこの値を越えると
例外を発生させ、処理を中断します。
実体参照の展開処理を使った DoS 攻撃に対抗するための
仕組みです。
デフォルトは 10000 です。
@see REXML::Document.entity_expa... -
REXML
:: Security . entity _ expansion _ limit=(val) (27304.0) -
実体参照の展開回数の上限を指定します。
...の展開回数の上限を指定します。
XML 文書(REXML::Document)ごとの展開回数がこの値を越えると
例外を発生させ、処理を中断します。
デフォルトは 10000 です。
@param val 設定する上限値(整数)
@see REXML::Document.entity_expansion_limit... -
REXML
:: Text # clone -> REXML :: Text (27304.0) -
self を複製します。
self を複製します。 -
REXML
:: Text # empty? -> bool (27304.0) -
テキストが空ならば真を返します。
テキストが空ならば真を返します。 -
REXML
:: Text # node _ type -> Symbol (27304.0) -
Symbol :text を返します。
Symbol :text を返します。 -
REXML
:: Text # value -> String (27304.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
:: Text . new(arg , respect _ whitespace = false , parent = nil , raw = nil , entity _ filter = nil , illegal = REXML :: Text :: NEEDS _ A _ SECOND _ CHECK) (27304.0) -
テキストノードオブジェクトを生成します。
...ジェクトを生成します。
arg でノードの内容を指定します。
文字列の場合はそれが内容として使われます。
REXML::Text オブジェクトの場合はその内容が複製されます。
respect_whitespace に真を指定すると、arg に含まれる空白文......あると解釈され、
rexml はテキストに含まれているすべての(定義済み)実体を
エスケープします
nilの場合、親ノードが raw モードであるかどうかで
self が raw モードになるかどうかが決まります。
arg に REXML::Text オブジェクト......(デフォルトの場合)、
テキストがどのようにエスケープされるかは、そのノードが属する
文書(REXML::Document)の
DTD(REXML::DocType, REXML::Document#doctype)
で定義されます。DTD が与えられていない場合は、XMLの規格上
以下の実体参照/... -
REXML
:: Text . normalize(input , doctype = nil , entity _ filter = nil) -> String (27304.0) -
input を正規化(すべての entity をエスケープ)したものを 返します。
...input を正規化(すべての entity をエスケープ)したものを
返します。
@param input 正規化する文字列
@param doctype DTD(REXML::DocType オブジェクト)
@param entity_filter 置換したい実体の名前の配列... -
REXML
:: Text . unnormalize(string , doctype = nil , filter = nil , illegal = nil) -> String (27304.0) -
string を非正規化(すべての entity をアンエスケープ)したものを 返します。
...ype DTD(REXML::DocType オブジェクト)
@param filter アンエスケープしない実体の実体名(文字列配列)
@param illegal 内部用。使わないでください。
//emlist[][ruby]{
require 'rexml/text'
REXML::Text.unnormalize("& &foobar; <") # => "& &foobar; <"
REXML::Text.... -
REXML
:: ParseException (27007.0) -
XML のパースに失敗したときに生じる例外です。
...XML のパースに失敗したときに生じる例外です。
//emlist[][ruby]{
require 'rexml/document'
begin
REXML::Document.new("<a>foo\n</b></a> ")
rescue REXML::ParseException => ex
ex.position # => 16
ex.line # => 2
ex.context # => [16, 2, 2]
end
//}... -
REXML
:: UndefinedNamespaceException (27007.0) -
XMLのパース中に、定義されていない名前空間が現れた場合に発生する 例外です。
XMLのパース中に、定義されていない名前空間が現れた場合に発生する
例外です。 -
REXML
:: ExternalEntity (27004.0) -
DTD 内の宣言でパラメータ実体参照を使って宣言が されているものを表わすクラスです。
.../emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE xhtml [
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
]>
EOS
p doctype.children.find_all{|child| REXML::ExternalEntity === child... -
REXML
:: Text (27004.0) -
XML のテキストノードを表すクラスです。
XML のテキストノードを表すクラスです。
注意: Ruby 2.0.0 以前では、バグのため entity_filter の機能は正しく動作しません。 -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (18904.0) -
子要素を追加します。
...子要素を追加します。
element として追加する要素を指定します。
REXML::Element オブジェクトもしくは文字列を指定します。
element として REXML::Element オブジェクトを指定した場合、それが追加されます。
文字列を指定した場......た要素です。
@param element 追加する要素
@param attrs 追加する要素に設定する属性
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a/>')
el = doc.root.add_element 'my-tag' # => <my-tag/>
doc.root.to_s # => "<a><my-tag/></a>"
el = doc.root.add_element '......'val1' attr2='val2'/>
doc.root.to_s # => "<a><my-tag/><my-tag attr1='val1' attr2='val2'/></a>"
el = REXML::Element.new 'my-tag'
doc.root.add_element el # => <my-tag/>
doc.root.to_s # => "<a><my-tag/><my-tag attr1='val1' attr2='val2'/><my-tag/></a>"
//}
@see REXML::Elements#add, REXML::Element.new... -
REXML
:: Elements # delete(element) -> Element (18904.0) -
element で指定した子要素を取り除きます。
...element で指定した子要素を取り除きます。
element には、REXML::Element、整数、文字列が指定できます。
Element オブジェクトを指定した場合は、その子要素を取り除きます。
整数を指定した場合には element 番目の子要素を削除し......はない要素も取り除けることに注意してください。
@param element 削除する要素(REXML::Element, 整数, 文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c id="1"/></a>'
b = doc.root.elements[1]
doc.root.elements.delete b... -
REXML
:: Parent # replace _ child(to _ replace , replacement) -> () (18904.0) -
子ノード列上の to_replace を replacement に置き換えます。
子ノード列上の to_replace を replacement に置き換えます。
to_replace の parent は nil に、
replacement の parent は selfに変更されます。
@param to_replace 置き換え元のノード
@param replacement 置き換え先のノード -
REXML
:: Attribute # element -> REXML :: Element (18604.0) -
その属性が属する要素を返します。
その属性が属する要素を返します。 -
REXML
:: Attribute # element=(element) (18604.0) -
self が属する要素を変更します。
...self が属する要素を変更します。
@param element 変更先の要素(REXML::Element)... -
REXML
:: Attributes # delete(attribute) -> REXML :: Element (18604.0) -
指定した属性を取り除きます。
...列もしくは REXML::Attribute オブジェクトを指定します
self が属する要素(REXML::Element)を返します。
@param attribute 取り除く属性(文字列もしくは REXML::Attribute オブジェクト)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-E... -
REXML
:: Child # document -> REXML :: Document | nil (18604.0) -
そのノードが属する document (REXML::Document) を返します。
...そのノードが属する document (REXML::Document) を返します。
属する document が存在しない場合は nil を返します。... -
REXML
:: Child # parent -> REXML :: Parent|nil (18604.0) -
親ノードを返します。
...親ノードを返します。
ルートノードの場合は nil を返します。
@see REXML::Child#parent=... -
REXML
:: DocType # clone -> REXML :: DocType (18604.0) -
self の複製を返します。
...self の複製を返します。
external_id (REXML::DocType#external_id) と
名前(REXML::DocType#name) のみ複製されるため、
結果として得られるオブジェクトはあまり有用ではないでしょう。... -
REXML
:: DocType # entities -> { String => REXML :: Entity } (18604.0) -
DTD で宣言されている実体の集合を Hash で返します。
...体参照名をキーとし、対応する REXML::Entity オブジェクト
を値とするハッシュテーブルです。
これには、XML のデフォルトの実体(gt, lt, quot, apos)も含まれています。
//emlist[][ruby]{
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE foo [......<!ENTITY bar "barbarbarbar">
]>
EOS
p doctype.entities # => { "gt" => #<REXML::Entity: ...>,
# "lt" => #<REXML::Entity: ...>, ... }
p doctype.entities["bar"].to_s # => "<!ENTITY bar \"barbarbarbar\">"
p doctype.entities["gt"].to_s # => "<!ENTITY gt \">\">"
//}... -
REXML
:: Document # doctype -> REXML :: DocType | nil (18604.0) -
文書の DTD を返します。
文書の DTD を返します。
文書が DTD を持たない場合は nil を返します。 -
REXML
:: Document # xml _ decl -> REXML :: XMLDecl | nil (18604.0) -
文書の XML 宣言を返します。
文書の XML 宣言を返します。
文書が XML 宣言を持たない場合は nil を返します。 -
REXML
:: Document :: DECLARATION -> REXML :: XMLDecl (18604.0) -
この定数は deprecated です。REXML::XMLDecl.default を 代わりに使ってください。
...この定数は deprecated です。REXML::XMLDecl.default を
代わりに使ってください。
デフォルトとして使えるXML宣言オブジェクト。... -
REXML
:: Element # attributes -> REXML :: Attributes (18604.0) -
要素が保持している属性の集合を返します。
要素が保持している属性の集合を返します。 -
REXML
:: Element # comments -> [REXML :: Comments] (18604.0) -
すべての comment 子ノードの配列を返します。
すべての comment 子ノードの配列を返します。
返される配列は freeze されます。 -
REXML
:: Element # delete _ namespace(namespace = "xmlns") -> self (18604.0) -
名前空間を要素から削除します。
...はデフォルトの名前空間を削除します。
@param namespace 削除する名前空間の prefix
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
doc.root.delete_namespace
doc.to_s # => "<a xmlns:foo='bar'/>"
doc.root.delete_name... -
REXML
:: Element # document -> REXML :: Document | nil (18604.0) -
self が属する文書(REXML::Document)オブジェクトを返します。
...self が属する文書(REXML::Document)オブジェクトを返します。
属する文書がない場合には nil を返します。... -
REXML
:: Element # elements -> REXML :: Elements (18604.0) -
要素が保持している子要素の集合を返します。
要素が保持している子要素の集合を返します。 -
REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node (18604.0) -
self が属する文書のルートノードを返します。
...素が属する文書(REXML::Document) オブジェクトが
返されます。
その要素が属する REXML::Document オブジェクトが存在しない
場合は木構造上のルートノードが返されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)... -
REXML
:: Elements # collect(xpath = nil) {|element| . . } -> [object] (18604.0) -
Enumerable#collect と同様、 各子要素に対しブロックを呼び出し、その返り値の配列を返します。
...merable#collect と同様、
各子要素に対しブロックを呼び出し、その返り値の配列を返します。
xpath を指定した場合は、その XPath 文字列に
マッチする要素に対し同様の操作をします。
@param xpath XPath文字列
@see REXML::Elements#each... -
REXML
:: Elements # delete _ all(xpath) -> [REXML :: Element] (18604.0) -
xpath で指定した XPath 文字列にマッチする要素をすべて取り除きます。
...る要素をすべて取り除きます。
@param xpath 取り除く要素を指し示す XPath 文字列
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><c/><c/><c/><c/></a>')
doc.elements.delete_all("a/c") # => [<c/>, <c/>, <c/>, <c/>]
doc.to_s # =>... -
REXML
:: Elements # inject(xpath = nil , initial = nil) {|element| . . . } -> object (18604.0) -
Enumerable#inject と同様、 各子要素に対し畳み込みをします。
...Enumerable#inject と同様、
各子要素に対し畳み込みをします。
xpath を指定した場合は、その XPath 文字列に
マッチする要素に対し同様の操作をします。
@param xpath XPath文字列
@see REXML::Elements#each... -
REXML
:: Parsers :: SAX2Parser # listen(ary , listener) -> () (18604.0) -
コールバックをパーサに登録します。
...わります。
ブロックを指定した場合はそのブロックがコールバックされます。
ブロックを指定しない場合は REXML::SAX2Listener を include した
クラスのオブジェクトを指定します。
sym は以下のシンボルが指定でき、どの場合......か
については、
REXML::SAX2Listener の対応するメソッドで詳しく説明されていますので
そちらを参照してください。
* :start_document
(XML文書開始, REXML::SAX2Listener#start_document)
* :end_document
(XML文書終了, REXML::SAX2Listener#end_docu......素開始, REXML::SAX2Listener#start_element)
* :end_element
(要素終了, REXML::SAX2Listener#end_element)
* :start_prefix_mapping
(名前空間接頭辞導入, REXML::SAX2Listener#start_prefix_mapping)
* :end_prefix_mapping
(名前空間接頭辞適用終了, REXML::SAX2Listener... -
REXML
:: Parsers :: SAX2Parser # listen(listener) -> () (18604.0) -
コールバックをパーサに登録します。
...わります。
ブロックを指定した場合はそのブロックがコールバックされます。
ブロックを指定しない場合は REXML::SAX2Listener を include した
クラスのオブジェクトを指定します。
sym は以下のシンボルが指定でき、どの場合......か
については、
REXML::SAX2Listener の対応するメソッドで詳しく説明されていますので
そちらを参照してください。
* :start_document
(XML文書開始, REXML::SAX2Listener#start_document)
* :end_document
(XML文書終了, REXML::SAX2Listener#end_docu......素開始, REXML::SAX2Listener#start_element)
* :end_element
(要素終了, REXML::SAX2Listener#end_element)
* :start_prefix_mapping
(名前空間接頭辞導入, REXML::SAX2Listener#start_prefix_mapping)
* :end_prefix_mapping
(名前空間接頭辞適用終了, REXML::SAX2Listener... -
REXML
:: SAX2Listener # comment(comment) -> () (18604.0) -
XML文書内のコメントに出会ったときに呼び出されるコールバックメソッドです。
XML文書内のコメントに出会ったときに呼び出されるコールバックメソッドです。
@param comment コメントの内容が文字列で渡されます -
REXML
:: SAX2Listener # entitydecl(content) -> () (18604.0) -
DTDの実体宣言に出会ったときに呼び出されるコールバックメソッドです。
DTDの実体宣言に出会ったときに呼び出されるコールバックメソッドです。
@param content 実体宣言が配列で渡されます -
REXML
:: SAX2Listener # start _ prefix _ mapping(prefix , uri) -> () (18604.0) -
名前空間の接頭辞(prefix)が導入されたときに呼び出される コールバックメソッドです。
名前空間の接頭辞(prefix)が導入されたときに呼び出される
コールバックメソッドです。
以下のようなXMLを処理
<a xmlns:foo="http://foo.example.org/">
<foo:b />
</a>
すると
start_prefix_mapping("foo", "http://foo.example.org/")
start_element(nil, "a", "a", {"xmlns:foo" => "http://foo.example.org/"})
:
end_element(nil, "a", "a")
end_... -
REXML
:: StreamListener # comment(comment) -> () (18604.0) -
XML文書内のコメントをパースしたときに呼び出されるコールバックメソッドです。
XML文書内のコメントをパースしたときに呼び出されるコールバックメソッドです。
@param comment コメントの内容が文字列で渡されます -
REXML
:: StreamListener # entity(content) -> () (18604.0) -
DTD内で、パラメータ実体参照(%entityname;)が現れたときに呼び出される コールバックメソッドです。
...れた
場合はこのメソッドはコールバックされません。
各宣言のためのコールバックメソッド
(REXML::StreamListener#elementdecl や REXML::StreamListener#entitydecl
など)
の引数の一部として渡されます。
2.0.0 以前ではこのメソッドはコー... -
REXML
:: StreamListener # entitydecl(content) -> () (18604.0) -
DTDの実体宣言をパースしたときに呼び出されるコールバックメソッドです。
...き方によって content に渡されるデータの形式が異なります。
//emlist[][ruby]{
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
xml = <<EOS
<!DOCTYPE root [
<!ENTITY % YN '"Yes"'>
<!ENTITY % YN 'Yes'>
<!ENTITY WhatHeSaid "He......ch.xml">
<!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
]>
<root />
EOS
class Listener
include REXML::StreamListener
def entitydecl(content); p content; end
end
REXML::Parsers::StreamParser.new(xml, Listener.new).parse
# >> ["YN", "\"Yes\"", "%"]
# >> ["YN", "Yes", "%"]
# >> ["W... -
REXML
:: XMLDecl # encoding=(enc) (18604.0) -
エンコーディングを enc に設定します。
...エンコーディングを enc に設定します。
enc に nil を渡すと XML 宣言では encoding が
指定されていない(デフォルトで UTF-8 が使われる)
ことになります。
@param enc エンコーディング(文字列 or nil)
@see REXML::XMLDecl#encoding=... -
REXML
:: Element # delete _ attribute(key) -> REXML :: Attribute | nil (18502.0) -
要素から key という属性名の属性を削除します。
...合は削除されずに、nil を返します。
@param key 削除する要素(文字列(属性名) or REXML::Attributeオブジェクト)
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("E")
e.add_attribute("x", "foo"); e # => <E x='foo'/>
e.add_attribute("y:x", "bar"); e # =>... -
REXML
:: Element # add _ attributes(attrs) -> () (18484.0) -
要素の属性を複数追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...属性の属性名と属性値の対の集合(Array or Hash)
//emlist[][ruby]{
require '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 # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (18466.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...字列)
@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| p e }
# >> <b id='1'/>
# >>... -
REXML
:: Elements # each(xpath = nil) {|element| . . . } -> [REXML :: Elements] (18412.0) -
全ての子要素に対しブロックを呼び出します。
...呼び出します。
REXML::XPath.each などとは異なり、要素以外の
テキストノードなどはすべて無視されることに注意してください。
@param xpath XPath文字列
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a><b/......ments.each('b') {|e|p e} #-> Yields b, b elements
# <b/>,<c/>,<d/>,<b/>,<c/>,<d/> がブロックに渡される
doc.root.elements.each('child::node()') {|e|p e}
# <b/>,<c/>,<d/>,"sean",<b/>,<c/>,<d/> がブロックに渡される
REXML::XPath.each(doc.root, 'child::node()'){|node| p node }
//}... -
REXML
:: Attribute # namespace(arg = nil) -> String | nil (18394.0) -
属性の名前空間の URI を返します。
...でなく、arg という名前空間
の URI が返されます。
通常は省略します。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("xmlns:ns", "http://www.example.com/ns")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute... -
REXML
:: Attribute # prefix -> String (18394.0) -
属性の名前空間を返します。
...//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new( "elns:myelement" )
e.add_attribute( "nsa:a", "aval" )
e.add_attribute( "b", "bval" )
p e.attributes.get_attribute( "a" ).prefix # -> "nsa"
p e.attributes.get_attribute( "b" ).prefix # -> "elns"
a = REXML::Attribute.new( "x", "y"... -
REXML
:: Element # add _ attribute(attr) -> () (18376.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...で渡す方法と REXML::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:... -
REXML
:: Element # add _ attribute(key , value) -> () (18376.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...で渡す方法と REXML::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:... -
REXML
:: XPath . each(element , path = nil , namespaces = {} , variables = {}) {|e| . . . } -> () (18343.0) -
element の path で指定した XPath 文字列にマッチする各ノード に対してブロックを呼び出します。
...め、に用います。
@param element 要素(REXML::Element)
@param path XPath文字列
@param namespace 名前空間とURLの対応付け
@param variables 変数名とその値の対応付け
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:x='1'>
<a>......<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS
REXML::XPath.each(doc, "/root/a/b"){|e| p e.text }
# >> "b1"
# >> "b2"
//}...