種類
- インスタンスメソッド (213)
- 特異メソッド (35)
- 定数 (8)
- クラス (5)
クラス
-
REXML
:: AttlistDecl (7) -
REXML
:: Attribute (14) -
REXML
:: Attributes (16) -
REXML
:: CData (4) -
REXML
:: Child (7) -
REXML
:: Comment (8) -
REXML
:: Declaration (2) -
REXML
:: DocType (18) -
REXML
:: Document (19) -
REXML
:: Element (40) -
REXML
:: ElementDecl (1) -
REXML
:: Elements (13) -
REXML
:: Entity (13) -
REXML
:: ExternalEntity (3) -
REXML
:: Formatters :: Default (2) -
REXML
:: Formatters :: Pretty (3) -
REXML
:: Formatters :: Transitive (1) -
REXML
:: Instruction (6) -
REXML
:: NotationDecl (5) -
REXML
:: Parent (26) -
REXML
:: Text (12) -
REXML
:: XMLDecl (14) -
REXML
:: XPath (3)
モジュール
-
REXML
:: EntityConst (4) -
REXML
:: Namespace (6) -
REXML
:: Node (7) -
REXML
:: Security (2)
キーワード
- << (4)
- <=> (2)
- == (4)
- AMP (1)
- Comment (1)
- DECLARATION (1)
-
DEFAULT
_ ENTITIES (1) -
DEFAULT
_ VERSION (1) - Default (1)
- Entity (1)
- GT (1)
- LT (1)
- Pretty (1)
- QUOT (1)
- Transitive (1)
- UNDEFINED (1)
- [] (4)
- []= (1)
- add (5)
-
add
_ attribute (2) -
add
_ attributes (1) -
add
_ element (1) -
add
_ namespace (1) - attribute (1)
-
attribute
_ of (1) - attributes (1)
-
attributes
_ of (1) - cdatas (1)
- children (1)
- clone (9)
- collect (1)
- comments (1)
- compact (1)
- content (1)
- context (2)
-
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 (2)
- document (2)
- dowrite (1)
- each (6)
-
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
_ name (1) - elements (1)
- empty? (2)
- encoding (2)
- entities (1)
- entity (1)
-
entity
_ expansion _ limit (2) -
entity
_ expansion _ text _ limit (2) - 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
_ text? (1) - include? (1)
- index (2)
-
index
_ in _ parent (1) - inject (1)
-
insert
_ after (1) -
insert
_ before (1) - instructions (1)
- length (2)
-
local
_ name (1) - match (1)
- matches? (1)
- name (5)
- namespace (2)
- namespaces (3)
- ndata (1)
- new (23)
-
next
_ element (1) -
next
_ sibling (1) -
next
_ sibling _ node (1) -
node
_ type (9) - normalize (1)
- normalized (1)
- notation (1)
- notations (1)
- nowrite (1)
- parent (1)
- parent? (2)
-
parse
_ stream (1) - prefix (2)
- prefixes (2)
-
previous
_ element (1) -
previous
_ sibling (1) -
previous
_ sibling _ node (1) - pubid (1)
- public (2)
- push (1)
- raw (2)
- ref (1)
- remove (2)
-
replace
_ child (1) -
replace
_ with (1) - root (2)
-
root
_ node (1) - size (3)
-
stand
_ alone? (2) - standalone (1)
- string (1)
- system (2)
- target (1)
- text (1)
- texts (1)
-
to
_ a (3) -
to
_ s (9) -
to
_ string (1) - unnormalize (1)
- unnormalized (1)
- unshift (1)
- value (4)
- value= (1)
- version (2)
- whitespace (1)
- width (1)
- write (9)
- writeencoding (1)
- writethis (1)
-
xml
_ decl (1) - xmldecl (1)
- xpath (2)
検索結果
先頭5件
-
REXML
:: Element # delete _ element(element) -> REXML :: Element (28507.0) -
子要素を削除します。
...場合はそのうち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'/><d/><c/></a>"
doc.de... -
REXML
:: XMLDecl :: DEFAULT _ VERSION -> String (27607.0) -
REXML::XMLDecl.new や REXML::XMLDecl.default で の使われるデフォルトのXMLバージョン。
REXML::XMLDecl.new や REXML::XMLDecl.default で
の使われるデフォルトのXMLバージョン。 -
REXML
:: Comment # <=>(other) -> -1 | 0 | 1 (27307.0) -
other と内容(REXML::Comment#string)を比較します。
other と内容(REXML::Comment#string)を比較します。 -
REXML
:: Text # <=>(other) -> -1 | 0 | 1 (27307.0) -
テキストの内容を other と比較します。
テキストの内容を other と比較します。
@param other 比較対象(REXML::Text オブジェクトもしくは文字列) -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (19207.0) -
子要素を追加します。
...された要素です。
@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_ele... -
REXML
:: Elements # delete(element) -> Element (19207.0) -
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 # => <b/>
doc.root.to_s... -
REXML
:: Parent # replace _ child(to _ replace , replacement) -> () (19207.0) -
子ノード列上の to_replace を replacement に置き換えます。
子ノード列上の to_replace を replacement に置き換えます。
to_replace の parent は nil に、
replacement の parent は selfに変更されます。
@param to_replace 置き換え元のノード
@param replacement 置き換え先のノード -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (19087.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> ... </>
# >... -
REXML
:: Attributes # delete(attribute) -> REXML :: Element (18925.0) -
指定した属性を取り除きます。
...を返します。
@param attribute 取り除く属性(文字列もしくは 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:at... -
REXML
:: Attribute # element -> REXML :: Element (18907.0) -
その属性が属する要素を返します。
その属性が属する要素を返します。 -
REXML
:: DocType :: DEFAULT _ ENTITIES -> { String => REXML :: Entity } (18907.0) -
XML の仕様上デフォルトで定義されている実体の Hash table。
XML の仕様上デフォルトで定義されている実体の Hash table。
"amp" => REXML::EntityConst::AMP は含まれません。 -
REXML
:: Element # each _ element(xpath = nil) {|element| . . . } -> () (18907.0) -
各子要素を引数としてブロックを呼び出します。
各子要素を引数としてブロックを呼び出します。
xpath に文字列を指定するとそれにマッチする子要素のみを対象とします。
@param xpath XPath 文字列 -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (18907.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
:: Element # elements -> REXML :: Elements (18907.0) -
要素が保持している子要素の集合を返します。
要素が保持している子要素の集合を返します。 -
REXML
:: Element # get _ elements(xpath) -> [REXML :: Element] (18907.0) -
xpath にマッチする要素を配列で返します。
xpath にマッチする要素を配列で返します。
xpath には XPath 文字列を指定します。
@param xpath XPath 文字列
@see REXML::Elements#to_a -
REXML
:: Element # next _ element -> Element | nil (18907.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 # previous _ element -> Element | nil (18907.0) -
前の兄弟要素を返します。
前の兄弟要素を返します。
前の要素が存在しない場合は nil を返します。 -
REXML
:: Elements # delete _ all(xpath) -> [REXML :: Element] (18907.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
:: Entity # external -> String | nil (18907.0) -
実体が外部実体(external entity)宣言である場合は "SYSTEM" もしくは "PUBLIC" という文字列を返します。
実体が外部実体(external entity)宣言である場合は
"SYSTEM" もしくは "PUBLIC" という文字列を返します。
内部実体(internal entity)宣言である場合には nil を返します。 -
REXML
:: Parent # children -> [REXML :: Child] (18907.0) -
子ノード列の配列を返します。
子ノード列の配列を返します。 -
REXML
:: Attributes # delete _ all(name) -> [REXML :: Attribute] (18625.0) -
name という名前を持つ属性をすべて削除します。
...て削除します。
削除された属性を配列で返します。
@param 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=... -
REXML
:: Attributes # length -> Integer (18625.0) -
属性の個数を返します。
...属性の個数を返します。
//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_elements("/root/a").first
p a.attribu... -
REXML
:: CData # value -> String (18625.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
:: Element # has _ elements? -> bool (18625.0) -
self が一つでも子要素を持つならば true を返します。
...self が一つでも子要素を持つならば true を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b/><c>Text</c></a>")
doc.root.has_elements? # => true
doc.elements["/a/b"].has_elements? # => false
# /a/c はテキストノードしか... -
REXML
:: AttlistDecl # element _ name -> String (18607.0) -
属性を定義しているエレメントの名前を返します。
属性を定義しているエレメントの名前を返します。 -
REXML
:: AttlistDecl # include?(key) -> bool (18607.0) -
key が属性名であるならば真を返します。
key が属性名であるならば真を返します。
@param key 属性名であるかどうか判定する文字列 -
REXML
:: Attribute # clone -> REXML :: Element (18607.0) -
self を複製し返します。
self を複製し返します。 -
REXML
:: Attribute # value -> String (18607.0) -
正規化されていない属性値を返します。
正規化されていない属性値を返します。
属性値の正規化については XML の仕様を参考にしてください。 -
REXML
:: CData # clone -> REXML :: CData (18607.0) -
self を複製して返します。
self を複製して返します。
親ノードの情報は複製されません。 -
REXML
:: Child # next _ sibling -> REXML :: Node (18607.0) -
次の隣接ノードを返します。
次の隣接ノードを返します。
REXML::Node#next_sibling_node の別名です。
@see REXML::Child#next_sibling= -
REXML
:: Child # previous _ sibling -> REXML :: Node (18607.0) -
前の隣接ノードを返します。
前の隣接ノードを返します。
REXML::Node#previous_sibling_node の別名です。
@see REXML::Child#previous_sibling= -
REXML
:: Child # replace _ with(child) -> self (18607.0) -
親ノードの子ノード列上において、 self を child に置き換えます。
親ノードの子ノード列上において、 self を child に置き換えます。
@param child 置き換え後のノード
@see REXML::Parent#replace_child -
REXML
:: Comment # clone -> REXML :: Comment (18607.0) -
内容が複製された Comment オブジェクトを返します。 (親ノードの情報は複製されません)。
内容が複製された Comment オブジェクトを返します。
(親ノードの情報は複製されません)。 -
REXML
:: DocType # clone -> REXML :: DocType (18607.0) -
self の複製を返します。
self の複製を返します。
external_id (REXML::DocType#external_id) と
名前(REXML::DocType#name) のみ複製されるため、
結果として得られるオブジェクトはあまり有用ではないでしょう。 -
REXML
:: DocType # external _ id -> String | nil (18607.0) -
DTD が外部サブセットを用いている場合は "SYSTEM", "PUBLIC" の いずれかの文字列を返します。
..."SYSTEM", "PUBLIC" の
いずれかの文字列を返します。
それ以外の場合は nil を返します。
//emlist[][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/... -
REXML
:: DocType # public -> String | nil (18607.0) -
DTD の公開識別子を返します。
...す。
DTD が公開識別子による外部サブセットを含んでいない場合は nil を返します。
//emlist[][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/D... -
REXML
:: Document # clone -> REXML :: Document (18607.0) -
self を複製します。
self を複製します。
REXML::Document.new(self) と同じです。 -
REXML
:: Document # stand _ alone? -> String (18607.0) -
XML 宣言の standalone の値を文字列で返します。
...XML 宣言の standalone の値を文字列で返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<e />
EOS
doc.stand_alone? # => "yes"
//}... -
REXML
:: Document # xml _ decl -> REXML :: XMLDecl | nil (18607.0) -
文書の XML 宣言を返します。
文書の XML 宣言を返します。
文書が XML 宣言を持たない場合は nil を返します。 -
REXML
:: Document . entity _ expansion _ limit -> Integer (18607.0) -
実体参照の展開回数の上限を返します。
実体参照の展開回数の上限を返します。
XML 文書(REXML::Document)ごとの展開回数がこの値を越えると
例外を発生させ、処理を中断します。
実体参照の展開処理を使った DoS 攻撃に対抗するための
仕組みです。
デフォルトは 10000 です。
このメソッドは Ruby 2.1 から deprecated になりました。
REXML::Security.entity_expansion_limit を使ってください。
@see REXML::Document.entity_expansion_limit= -
REXML
:: Document . entity _ expansion _ text _ limit -> Integer (18607.0) -
実体参照の展開による文字列の増分(テキストのバイト数)の 最大値を指定します。
実体参照の展開による文字列の増分(テキストのバイト数)の
最大値を指定します。
展開によって増分値がこの値を越えると
例外を発生させ、処理を中断します。
実体参照の展開処理を使った DoS 攻撃に対抗するための
仕組みです。
デフォルトは 10240 (byte) です。
このメソッドは Ruby 2.1 から deprecated になりました。
REXML::Security.entity_expansion_text_limit を使ってください。
@see REXML::Document.entity_expansion_text_limit=,
http://ww... -
REXML
:: Document :: DECLARATION -> REXML :: XMLDecl (18607.0) -
この定数は deprecated です。REXML::XMLDecl.default を 代わりに使ってください。
この定数は deprecated です。REXML::XMLDecl.default を
代わりに使ってください。
デフォルトとして使えるXML宣言オブジェクト。 -
REXML
:: Element # clone -> REXML :: Element (18607.0) -
self を複製して返します。
self を複製して返します。
複製されるのは名前、属性、名前空間のみです。
子ノードは複製されません。 -
REXML
:: Element # delete _ attribute(key) -> REXML :: Attribute | nil (18607.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 # => <E x='foo' y:x='bar'/>
e.de... -
REXML
:: Element # delete _ namespace(namespace = "xmlns") -> self (18607.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.delet... -
REXML
:: Elements # collect(xpath = nil) {|element| . . } -> [object] (18607.0) -
Enumerable#collect と同様、 各子要素に対しブロックを呼び出し、その返り値の配列を返します。
Enumerable#collect と同様、
各子要素に対しブロックを呼び出し、その返り値の配列を返します。
xpath を指定した場合は、その XPath 文字列に
マッチする要素に対し同様の操作をします。
@param xpath XPath文字列
@see REXML::Elements#each -
REXML
:: Entity # normalized -> String | nil (18607.0) -
正規化された(normalized)実体の値を返します。
正規化された(normalized)実体の値を返します。
すなわち、一切の実体参照を展開していない値を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#unnormalized -
REXML
:: Entity # unnormalized -> String | nil (18607.0) -
非正規化された(unnormalized)実体の値を返します。
非正規化された(unnormalized)実体の値を返します。
すなわち、self が属する DTD によってすべての実体参照(&ent; と %ent; の両方)
を展開した文字列を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#normalized -
REXML
:: Entity # value -> String | nil (18607.0) -
実体の値を返します。
実体の値を返します。
パラメータ実体参照(parameter entity)のみが展開され、
そうでない実体参照(general entity)は展開されて
いないような値が返されます。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#unnormalized, REXML::Entity#normalized -
REXML
:: EntityConst :: LT -> REXML :: Entity (18607.0) -
「<」「<」というエンティティを表わすオブジェクト。
「<」「<」というエンティティを表わすオブジェクト。 -
REXML
:: Instruction # clone -> REXML :: Instruction (18607.0) -
self を複製します。
self を複製します。 -
REXML
:: Namespace # fully _ expanded _ name -> String (18607.0) -
完全修飾名を返します。
完全修飾名を返します。 -
REXML
:: Namespace # local _ name -> String (18607.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Node # next _ sibling _ node -> REXML :: Node | nil (18607.0) -
次の兄弟ノードを返します。
次の兄弟ノードを返します。
次の兄弟ノードが存在しない場合(ノードがルートである場合や、
最後のノードである場合)は nil を返します。 -
REXML
:: Node # previous _ sibling _ node -> REXML :: Node | nil (18607.0) -
前の兄弟ノードを返します。
前の兄弟ノードを返します。
前の兄弟ノードが存在しない場合(ノードがルートである場合や、
最初のノードである場合)は nil を返します。 -
REXML
:: NotationDecl # public -> String | nil (18607.0) -
公開識別子を返します。
公開識別子を返します。
宣言が公開識別子を含まない場合は nil を返します。 -
REXML
:: Parent # deep _ clone -> REXML :: Parent (18607.0) -
ノードを複製し、複製されたノードを返します。
ノードを複製し、複製されたノードを返します。
子ノードも複製されます。 -
REXML
:: Parent # delete(object) -> REXML :: Child | nil (18607.0) -
object を子ノード列から削除します。
object を子ノード列から削除します。
削除されたノードの親は nil に設定されます。
削除したノードを返します。削除されなかった場合は nil を返します。
@param object 削除するノード -
REXML
:: Parent # delete _ at(index) -> REXML :: Child | nil (18607.0) -
子ノード列上の index で指定された場所の要素を取り除きます。
子ノード列上の index で指定された場所の要素を取り除きます。
取り除いだノードを返します。indexが範囲外である場合は何もせず
nil を返します。 -
REXML
:: Parent # delete _ if -> Enumerator (18607.0) -
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # delete _ if {|object| . . . } -> () (18607.0) -
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each _ child -> Enumerator (18607.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each _ child {|object| . . . } -> () (18607.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # length -> Integer (18607.0) -
保持している子ノードの数を返します。
保持している子ノードの数を返します。 -
REXML
:: Security . entity _ expansion _ limit -> Integer (18607.0) -
実体参照の展開回数の上限を返します。
実体参照の展開回数の上限を返します。
XML 文書(REXML::Document)ごとの展開回数がこの値を越えると
例外を発生させ、処理を中断します。
実体参照の展開処理を使った DoS 攻撃に対抗するための
仕組みです。
デフォルトは 10000 です。
@see REXML::Document.entity_expansion_limit -
REXML
:: Security . entity _ expansion _ text _ limit -> Integer (18607.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
:: Text # clone -> REXML :: Text (18607.0) -
self を複製します。
self を複製します。 -
REXML
:: Text # value -> String (18607.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 . normalize(input , doctype = nil , entity _ filter = nil) -> String (18607.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 (18607.0) -
string を非正規化(すべての entity をアンエスケープ)したものを 返します。
string を非正規化(すべての entity をアンエスケープ)したものを
返します。
filter でアンエスケープしない実体の実体名を文字列配列で指定します。
@param string 非正規化する文字列
@param doctype DTD(REXML::DocType オブジェクト)
@param filter アンエスケープしない実体の実体名(文字列配列)
@param illegal 内部用。使わないでください。
//emlist[][ruby]{
require 'rexml/text'
REXML::Text.unnormalize("& &foobar; ... -
REXML
:: XMLDecl # clone -> REXML :: XMLDecl (18607.0) -
self を複製します。
self を複製します。 -
REXML
:: XMLDecl # stand _ alone? -> String | nil (18607.0) -
スタンドアロン文書であるかどうかを "yes" "no" で 返します。
スタンドアロン文書であるかどうかを "yes" "no" で
返します。
nil(省略)を返す場合もあります。 -
REXML
:: XMLDecl # standalone -> String | nil (18607.0) -
スタンドアロン文書であるかどうかを "yes" "no" で 返します。
スタンドアロン文書であるかどうかを "yes" "no" で
返します。
nil(省略)を返す場合もあります。 -
REXML
:: XMLDecl # xmldecl(version , encoding , standalone) -> () (18607.0) -
内容を更新します。
内容を更新します。
@param version バージョン(文字列)
@param encoding エンコーディング(文字列 or nil)
@param standalone スタンドアロン文章かどうか("yes", "no", nil) -
REXML
:: XMLDecl . default -> REXML :: XMLDecl (18607.0) -
XML宣言を含まない文章でデフォルトで使うための XMLDecl オブジェクトを生成して返します。
XML宣言を含まない文章でデフォルトで使うための
XMLDecl オブジェクトを生成して返します。 -
REXML
:: Text # value=(val) (18325.0) -
テキストの内容を val に変更します。
...al には非正規化された(エスケープされていない)文字列を渡さなければ
なりません。
//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
:: Formatters :: Default (18079.0) -
XMLドキュメントを(文字列として)出力するクラスです。
...ML::Formatters::Pretty と
異なりテキストの改行や空白を修正せずにそのまま出力します。
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/formatters/default'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren/>
</children>
</root>
EOS
default_form... -
REXML
:: Element # context -> {Symbol => object} | nil (10207.0) -
要素の「コンテキスト」を Hash で返します。
要素の「コンテキスト」を Hash で返します。
コンテキストとは text node (REXML::Text) での特別な文字、特に空白について
の取り扱いについての設定です。
以下の Symbol をハッシュのキーとして使います。
: :respect_whitespace
空白を考慮して欲しい要素の名前の集合を文字列の配列で指定します。
また、すべての要素で空白を考慮して欲しい場合には
:all を指定します。
デフォルト値は :all です。
REXML::Element#whitespace も参照してください。
: :compress_whitespac... -
REXML
:: XPath . first(element , path = nil , namespaces = {} , variables = {}) -> Node | nil (10105.0) -
element の 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 . match(element , path = nil , namespaces = {} , variables = {}) -> [Node] (10105.0) -
element の 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(element , path = nil , namespaces = {} , variables = {}) {|e| . . . } -> () (10069.0) -
element の 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
:: Element # root _ node -> REXML :: Document | REXML :: Node (9979.0) -
self が属する文書のルートノードを返します。
...XML::Document オブジェクトが存在しない
場合は木構造上のルートノードが返されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children")... -
REXML
:: DocType # context -> { Symbol => object } (9907.0) -
DTD が属する文書の「コンテキスト」を返します。
DTD が属する文書の「コンテキスト」を返します。
具体的には親ノードである REXML::Document オブジェクトの
REXML::Element#context を返します。
コンテキストの具体的な内容については REXML::Element#context を
参照してください。 -
REXML
:: DocType # entities -> { String => REXML :: Entity } (9907.0) -
DTD で宣言されている実体の集合を Hash で返します。
DTD で宣言されている実体の集合を Hash で返します。
返される 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
:: DocType # write(output , indent = 0 , transitive = false , ie _ hack = false) -> () (9907.0) -
output に DTD を出力します。
...ます。指定しないでください。
@param ie_hack 無視されます。指定しないでください。
//emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book... -
REXML
:: Document # write(output = $ stdout , indent = -1 , transitive = false , ie _ hack = false , encoding=nil) -> () (9907.0) -
output に XML 文書を出力します。
output に XML 文書を出力します。
XML宣言、DTD、処理命令を(もしあるならば)含む文書を出力します。
注意すべき点として、
元の XML 文書が XML宣言を含んでいなくとも
出力される XML はデフォルトの XML 宣言を含んでいるべきであるが、
REXML は明示しない限り(つまりXML宣言を REXML::Document#add で
追加しない限り)
それをしない、ということである。XML-RPCのような利用法では
ネットワークバンドを少しでも節約する必要があるためである。
2.0.0以降ではキーワード引数による引数指定が可能です。
@param outpu... -
REXML
:: Document # write(output: $ stdout , indent: -1 , transitive: false , ie _ hack: false , encoding: nil) -> () (9907.0) -
output に XML 文書を出力します。
output に XML 文書を出力します。
XML宣言、DTD、処理命令を(もしあるならば)含む文書を出力します。
注意すべき点として、
元の XML 文書が XML宣言を含んでいなくとも
出力される XML はデフォルトの XML 宣言を含んでいるべきであるが、
REXML は明示しない限り(つまりXML宣言を REXML::Document#add で
追加しない限り)
それをしない、ということである。XML-RPCのような利用法では
ネットワークバンドを少しでも節約する必要があるためである。
2.0.0以降ではキーワード引数による引数指定が可能です。
@param outpu... -
REXML
:: Elements # <<(element = nil) -> REXML :: Element (9907.0) -
要素 element を追加します。
...の要素が追加されます。
追加された要素が返されます。
@param element 追加する要素
//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new('a')
a.elements.add(REXML::Element.new('b')) # => <b/>
a.to_s # => "<a><b/></a>"
a.elements.add('c') # => <c/>
a.to_s #... -
REXML
:: Elements # add(element = nil) -> REXML :: Element (9907.0) -
要素 element を追加します。
...の要素が追加されます。
追加された要素が返されます。
@param element 追加する要素
//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new('a')
a.elements.add(REXML::Element.new('b')) # => <b/>
a.to_s # => "<a><b/></a>"
a.elements.add('c') # => <c/>
a.to_s #... -
REXML
:: Parent # insert _ after(child1 , child2) -> self (9907.0) -
child2 を child1 で指定したノードの後ろに挿入します。
child2 を child1 で指定したノードの後ろに挿入します。
child1 が REXML::Child のインスタンスであるならば、その
子ノードの後ろに挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定されるノードの
後ろに挿入されます。
挿入されるノード(child2)の親は self に変更されます。
@param child1 挿入場所の指定
@param child2 挿入されるノード -
REXML
:: Parent # insert _ before(child1 , child2) -> self (9907.0) -
child2 を child1 で指定したノードの前に挿入します。
child2 を child1 で指定したノードの前に挿入します。
child1 が REXML::Child のインスタンスであるならば、その
子ノードの前に挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定されるノードの
前に挿入されます。
挿入されるノード(child2)の親は self に変更されます。
@param child1 挿入場所の指定
@param child2 挿入されるノード -
REXML
:: Element # get _ text(path = nil) -> REXML :: Text | nil (9679.0) -
先頭のテキスト子ノードを返します。
...ストノードがない場合には 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 tex... -
REXML
:: Element # root -> REXML :: Element (9679.0) -
self が属する文書のルート要素を返します。
...self が属する文書のルート要素を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children").first
children.name # => "children"
children.root.name... -
REXML
:: Element # text(path = nil) -> String | nil (9679.0) -
先頭のテキスト子ノードの文字列を返します。
...トノードがない場合には 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
:: Attributes # [](name) -> String | nil (9625.0) -
属性名nameの属性値を返します。
...い。
nameという属性名の属性がない場合は nil を返します。
@param 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... -
REXML
:: Attributes # each {|name , value| . . . } -> () (9625.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='... -
REXML
:: Attributes # get _ attribute(name) -> Attribute | nil (9625.0) -
name という名前の属性を取得します。
...持つ属性がない場合は nil を返します。
@param name 属性名(文字列)
@see REXML::Attributes#[]
//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:at... -
REXML
:: Attributes # get _ attribute _ ns(namespace , name) -> REXML :: Attribute | nil (9625.0) -
namespace と name で特定される属性を返します。
...定することができます。
@param namespace 名前空間(URI, 文字列)
@param 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... -
REXML
:: Attributes # namespaces -> { String => String } (9625.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=... -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (9625.0) -
name で指定される属性を返します。
...場合は nil を返します。
@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//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=...