クラス
-
REXML
:: AttlistDecl (6) -
REXML
:: Attribute (14) -
REXML
:: Attributes (15) -
REXML
:: CData (3) -
REXML
:: Child (10) -
REXML
:: Comment (7) -
REXML
:: Declaration (2) -
REXML
:: DocType (16) -
REXML
:: Document (14) -
REXML
:: Element (42) -
REXML
:: Elements (13) -
REXML
:: Entity (10) -
REXML
:: ExternalEntity (2) -
REXML
:: Formatters :: Default (1) -
REXML
:: Formatters :: Pretty (4) -
REXML
:: Instruction (7) -
REXML
:: NotationDecl (7) -
REXML
:: Parent (28) -
REXML
:: Text (10) -
REXML
:: XMLDecl (15)
モジュール
-
REXML
:: Namespace (8) -
REXML
:: Node (7)
キーワード
- << (4)
- <=> (2)
- == (4)
- [] (4)
- []= (5)
- add (5)
-
add
_ attribute (2) -
add
_ attributes (1) -
add
_ element (1) -
add
_ namespace (2) - attribute (1)
-
attribute
_ of (1) - attributes (1)
-
attributes
_ of (1) - bytes (1)
- cdatas (1)
- children (1)
- clone (9)
- collect (1)
- comments (1)
- compact (1)
- compact= (1)
- content (1)
- content= (1)
- context (2)
- context= (1)
-
deep
_ clone (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 (5)
-
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) - elements (1)
- empty? (2)
- encoding (2)
- encoding= (1)
- entities (1)
- entity (1)
- external (1)
-
external
_ id (1) -
find
_ first _ recursive (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) - name (5)
- name= (1)
- namespace (2)
- namespaces (3)
- ndata (1)
-
next
_ element (1) -
next
_ sibling (1) -
next
_ sibling= (1) -
next
_ sibling _ node (1) -
node
_ type (9) - normalized (1)
- normalized= (1)
- notation (1)
- notations (1)
- nowrite (1)
- parent (1)
- parent= (1)
- parent? (2)
- prefix (2)
- prefix= (1)
- prefixes (2)
-
previous
_ element (1) -
previous
_ sibling (1) -
previous
_ sibling= (1) -
previous
_ sibling _ node (1) - pubid (1)
- public (2)
- public= (1)
- push (1)
- raw (2)
- raw= (1)
- ref (1)
- remove (2)
-
replace
_ child (1) -
replace
_ with (1) - root (2)
-
root
_ node (1) - size (3)
-
stand
_ alone? (2) - standalone (1)
- standalone= (1)
- string (1)
- string= (1)
- system (2)
- system= (1)
- target (1)
- target= (1)
- text (1)
- text= (1)
- texts (1)
-
to
_ a (3) -
to
_ s (9) -
to
_ string (1) - unnormalized (1)
- unshift (1)
- value (4)
- value= (1)
- version (2)
- version= (1)
- whitespace (1)
- width (1)
- width= (1)
- write (11)
- writeencoding (1)
- writethis (1)
-
xml
_ decl (1) - xmldecl (1)
- xpath (2)
検索結果
先頭5件
-
REXML
:: Parent # replace _ child(to _ replace , replacement) -> () (55810.0) -
子ノード列上の to_replace を replacement に置き換えます。
子ノード列上の to_replace を replacement に置き換えます。
to_replace の parent は nil に、
replacement の parent は selfに変更されます。
@param to_replace 置き換え元のノード
@param replacement 置き換え先のノード -
REXML
:: Parent # children -> [REXML :: Child] (55210.0) -
子ノード列の配列を返します。
子ノード列の配列を返します。 -
REXML
:: Child # previous _ sibling -> REXML :: Node (45910.0) -
前の隣接ノードを返します。
前の隣接ノードを返します。
REXML::Node#previous_sibling_node の別名です。
@see REXML::Child#previous_sibling= -
REXML
:: Element # previous _ element -> Element | nil (45910.0) -
前の兄弟要素を返します。
前の兄弟要素を返します。
前の要素が存在しない場合は nil を返します。 -
REXML
:: Node # find _ first _ recursive {|node| . . . } -> REXML :: Node | nil (45910.0) -
self とその各 element node を引数とし、ブロックを呼び出し、 そのブロックの返り値が真であった最初の node を返します。
self とその各 element node を引数とし、ブロックを呼び出し、
そのブロックの返り値が真であった最初の node を返します。
見付からなかった場合は nil を返します。 -
REXML
:: Node # previous _ sibling _ node -> REXML :: Node | nil (45910.0) -
前の兄弟ノードを返します。
前の兄弟ノードを返します。
前の兄弟ノードが存在しない場合(ノードがルートである場合や、
最初のノードである場合)は nil を返します。 -
REXML
:: Parent # insert _ before(child1 , child2) -> self (45910.0) -
child2 を child1 で指定したノードの前に挿入します。
child2 を child1 で指定したノードの前に挿入します。
child1 が REXML::Child のインスタンスであるならば、その
子ノードの前に挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定されるノードの
前に挿入されます。
挿入されるノード(child2)の親は self に変更されます。
@param child1 挿入場所の指定
@param child2 挿入されるノード -
REXML
:: Child # previous _ sibling=(other) (45610.0) -
other を self の前の隣接ノードとします。
...ードが持つ子ノード列の self の前に
other を挿入します。
@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_sibli... -
REXML
:: Child # replace _ with(child) -> self (45610.0) -
親ノードの子ノード列上において、 self を child に置き換えます。
親ノードの子ノード列上において、 self を child に置き換えます。
@param child 置き換え後のノード
@see REXML::Parent#replace_child -
REXML
:: Parent # parent? -> bool (45610.0) -
true を返します。
true を返します。
@see REXML::Node#parent -
REXML
:: Element # delete _ element(element) -> REXML :: Element (37510.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
:: Child # parent -> REXML :: Parent|nil (37210.0) -
親ノードを返します。
親ノードを返します。
ルートノードの場合は nil を返します。
@see REXML::Child#parent= -
REXML
:: Element # delete _ attribute(key) -> REXML :: Attribute | nil (36910.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 # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (36910.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
:: Entity # external -> String | nil (36910.0) -
実体が外部実体(external entity)宣言である場合は "SYSTEM" もしくは "PUBLIC" という文字列を返します。
実体が外部実体(external entity)宣言である場合は
"SYSTEM" もしくは "PUBLIC" という文字列を返します。
内部実体(internal entity)宣言である場合には nil を返します。 -
REXML
:: Parent # deep _ clone -> REXML :: Parent (36910.0) -
ノードを複製し、複製されたノードを返します。
ノードを複製し、複製されたノードを返します。
子ノードも複製されます。 -
REXML
:: Parent # insert _ after(child1 , child2) -> self (36910.0) -
child2 を child1 で指定したノードの後ろに挿入します。
child2 を child1 で指定したノードの後ろに挿入します。
child1 が REXML::Child のインスタンスであるならば、その
子ノードの後ろに挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定されるノードの
後ろに挿入されます。
挿入されるノード(child2)の親は self に変更されます。
@param child1 挿入場所の指定
@param child2 挿入されるノード -
REXML
:: Attribute # normalized=(value) (36610.0) -
正規化された属性値を設定します。
正規化された属性値を設定します。
通常はライブラリが自動的にこの値を設定するので
ユーザはこれを使う必要はないでしょう。
@param value 正規化された属性値 -
REXML
:: Child # remove -> self (36610.0) -
親ノードの子ノード列から self を取り除きます。
親ノードの子ノード列から self を取り除きます。 -
REXML
:: DocType # external _ id -> String | nil (36610.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
:: Entity # normalized -> String | nil (36610.0) -
正規化された(normalized)実体の値を返します。
正規化された(normalized)実体の値を返します。
すなわち、一切の実体参照を展開していない値を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#unnormalized -
REXML
:: Entity # ref -> String | nil (36610.0) -
外部実体(external entity)宣言の URI を返します。
外部実体(external entity)宣言の URI を返します。
内部実体宣言の場合は nil を返します。 -
REXML
:: Entity # unnormalized -> String | nil (36610.0) -
非正規化された(unnormalized)実体の値を返します。
非正規化された(unnormalized)実体の値を返します。
すなわち、self が属する DTD によってすべての実体参照(&ent; と %ent; の両方)
を展開した文字列を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#normalized -
REXML
:: Namespace # prefix=(value) (36610.0) -
prefix (前置修飾子) を設定します。
prefix (前置修飾子) を設定します。
@param value prefix文字列
@see REXML::Namespace#prefix -
REXML
:: Node # parent? -> bool (36610.0) -
子を持つノードであれば真を返します。
子を持つノードであれば真を返します。
REXML::Parent のサブクラスでは真を返します。
それ以外では偽を返します。
@see REXML::Parent#parent? -
REXML
:: Parent # delete(object) -> REXML :: Child | nil (36610.0) -
object を子ノード列から削除します。
object を子ノード列から削除します。
削除されたノードの親は nil に設定されます。
削除したノードを返します。削除されなかった場合は nil を返します。
@param object 削除するノード -
REXML
:: Parent # delete _ at(index) -> REXML :: Child | nil (36610.0) -
子ノード列上の index で指定された場所の要素を取り除きます。
子ノード列上の index で指定された場所の要素を取り除きます。
取り除いだノードを返します。indexが範囲外である場合は何もせず
nil を返します。 -
REXML
:: Parent # delete _ if -> Enumerator (36610.0) -
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each _ child -> Enumerator (36610.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # length -> Integer (36610.0) -
保持している子ノードの数を返します。
保持している子ノードの数を返します。 -
REXML
:: Parent # to _ a -> [REXML :: Child] (36610.0) -
子ノード列の配列を返します。
子ノード列の配列を返します。 -
REXML
:: Attribute # prefix -> String (36310.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 # -> "... -
REXML
:: Attribute # remove -> () (36310.0) -
self を所属する要素から取り除きます。
self を所属する要素から取り除きます。 -
REXML
:: Attributes # prefixes -> [String] (36310.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='... -
REXML
:: Child # parent=(other) (36310.0) -
other を親ノードに設定します。
other を親ノードに設定します。
other が元の親ノードと同じならばこのメソッドは何もしません。
self が親を持たない場合は単純に other を親ノードに設定します。
どちらでもない場合は、元の親ノードの子ノード列から self を取り除いて
から other を親ノードに設定します。
このメソッドだけでは other の子ノード集合に self は追加されません。
つまりこのメソッドを呼び出した直後は不完全な状態であり、親ノード側を
適切に設定する必要があります。
@param other 新たな親ノード
@see REXML::Child#parent -
REXML
:: Element # prefixes -> [String] (36310.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
:: Namespace # prefix -> String (36310.0) -
prefix (前置修飾子) を返します。
prefix (前置修飾子) を返します。
@see REXML::Namespace#prefix= -
REXML
:: Node # each _ recursive {|node| . . . } -> () (36310.0) -
self とその各 element node を引数とし、ブロックを呼び出します。
self とその各 element node を引数とし、ブロックを呼び出します。 -
REXML
:: Node # index _ in _ parent -> Insteger (36310.0) -
self の親における index を返します。
self の親における index を返します。
返される index は 1-origin です。
ノードが親を持たない(REXML::Child でない)場合は例外を発生させます。 -
REXML
:: Parent # delete _ if {|object| . . . } -> () (36310.0) -
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
各子ノードに対しブロックを呼び出し、真を返したノードを削除します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each _ child {|object| . . . } -> () (36310.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: DocType # attribute _ of(element , attribute) -> String | nil (28210.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... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (28210.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
:: Attribute # element -> REXML :: Element (27910.0) -
その属性が属する要素を返します。
その属性が属する要素を返します。 -
REXML
:: Attributes # delete(attribute) -> REXML :: Element (27910.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
:: Attributes # get _ attribute(name) -> Attribute | nil (27910.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 (27910.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
:: DocType # attributes _ of(element) -> [REXML :: Attribute] (27910.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 # write(output , indent = 0 , transitive = false , ie _ hack = false) -> () (27910.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) -> () (27910.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) -> () (27910.0) -
output に XML 文書を出力します。
output に XML 文書を出力します。
XML宣言、DTD、処理命令を(もしあるならば)含む文書を出力します。
注意すべき点として、
元の XML 文書が XML宣言を含んでいなくとも
出力される XML はデフォルトの XML 宣言を含んでいるべきであるが、
REXML は明示しない限り(つまりXML宣言を REXML::Document#add で
追加しない限り)
それをしない、ということである。XML-RPCのような利用法では
ネットワークバンドを少しでも節約する必要があるためである。
2.0.0以降ではキーワード引数による引数指定が可能です。
@param outpu... -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (27910.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
:: Element # attributes -> REXML :: Attributes (27910.0) -
要素が保持している属性の集合を返します。
要素が保持している属性の集合を返します。 -
REXML
:: Element # elements -> REXML :: Elements (27910.0) -
要素が保持している子要素の集合を返します。
要素が保持している子要素の集合を返します。 -
REXML
:: Element # get _ elements(xpath) -> [REXML :: Element] (27910.0) -
xpath にマッチする要素を配列で返します。
xpath にマッチする要素を配列で返します。
xpath には XPath 文字列を指定します。
@param xpath XPath 文字列
@see REXML::Elements#to_a -
REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node (27910.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
:: Element # write(output = $ stdout , indent = -1 , transitive = false , ie _ hack = false) (27910.0) -
このメソッドは deprecated です。 REXML::Formatter を代わりに 使ってください。
このメソッドは deprecated です。 REXML::Formatter を代わりに
使ってください。
output にその要素を文字列化したものを(子要素を含め)出力します。
@param output 出力先(IO のように << で書き込めるオブジェクト)
@param indent インデントのスペースの数(-1 だとインデントしない)
@param transitive XMLではインデントのスペースでDOMが変化してしまう場合がある。
これに真を渡すと、XMLのDOMに余計な要素が加わらないように
空白の出力を適当に抑制するようになる
@par... -
REXML
:: Elements # delete(element) -> Element (27910.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
:: Elements # delete _ all(xpath) -> [REXML :: Element] (27910.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
:: Attribute # to _ string -> String (27664.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
:: AttlistDecl # element _ name -> String (27610.0) -
属性を定義しているエレメントの名前を返します。
属性を定義しているエレメントの名前を返します。 -
REXML
:: Attribute # clone -> REXML :: Element (27610.0) -
self を複製し返します。
self を複製し返します。 -
REXML
:: Attribute # element=(element) (27610.0) -
self が属する要素を変更します。
self が属する要素を変更します。
@param element 変更先の要素(REXML::Element) -
REXML
:: Attribute # value -> String (27610.0) -
正規化されていない属性値を返します。
正規化されていない属性値を返します。
属性値の正規化については XML の仕様を参考にしてください。 -
REXML
:: Attributes # delete _ all(name) -> [REXML :: Attribute] (27610.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 # each _ attribute {|attribute| . . . } -> () (27610.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
:: Attributes # length -> Integer (27610.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 # clone -> REXML :: CData (27610.0) -
self を複製して返します。
self を複製して返します。
親ノードの情報は複製されません。 -
REXML
:: CData # value -> String (27610.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
:: Child # next _ sibling -> REXML :: Node (27610.0) -
次の隣接ノードを返します。
次の隣接ノードを返します。
REXML::Node#next_sibling_node の別名です。
@see REXML::Child#next_sibling= -
REXML
:: Child # next _ sibling=(other) (27610.0) -
other を self の次の隣接ノードとします。
...ドが持つ子ノード列の self の後ろに
other を挿入します。
@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_sibli... -
REXML
:: Comment # clone -> REXML :: Comment (27610.0) -
内容が複製された Comment オブジェクトを返します。 (親ノードの情報は複製されません)。
内容が複製された Comment オブジェクトを返します。
(親ノードの情報は複製されません)。 -
REXML
:: Comment # string -> String (27610.0) -
コメント文字列を返します。
コメント文字列を返します。 -
REXML
:: Comment # string=(value) (27610.0) -
コメント文字列を設定します。
コメント文字列を設定します。
@param value 設定する文字列 -
REXML
:: DocType # clone -> REXML :: DocType (27610.0) -
self の複製を返します。
self の複製を返します。
external_id (REXML::DocType#external_id) と
名前(REXML::DocType#name) のみ複製されるため、
結果として得られるオブジェクトはあまり有用ではないでしょう。 -
REXML
:: DocType # public -> String | nil (27610.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 (27610.0) -
self を複製します。
self を複製します。
REXML::Document.new(self) と同じです。 -
REXML
:: Document # root -> REXML :: Element | nil (27610.0) -
文書のルート要素を返します。
文書のルート要素を返します。
文書がルート要素を持たない場合は nil を返します。 -
REXML
:: Document # stand _ alone? -> String (27610.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 (27610.0) -
文書の XML 宣言を返します。
文書の XML 宣言を返します。
文書が XML 宣言を持たない場合は nil を返します。 -
REXML
:: Element # add _ attribute(key , value) -> () (27610.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...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 # =... -
REXML
:: Element # clone -> REXML :: Element (27610.0) -
self を複製して返します。
self を複製して返します。
複製されるのは名前、属性、名前空間のみです。
子ノードは複製されません。 -
REXML
:: Element # each _ element(xpath = nil) {|element| . . . } -> () (27610.0) -
各子要素を引数としてブロックを呼び出します。
各子要素を引数としてブロックを呼び出します。
xpath に文字列を指定するとそれにマッチする子要素のみを対象とします。
@param xpath XPath 文字列 -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (27610.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
:: Element # has _ attributes? -> bool (27610.0) -
要素が属性を1つ以上持っていれば真を返します。
要素が属性を1つ以上持っていれば真を返します。 -
REXML
:: Element # instructions -> [REXML :: Instraction] (27610.0) -
すべての instruction 子ノードの配列を返します。
すべての instruction 子ノードの配列を返します。
返される配列は freeze されます。 -
REXML
:: Element # next _ element -> Element | nil (27610.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 # raw -> bool (27610.0) -
その要素が raw モードであるならば真を返します。
その要素が raw モードであるならば真を返します。
以下のいずれかであれば、raw モードであると判定されます。
* REXML::Element#context の :raw が :all である
* context の :raw の配列に self の要素名が含まれる -
REXML
:: Element # root -> REXML :: Element (27610.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
:: Entity # value -> String | nil (27610.0) -
実体の値を返します。
実体の値を返します。
パラメータ実体参照(parameter entity)のみが展開され、
そうでない実体参照(general entity)は展開されて
いないような値が返されます。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#unnormalized, REXML::Entity#normalized -
REXML
:: Instruction # clone -> REXML :: Instruction (27610.0) -
self を複製します。
self を複製します。 -
REXML
:: Instruction # target=(value) (27610.0) -
XML 処理命令のターゲットを value に変更します。
XML 処理命令のターゲットを value に変更します。
@param value 新たなターゲット(文字列) -
REXML
:: Namespace # fully _ expanded _ name -> String (27610.0) -
完全修飾名を返します。
完全修飾名を返します。 -
REXML
:: Namespace # local _ name -> String (27610.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Node # next _ sibling _ node -> REXML :: Node | nil (27610.0) -
次の兄弟ノードを返します。
次の兄弟ノードを返します。
次の兄弟ノードが存在しない場合(ノードがルートである場合や、
最後のノードである場合)は nil を返します。 -
REXML
:: NotationDecl # public -> String | nil (27610.0) -
公開識別子を返します。
公開識別子を返します。
宣言が公開識別子を含まない場合は nil を返します。 -
REXML
:: Parent # [](index) -> REXML :: Child | nil (27610.0) -
子ノード列上の index で指定された場所のノードを返します。
子ノード列上の index で指定された場所のノードを返します。
範囲外を指定した場合は nil を返します。 -
REXML
:: Parent # []=(start , length , node) (27610.0) -
子ノード列上の指定した場所を node で置き換えます。
子ノード列上の指定した場所を node で置き換えます。
Array#[]= と同じ指定が可能です。
@param index 変更場所の index (Integer)
@param range 変更場所の範囲 (Range)
@param start 変更範囲の最初の位置 (Integer)
@param length 変更範囲の個数 (Integer)
@param node 置き換えるノード -
REXML
:: Parent # index(child) -> Integer | nil (27610.0) -
child の子ノード列上での位置を返します。
child の子ノード列上での位置を返します。
child が子ノードでない場合には nil を返します。 -
REXML
:: Text # clone -> REXML :: Text (27610.0) -
self を複製します。
self を複製します。