クラス
-
REXML
:: AttlistDecl (2) -
REXML
:: Attribute (6) -
REXML
:: Attributes (3) -
REXML
:: CData (2) -
REXML
:: Comment (5) -
REXML
:: Declaration (1) -
REXML
:: DocType (7) -
REXML
:: Document (5) -
REXML
:: Element (6) -
REXML
:: Entity (9) -
REXML
:: ExternalEntity (1) -
REXML
:: Instruction (2) -
REXML
:: NotationDecl (4) -
REXML
:: ParseException (1) -
REXML
:: Text (2) -
REXML
:: XMLDecl (4)
モジュール
-
REXML
:: Namespace (5) -
REXML
:: Node (1)
キーワード
- <=> (1)
- == (1)
- [] (2)
-
add
_ element (1) -
attribute
_ of (1) - content (1)
-
element
_ name (1) - encoding (2)
- entities (1)
- entity (1)
- external (1)
-
external
_ id (1) -
local
_ name (1) - name (5)
- namespace (2)
- namespaces (2)
- ndata (1)
- normalized (1)
- prefix (2)
- prefixes (2)
- pubid (1)
- public (2)
- ref (1)
-
stand
_ alone? (2) - standalone (1)
- string= (1)
- system (2)
- target (1)
- text (1)
-
to
_ s (10) -
to
_ string (1) - unnormalized (1)
- value (4)
- version (2)
- xpath (2)
検索結果
先頭5件
-
REXML
:: Comment # string -> String (54616.0) -
コメント文字列を返します。
コメント文字列を返します。 -
REXML
:: Attribute # to _ string -> String (18631.0) -
"name='value'" という形式の文字列を返します。
..."name='value'" という形式の文字列を返します。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").to_string # => "ns:r='rval'"
//}... -
REXML
:: Comment # string=(value) (18310.0) -
コメント文字列を設定します。
コメント文字列を設定します。
@param value 設定する文字列 -
REXML
:: Comment # to _ s -> String (9316.0) -
コメント文字列を返します。
コメント文字列を返します。 -
REXML
:: Attributes # namespaces -> { String => String } (613.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
:: Element # namespaces -> {String => String} (613.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
:: CData # to _ s -> String (313.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
:: CData # value -> String (313.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
:: Document # expanded _ name -> String (313.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Document # name -> String (313.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Namespace # local _ name -> String (313.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Namespace # name -> String (313.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: ParseException # to _ s -> String (313.0) -
例外情報を文字列化して返します。
例外情報を文字列化して返します。 -
REXML
:: XMLDecl # stand _ alone? -> String | nil (313.0) -
スタンドアロン文書であるかどうかを "yes" "no" で 返します。
スタンドアロン文書であるかどうかを "yes" "no" で
返します。
nil(省略)を返す場合もあります。 -
REXML
:: XMLDecl # standalone -> String | nil (313.0) -
スタンドアロン文書であるかどうかを "yes" "no" で 返します。
スタンドアロン文書であるかどうかを "yes" "no" で
返します。
nil(省略)を返す場合もあります。 -
REXML
:: AttlistDecl # [](key) -> String | nil (310.0) -
key という属性名のデフォルト値を返します。
key という属性名のデフォルト値を返します。
key という名前の属性が存在しない、もしくは
デフォルト値を持たない場合は nil を返します。 -
REXML
:: AttlistDecl # element _ name -> String (310.0) -
属性を定義しているエレメントの名前を返します。
属性を定義しているエレメントの名前を返します。 -
REXML
:: Attribute # namespace(arg = nil) -> String | nil (310.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 (310.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
:: Attribute # to _ s -> String (310.0) -
正規化された属性値を返します。
正規化された属性値を返します。
属性値の正規化については XML の仕様を参考にしてください。 -
REXML
:: Attribute # value -> String (310.0) -
正規化されていない属性値を返します。
正規化されていない属性値を返します。
属性値の正規化については XML の仕様を参考にしてください。 -
REXML
:: Attribute # xpath -> String (310.0) -
その属性を指定する xpath 文字列を返します。
その属性を指定する xpath 文字列を返します。
例えば "/foo/bar/@ns:r" という文字列を返します。 -
REXML
:: Attributes # [](name) -> String | nil (310.0) -
属性名nameの属性値を返します。
...はなく REXML::Attribute オブジェクトが必要な場合は
REXML::Attributes#get_attribute を使ってください。
nameという属性名の属性がない場合は nil を返します。
@param name 属性名(文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Documen... -
REXML
:: Attributes # prefixes -> [String] (310.0) -
self の中で宣言されている prefix の集合を 文字列の配列で返します。
...ます。
self が属する要素より上位の要素で定義されているものは含みません。
//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... -
REXML
:: Declaration # to _ s -> String (310.0) -
ノードを文字列化します。
ノードを文字列化します。 -
REXML
:: DocType # attribute _ of(element , attribute) -> String | nil (310.0) -
DTD 内の属性リスト宣言で、 element という名前の要素の attribute という 名前の属性のデフォルト値を返します。
...合は nil を返します。
@param element 要素名(文字列)
@param attribute 属性名(文字列)
//emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book
author... -
REXML
:: DocType # entities -> { String => REXML :: Entity } (310.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
:: DocType # entity(name) -> String | nil (310.0) -
name という実体参照名を持つ実体を文字列で返します。
...れる文字列は非正規化(REXML::Entity#unnormalized 参照)
された文字列が返されます。
name という名前を持つ実体が存在しない場合には nil を返します。
@param name 実体参照名(文字列)
//emlist[][ruby]{
doctype = REXML::Document.new(<<EOS).doctype... -
REXML
:: DocType # external _ id -> String | nil (310.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
:: DocType # name -> String (310.0) -
ルート要素名を返します。
...ルート要素名を返します。
//emlist[][ruby]{
document = REXML::Document.new(<<EOS)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
EOS
doctype = document.doctype
p doctype.name # => "html"
//}... -
REXML
:: DocType # public -> String | nil (310.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/DTD/xhtm......l1-strict.dtd">
EOS
doctype.system # => "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype.public # => "-//W3C//DTD XHTML 1.0 Strict//EN"
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE root SYSTEM "foobar">
EOS
doctype.system # => "foobar"
doctype.public # => nil
//}... -
REXML
:: DocType # system -> String | nil (310.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/DTD/xhtml1......-strict.dtd">
EOS
doctype.system # => "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype.public # => "-//W3C//DTD XHTML 1.0 Strict//EN"
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE root SYSTEM "foobar">
EOS
doctype.system # => "foobar"
doctype.public # => nil
//}... -
REXML
:: Document # encoding -> String (310.0) -
XML 宣言に含まれている XML 文書のエンコーディングを返します。
...を返します。
文書が XML 宣言を持たない場合はデフォルトの値
(REXML::XMLDecl.defaultで宣言されているもの)を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<e />
EO... -
REXML
:: Document # stand _ alone? -> String (310.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 # version -> String (310.0) -
XML 宣言に含まれている XML 文書のバージョンを返します。
...を返します。
文書が XML 宣言を持たない場合はデフォルトの値
(REXML::XMLDecl.defaultで宣言されているもの)を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<e />
EO... -
REXML
:: Element # namespace(prefix=nil) -> String (310.0) -
self の文脈で prefix が指している名前空間の URI を返します。
...ます。
prefix で指示される名前空間の宣言が存在しない場合は nil を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/><y:d /></a>")
b = doc.elements['//b']
b.namespace # => "1"
b.namespace(... -
REXML
:: Element # prefixes -> [String] (310.0) -
self の文脈で定義されている prefix を文字列の配列を返します。
...字列の配列を返します。
対象の要素とその外側の要素で定義されている 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'].prefixes # => ["x", "y"]
//}... -
REXML
:: Element # text(path = nil) -> String | nil (310.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
:: Element # xpath -> String (310.0) -
文書上の対象の要素にのみマッチする xpath 文字列を返します。
...る xpath 文字列を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/><c/></a>')
c = doc.root.elements[2] # <a> .. </a> の中の <c/> 要素
c # => <c/>
c.xpath # => "/a/c"
doc = REXML::Document.new('<a><b/><b/></a>')
b = doc.root.elements[2] # <a> .. <... -
REXML
:: Entity # external -> String | nil (310.0) -
実体が外部実体(external entity)宣言である場合は "SYSTEM" もしくは "PUBLIC" という文字列を返します。
実体が外部実体(external entity)宣言である場合は
"SYSTEM" もしくは "PUBLIC" という文字列を返します。
内部実体(internal entity)宣言である場合には nil を返します。 -
REXML
:: Entity # name -> String (310.0) -
実体の名前を返します。
実体の名前を返します。 -
REXML
:: Entity # ndata -> String | nil (310.0) -
解析対象外実体(unparsed entity)宣言である場合には その記法名(notation name)を返します。
解析対象外実体(unparsed entity)宣言である場合には
その記法名(notation name)を返します。
それ以外の場合は nil を返します。 -
REXML
:: Entity # normalized -> String | nil (310.0) -
正規化された(normalized)実体の値を返します。
...正規化された(normalized)実体の値を返します。
すなわち、一切の実体参照を展開していない値を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#unnormalized... -
REXML
:: Entity # pubid -> String | nil (310.0) -
公開識別子(public identifier)を用いた外部実体宣言の場合は、その公開識別子を 返します。
公開識別子(public identifier)を用いた外部実体宣言の場合は、その公開識別子を
返します。
それ以外の場合は nil を返します。 -
REXML
:: Entity # ref -> String | nil (310.0) -
外部実体(external entity)宣言の URI を返します。
外部実体(external entity)宣言の URI を返します。
内部実体宣言の場合は nil を返します。 -
REXML
:: Entity # to _ s -> String (310.0) -
実体宣言を文字列化したものを返します。
...実体宣言を文字列化したものを返します。
@see REXML::Entity#write
//emlist[][ruby]{
e = REXML::ENTITY.new("w", "wee");
p e.to_s # => "<!ENTITY w \"wee\">"
//}... -
REXML
:: Entity # unnormalized -> String | nil (310.0) -
非正規化された(unnormalized)実体の値を返します。
...体の値を返します。
すなわち、self が属する DTD によってすべての実体参照(&ent; と %ent; の両方)
を展開した文字列を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#normalized... -
REXML
:: Entity # value -> String | nil (310.0) -
実体の値を返します。
...ータ実体参照(parameter entity)のみが展開され、
そうでない実体参照(general entity)は展開されて
いないような値が返されます。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#unnormalized, REXML::Entity#normalized... -
REXML
:: ExternalEntity # to _ s -> String (310.0) -
宣言を文字列化します。
宣言を文字列化します。 -
REXML
:: Instruction # content -> String | nil (310.0) -
XML 処理命令の内容を返します。
...XML 処理命令の内容を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<?foobar?>
<root />
EOS
doc[2] # => <?p-i xml-stylesheet ...?>
doc[2].target # => "xml-... -
REXML
:: Instruction # target -> String (310.0) -
XML 処理命令のターゲットを返します。
...XML 処理命令のターゲットを返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<root />
EOS
doc[2] # => <?p-i xml-stylesheet ...?>
doc[2].target # => "xml-st... -
REXML
:: Namespace # expanded _ name -> String (310.0) -
REXML::Namespace#name= で設定された名前を返します。
...REXML::Namespace#name= で設定された名前を返します。
name= で指定した名前が prefix を含んでいれば
prefix を含む名前を返し、そうでなければ
prefix を含まない名前を返します。
@see REXML::Namespace#prefix... -
REXML
:: Namespace # fully _ expanded _ name -> String (310.0) -
完全修飾名を返します。
完全修飾名を返します。 -
REXML
:: Namespace # prefix -> String (310.0) -
prefix (前置修飾子) を返します。
...prefix (前置修飾子) を返します。
@see REXML::Namespace#prefix=... -
REXML
:: Node # to _ s(indent = -1) -> String (310.0) -
ノードを文字列に変換します。
ノードを文字列に変換します。
@param indent このパラメータは deprecated で、無視されます -
REXML
:: NotationDecl # name -> String (310.0) -
記法宣言の名前を返します。
記法宣言の名前を返します。 -
REXML
:: NotationDecl # public -> String | nil (310.0) -
公開識別子を返します。
公開識別子を返します。
宣言が公開識別子を含まない場合は nil を返します。 -
REXML
:: NotationDecl # system -> String | nil (310.0) -
システム識別子(URI)を返します。
システム識別子(URI)を返します。
宣言がシステム識別子を含まない場合は nil を返します。 -
REXML
:: NotationDecl # to _ s -> String (310.0) -
self を文字列化したものを返します。
self を文字列化したものを返します。 -
REXML
:: Text # to _ s -> String (310.0) -
テキストの内容を正規化(すべての実体をエスケープ)された状態で返します。
...まり返り値は XML のテキストとして妥当です。
結果は 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 # => "< & foobar"... -
REXML
:: Text # value -> String (310.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
:: XMLDecl # encoding -> String | nil (310.0) -
設定されているエンコーディングの名前を文字列で返します。
設定されているエンコーディングの名前を文字列で返します。
エンコーディングが指定されていない(デフォルトの UTF-8 とみなされます)
場合は nil を返します。 -
REXML
:: XMLDecl # version -> String (310.0) -
XML文書のバージョンを文字列で返します。
XML文書のバージョンを文字列で返します。 -
REXML
:: Comment # <=>(other) -> -1 | 0 | 1 (55.0) -
other と内容(REXML::Comment#string)を比較します。
...other と内容(REXML::Comment#string)を比較します。... -
REXML
:: Comment # ==(other) -> bool (55.0) -
other と内容(REXML::Comment#string)が同じならば真を返します。
...other と内容(REXML::Comment#string)が同じならば真を返します。... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (43.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...