クラス
-
REXML
:: AttlistDecl (2) -
REXML
:: Attribute (3) -
REXML
:: Attributes (10) -
REXML
:: DocType (7) -
REXML
:: Document (2) -
REXML
:: Element (12) -
REXML
:: Elements (1) -
REXML
:: Entity (2) -
REXML
:: NotationDecl (1)
モジュール
-
REXML
:: Namespace (8)
キーワード
- << (1)
- [] (2)
- []= (1)
- add (1)
-
add
_ attributes (1) -
add
_ namespace (2) - attribute (1)
-
attributes
_ of (1) - clone (1)
-
delete
_ all (1) -
delete
_ namespace (1) - each (2)
-
each
_ attribute (1) -
each
_ element _ with _ attribute (1) -
each
_ element _ with _ text (1) -
element
_ name (1) - entity (1)
-
external
_ id (1) -
get
_ attribute (1) -
get
_ attribute _ ns (1) -
has
_ name? (1) -
local
_ name (1) - name= (1)
- namespace (2)
- namespaces (3)
- ndata (1)
- notation (1)
- prefix (1)
- prefix= (1)
- root (1)
-
root
_ node (1) -
to
_ string (1) - whitespace (1)
- write (1)
検索結果
先頭5件
-
REXML
:: Namespace # name -> String (63316.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Document # name -> String (54334.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: DocType # name -> String (54331.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
:: Entity # name -> String (54313.0) -
実体の名前を返します。
実体の名前を返します。 -
REXML
:: NotationDecl # name -> String (54313.0) -
記法宣言の名前を返します。
記法宣言の名前を返します。 -
REXML
:: Namespace # name=(name) (27634.0) -
名前を設定します。
名前を設定します。
prefix を持つ名前も持たない名前も受け付けます。
@param name 名前(文字列) -
REXML
:: Namespace # expanded _ name -> String (27379.0) -
REXML::Namespace#name= で設定された名前を返します。
REXML::Namespace#name= で設定された名前を返します。
name= で指定した名前が prefix を含んでいれば
prefix を含む名前を返し、そうでなければ
prefix を含まない名前を返します。
@see REXML::Namespace#prefix -
REXML
:: Namespace # has _ name?(other , ns = nil) -> bool (27349.0) -
self が other と ns で指定した名前を持っているならば真を返します。
self が other と ns で指定した名前を持っているならば真を返します。
ns が nil でない場合は名前空間も比較されます。
other が ":" を含んでいる(つまり prefix を含んでいる)場合は
REXML::Namespace#fully_expanded_name と other を比較します。
どちらでもない場合は other と REXML::Namespace#name を直接
比較します。
@param other 比較する名前(文字列)
@param ns 比較する名前空間(文字列) -
REXML
:: Namespace # local _ name -> String (27316.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Namespace # fully _ expanded _ name -> String (27313.0) -
完全修飾名を返します。
完全修飾名を返します。 -
REXML
:: Element # delete _ namespace(namespace = "xmlns") -> self (18610.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
:: Document # expanded _ name -> String (18334.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: AttlistDecl # element _ name -> String (18313.0) -
属性を定義しているエレメントの名前を返します。
属性を定義しているエレメントの名前を返します。 -
REXML
:: Attribute # namespace(arg = nil) -> String | nil (18310.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_attrib... -
REXML
:: Attributes # namespaces -> { String => String } (18310.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
:: DocType # namespaces -> nil (18310.0) -
nil を返します。
nil を返します。 -
REXML
:: Element # add _ namespace(prefix , uri) -> self (18310.0) -
名前空間を要素に追加します。
...る場合はそれが上書きされます。
@param prefix 名前空間の prefix
@param uri 名前空間の uri
//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new("a")
a.add_namespace("xmlns:foo", "bar" )
a.add_namespace("foo", "bar") # 上と同じ意味
a.add_namespace("twiddle... -
REXML
:: Element # add _ namespace(uri) (18310.0) -
名前空間を要素に追加します。
...る場合はそれが上書きされます。
@param prefix 名前空間の prefix
@param uri 名前空間の uri
//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new("a")
a.add_namespace("xmlns:foo", "bar" )
a.add_namespace("foo", "bar") # 上と同じ意味
a.add_namespace("twiddle... -
REXML
:: Element # namespace(prefix=nil) -> String (18310.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.name... -
REXML
:: Element # namespaces -> {String => String} (18310.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
:: Namespace # prefix -> String (9010.0) -
prefix (前置修飾子) を返します。
prefix (前置修飾子) を返します。
@see REXML::Namespace#prefix= -
REXML
:: Namespace # prefix=(value) (9010.0) -
prefix (前置修飾子) を設定します。
prefix (前置修飾子) を設定します。
@param value prefix文字列
@see REXML::Namespace#prefix -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (715.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=... -
REXML
:: Attributes # get _ attribute _ ns(namespace , name) -> REXML :: Attribute | nil (697.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 # [](name) -> String | nil (397.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 # get _ attribute(name) -> Attribute | nil (397.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
:: DocType # entity(name) -> String | nil (397.0) -
name という実体参照名を持つ実体を文字列で返します。
name という実体参照名を持つ実体を文字列で返します。
返される文字列は非正規化(REXML::Entity#unnormalized 参照)
された文字列が返されます。
name という名前を持つ実体が存在しない場合には nil を返します。
@param name 実体参照名(文字列)
//emlist[][ruby]{
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE foo [
<!ENTITY bar "barbarbarbar">
]>
EOS
p doctype.entity("bar") # => "ba... -
REXML
:: DocType # notation(name) -> REXML :: NotationDecl | nil (397.0) -
DTD に含まれている記法宣言 (REXML::NotationDecl) で name という名前を持つものを返します。
DTD に含まれている記法宣言 (REXML::NotationDecl) で
name という名前を持つものを返します。
name という名前を持つ記法宣言が存在しない場合は nil を返します。
@param name 検索する記法名 -
REXML
:: Attributes # each {|name , value| . . . } -> () (385.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
:: Elements # [](index , name = nil) -> REXML :: Element | nil (385.0) -
index が指し示している要素を返します。
...取り出したい要素の index (整数)もしくは xpath (文字列)
@param name 子要素の名前(文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>'
doc.root.elements[1] # => <b/>
doc.root.elements['c'] # => <c id=... -
REXML
:: Attributes # delete _ all(name) -> [REXML :: Attribute] (379.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
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (349.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 # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (349.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 # []=(name , value) (331.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=... -
REXML
:: AttlistDecl # each {|name , value| . . . } -> () (313.0) -
それぞれの属性名、デフォルト値を引数として ブロックを順に呼び出します。
それぞれの属性名、デフォルト値を引数として
ブロックを順に呼び出します。
デフォルト値を持たない属性に関しては nil が渡されます。 -
REXML
:: Element # add _ attributes(attrs) -> () (82.0) -
要素の属性を複数追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...属性を指定します。
@param attrs 追加する属性の属性名と属性値の対の集合(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([... -
REXML
:: Element # root -> REXML :: Element (82.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
:: Attribute # to _ string -> String (58.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
:: Attribute # write(output , indent = -1) -> object (58.0) -
output に self の情報を name='value' という形式で書き込みます。
output に self の情報を name='value' という形式で書き込みます。
output が返ります。
@param output 書き込み先の IO オブジェクト
@param indent インデントレベル、ここでは無視される -
REXML
:: Entity # ndata -> String | nil (58.0) -
解析対象外実体(unparsed entity)宣言である場合には その記法名(notation name)を返します。
解析対象外実体(unparsed entity)宣言である場合には
その記法名(notation name)を返します。
それ以外の場合は nil を返します。 -
REXML
:: DocType # attributes _ of(element) -> [REXML :: Attribute] (46.0) -
DTD 内の属性リスト宣言で、 element という名前の要素に対し宣言されている 属性の名前とデフォルト値を REXML::Attribute の配列で返します。
...、各 Attribute オブジェクトの
REXML::Attribute#name と
REXML::Attribute#value で表現されます。
//emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book... -
REXML
:: DocType # external _ id -> String | nil (46.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
:: Element # root _ node -> REXML :: Document | REXML :: Node (46.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
:: Attributes # <<(attribute) -> () (28.0) -
属性を追加/更新します。
属性を追加/更新します。
attribute で更新する属性(REXML::Attribute オブジェクト)を
指定します。既に同じ名前(REXML::Attribute#name)のオブジェクトが
存在する場合は属性が上書きされ、ない場合は追加されます。
@param attribute 追加(更新)する属性(REXML::Attribute オブジェクト)
@see REXML::Attributes#[]= -
REXML
:: Attributes # add(attribute) -> () (28.0) -
属性を追加/更新します。
属性を追加/更新します。
attribute で更新する属性(REXML::Attribute オブジェクト)を
指定します。既に同じ名前(REXML::Attribute#name)のオブジェクトが
存在する場合は属性が上書きされ、ない場合は追加されます。
@param attribute 追加(更新)する属性(REXML::Attribute オブジェクト)
@see REXML::Attributes#[]= -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (28.0) -
各属性に対しブロックを呼び出します。
...ブロックを呼び出します。
個々の属性は 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:att=... -
REXML
:: DocType # clone -> REXML :: DocType (28.0) -
self の複製を返します。
self の複製を返します。
external_id (REXML::DocType#external_id) と
名前(REXML::DocType#name) のみ複製されるため、
結果として得られるオブジェクトはあまり有用ではないでしょう。 -
REXML
:: Element # whitespace -> bool (28.0) -
要素(self)内で空白が考慮されるならば真を返します。
要素(self)内で空白が考慮されるならば真を返します。
これは、
* REXML::Element#context に :respect_whitespace も :compress_whitespace も
含まれない
* context の :respect_whitespace に self の要素名が含まれていて、
:compress_whitespace に self の要素名が含まれていない。
「含まれている」というのには :all が指定されている場合と、
配列に含まれている場合の両方があります。
のいずれかの場合に真を返します。
要...