クラス
-
REXML
:: AttlistDecl (2) -
REXML
:: Attribute (6) -
REXML
:: Attributes (7) -
REXML
:: CData (2) -
REXML
:: Child (4) -
REXML
:: Comment (3) -
REXML
:: Declaration (1) -
REXML
:: DocType (7) -
REXML
:: Document (7) -
REXML
:: Element (7) -
REXML
:: Elements (2) -
REXML
:: Entity (9) -
REXML
:: ExternalEntity (1) -
REXML
:: Formatters :: Pretty (1) -
REXML
:: Instruction (3) -
REXML
:: NotationDecl (4) -
REXML
:: Parent (5) -
REXML
:: Text (2) -
REXML
:: XMLDecl (7)
モジュール
-
REXML
:: Namespace (5) -
REXML
:: Node (4)
キーワード
- [] (2)
- []= (2)
-
attribute
_ of (1) - content (1)
-
element
_ name (1) - encoding (2)
- encoding= (1)
- entities (1)
- entity (1)
- external (1)
-
external
_ id (1) -
get
_ attribute (1) -
get
_ attribute _ ns (1) -
get
_ elements (1) -
get
_ text (1) - index (2)
-
index
_ in _ parent (1) - length (2)
-
local
_ name (1) - name (5)
- namespace (2)
- namespaces (2)
- ndata (1)
-
next
_ sibling (1) -
next
_ sibling= (1) -
next
_ sibling _ node (1) - normalized (1)
- prefix (2)
- prefixes (2)
-
previous
_ sibling (1) -
previous
_ sibling= (1) -
previous
_ sibling _ node (1) - pubid (1)
- public (2)
- ref (1)
- size (3)
-
stand
_ alone? (2) - standalone (1)
- string (1)
- string= (1)
- system (2)
- target (1)
- target= (1)
- text (1)
-
to
_ s (9) -
to
_ string (1) - unnormalized (1)
- value (4)
- version (2)
- width (1)
- write (2)
- writeencoding (1)
- xmldecl (1)
- xpath (2)
検索結果
先頭5件
-
REXML
:: Element # get _ elements(xpath) -> [REXML :: Element] (45910.0) -
xpath にマッチする要素を配列で返します。
xpath にマッチする要素を配列で返します。
xpath には XPath 文字列を指定します。
@param xpath XPath 文字列
@see REXML::Elements#to_a -
REXML
:: Node # next _ sibling _ node -> REXML :: Node | nil (45610.0) -
次の兄弟ノードを返します。
次の兄弟ノードを返します。
次の兄弟ノードが存在しない場合(ノードがルートである場合や、
最後のノードである場合)は nil を返します。 -
REXML
:: Node # previous _ sibling _ node -> REXML :: Node | nil (45610.0) -
前の兄弟ノードを返します。
前の兄弟ノードを返します。
前の兄弟ノードが存在しない場合(ノードがルートである場合や、
最初のノードである場合)は nil を返します。 -
REXML
:: Attribute # to _ string -> String (37210.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 -> String (37210.0) -
コメント文字列を返します。
コメント文字列を返します。 -
REXML
:: Document # encoding -> String (36910.0) -
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 />
EOS
doc.encoding # => "UTF-8"
//}... -
REXML
:: XMLDecl # encoding -> String | nil (36910.0) -
設定されているエンコーディングの名前を文字列で返します。
設定されているエンコーディングの名前を文字列で返します。
エンコーディングが指定されていない(デフォルトの UTF-8 とみなされます)
場合は nil を返します。 -
REXML
:: XMLDecl # encoding=(enc) (36910.0) -
エンコーディングを enc に設定します。
エンコーディングを enc に設定します。
enc に nil を渡すと XML 宣言では encoding が
指定されていない(デフォルトで UTF-8 が使われる)
ことになります。
@param enc エンコーディング(文字列 or nil)
@see REXML::XMLDecl#encoding= -
REXML
:: Attributes # get _ attribute _ ns(namespace , name) -> REXML :: Attribute | nil (36610.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 # length -> Integer (36610.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
:: Child # next _ sibling -> REXML :: Node (36610.0) -
次の隣接ノードを返します。
次の隣接ノードを返します。
REXML::Node#next_sibling_node の別名です。
@see REXML::Child#next_sibling= -
REXML
:: Child # next _ sibling=(other) (36610.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 # previous _ sibling -> REXML :: Node (36610.0) -
前の隣接ノードを返します。
前の隣接ノードを返します。
REXML::Node#previous_sibling_node の別名です。
@see REXML::Child#previous_sibling= -
REXML
:: Child # previous _ sibling=(other) (36610.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 # string=(value) (36610.0) -
コメント文字列を設定します。
コメント文字列を設定します。
@param value 設定する文字列 -
REXML
:: Parent # length -> Integer (36610.0) -
保持している子ノードの数を返します。
保持している子ノードの数を返します。 -
REXML
:: XMLDecl # writeencoding -> bool (36610.0) -
XML宣言内の encoding の宣言を出力時に省略するならば真を返します。
XML宣言内の encoding の宣言を出力時に省略するならば真を返します。
これが真であっても UTF-8 以外のエンコーディングを指定している
ならば encoding は出力されます。 -
REXML
:: Element # get _ text(path = nil) -> REXML :: Text | nil (27910.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
:: Instruction # content -> String | nil (27910.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 (27610.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 (27610.0) -
REXML::Namespace#name= で設定された名前を返します。
REXML::Namespace#name= で設定された名前を返します。
name= で指定した名前が prefix を含んでいれば
prefix を含む名前を返し、そうでなければ
prefix を含まない名前を返します。
@see REXML::Namespace#prefix -
REXML
:: Namespace # fully _ expanded _ name -> String (27610.0) -
完全修飾名を返します。
完全修飾名を返します。 -
REXML
:: Namespace # local _ name -> String (27610.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Namespace # name -> String (27610.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Instruction # target=(value) (27310.0) -
XML 処理命令のターゲットを value に変更します。
XML 処理命令のターゲットを value に変更します。
@param value 新たなターゲット(文字列) -
REXML
:: Attribute # namespace(arg = nil) -> String | nil (18910.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 } (18910.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 # entities -> { String => REXML :: Entity } (18910.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
:: AttlistDecl # element _ name -> String (18610.0) -
属性を定義しているエレメントの名前を返します。
属性を定義しているエレメントの名前を返します。 -
REXML
:: Attributes # get _ attribute(name) -> Attribute | nil (18610.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 # size -> Integer (18610.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
:: Comment # to _ s -> String (18610.0) -
コメント文字列を返します。
コメント文字列を返します。 -
REXML
:: DocType # entity(name) -> String | nil (18610.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 # external _ id -> String | nil (18610.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 # name -> String (18610.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
:: Document # expanded _ name -> String (18610.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Document # name -> String (18610.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Document # stand _ alone? -> String (18610.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 (18610.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 />
EOS
doc.version # => "1.0"
//}... -
REXML
:: Element # namespace(prefix=nil) -> String (18610.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} (18610.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
:: Elements # index(element) -> Integer (18610.0) -
element で指定した要素が何番目の子要素であるかを返します。
element で指定した要素が何番目の子要素であるかを返します。
element が子要素でない場合は -1 を返します。
返り値は 1-origin です。
@param element インデックスを知りたい要素(REXML::Element オブジェクト)
@see REXML::Element#[] -
REXML
:: Entity # external -> String | nil (18610.0) -
実体が外部実体(external entity)宣言である場合は "SYSTEM" もしくは "PUBLIC" という文字列を返します。
実体が外部実体(external entity)宣言である場合は
"SYSTEM" もしくは "PUBLIC" という文字列を返します。
内部実体(internal entity)宣言である場合には nil を返します。 -
REXML
:: Entity # name -> String (18610.0) -
実体の名前を返します。
実体の名前を返します。 -
REXML
:: Entity # ndata -> String | nil (18610.0) -
解析対象外実体(unparsed entity)宣言である場合には その記法名(notation name)を返します。
解析対象外実体(unparsed entity)宣言である場合には
その記法名(notation name)を返します。
それ以外の場合は nil を返します。 -
REXML
:: Entity # normalized -> String | nil (18610.0) -
正規化された(normalized)実体の値を返します。
正規化された(normalized)実体の値を返します。
すなわち、一切の実体参照を展開していない値を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#unnormalized -
REXML
:: Entity # unnormalized -> String | nil (18610.0) -
非正規化された(unnormalized)実体の値を返します。
非正規化された(unnormalized)実体の値を返します。
すなわち、self が属する DTD によってすべての実体参照(&ent; と %ent; の両方)
を展開した文字列を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#normalized -
REXML
:: Node # index _ in _ parent -> Insteger (18610.0) -
self の親における index を返します。
self の親における index を返します。
返される index は 1-origin です。
ノードが親を持たない(REXML::Child でない)場合は例外を発生させます。 -
REXML
:: NotationDecl # name -> String (18610.0) -
記法宣言の名前を返します。
記法宣言の名前を返します。 -
REXML
:: Parent # index(child) -> Integer | nil (18610.0) -
child の子ノード列上での位置を返します。
child の子ノード列上での位置を返します。
child が子ノードでない場合には nil を返します。 -
REXML
:: Parent # size -> Integer (18610.0) -
保持している子ノードの数を返します。
保持している子ノードの数を返します。 -
REXML
:: XMLDecl # stand _ alone? -> String | nil (18610.0) -
スタンドアロン文書であるかどうかを "yes" "no" で 返します。
スタンドアロン文書であるかどうかを "yes" "no" で
返します。
nil(省略)を返す場合もあります。 -
REXML
:: XMLDecl # standalone -> String | nil (18610.0) -
スタンドアロン文書であるかどうかを "yes" "no" で 返します。
スタンドアロン文書であるかどうかを "yes" "no" で
返します。
nil(省略)を返す場合もあります。 -
REXML
:: XMLDecl # version -> String (18610.0) -
XML文書のバージョンを文字列で返します。
XML文書のバージョンを文字列で返します。 -
REXML
:: Element # text(path = nil) -> String | nil (9910.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
:: Declaration # to _ s -> String (9610.0) -
ノードを文字列化します。
ノードを文字列化します。 -
REXML
:: Document # write(output = $ stdout , indent = -1 , transitive = false , ie _ hack = false , encoding=nil) -> () (9610.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) -> () (9610.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 # prefixes -> [String] (9610.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 # xpath -> String (9610.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... -
REXML
:: Elements # size -> Integer (9610.0) -
保持している要素の個数を返します。
...保持している要素の個数を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
# doc.root は3つの要素と3つのテキストノードを持つため、6を返す
doc.root.size # => 6
# そのうち要... -
REXML
:: Entity # pubid -> String | nil (9610.0) -
公開識別子(public identifier)を用いた外部実体宣言の場合は、その公開識別子を 返します。
公開識別子(public identifier)を用いた外部実体宣言の場合は、その公開識別子を
返します。
それ以外の場合は nil を返します。 -
REXML
:: Entity # ref -> String | nil (9610.0) -
外部実体(external entity)宣言の URI を返します。
外部実体(external entity)宣言の URI を返します。
内部実体宣言の場合は nil を返します。 -
REXML
:: Entity # to _ s -> String (9610.0) -
実体宣言を文字列化したものを返します。
実体宣言を文字列化したものを返します。
@see REXML::Entity#write
//emlist[][ruby]{
e = REXML::ENTITY.new("w", "wee");
p e.to_s # => "<!ENTITY w \"wee\">"
//} -
REXML
:: Entity # value -> String | nil (9610.0) -
実体の値を返します。
実体の値を返します。
パラメータ実体参照(parameter entity)のみが展開され、
そうでない実体参照(general entity)は展開されて
いないような値が返されます。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#unnormalized, REXML::Entity#normalized -
REXML
:: ExternalEntity # to _ s -> String (9610.0) -
宣言を文字列化します。
宣言を文字列化します。 -
REXML
:: Namespace # prefix -> String (9610.0) -
prefix (前置修飾子) を返します。
prefix (前置修飾子) を返します。
@see REXML::Namespace#prefix= -
REXML
:: Node # to _ s(indent = -1) -> String (9610.0) -
ノードを文字列に変換します。
ノードを文字列に変換します。
@param indent このパラメータは deprecated で、無視されます -
REXML
:: NotationDecl # public -> String | nil (9610.0) -
公開識別子を返します。
公開識別子を返します。
宣言が公開識別子を含まない場合は nil を返します。 -
REXML
:: NotationDecl # system -> String | nil (9610.0) -
システム識別子(URI)を返します。
システム識別子(URI)を返します。
宣言がシステム識別子を含まない場合は nil を返します。 -
REXML
:: NotationDecl # to _ s -> String (9610.0) -
self を文字列化したものを返します。
self を文字列化したものを返します。 -
REXML
:: Parent # []=(range , node) (9610.0) -
子ノード列上の指定した場所を node で置き換えます。
子ノード列上の指定した場所を node で置き換えます。
Array#[]= と同じ指定が可能です。
@param index 変更場所の index (Integer)
@param range 変更場所の範囲 (Range)
@param start 変更範囲の最初の位置 (Integer)
@param length 変更範囲の個数 (Integer)
@param node 置き換えるノード -
REXML
:: Parent # []=(start , length , node) (9610.0) -
子ノード列上の指定した場所を node で置き換えます。
子ノード列上の指定した場所を node で置き換えます。
Array#[]= と同じ指定が可能です。
@param index 変更場所の index (Integer)
@param range 変更場所の範囲 (Range)
@param start 変更範囲の最初の位置 (Integer)
@param length 変更範囲の個数 (Integer)
@param node 置き換えるノード -
REXML
:: AttlistDecl # [](key) -> String | nil (610.0) -
key という属性名のデフォルト値を返します。
key という属性名のデフォルト値を返します。
key という名前の属性が存在しない、もしくは
デフォルト値を持たない場合は nil を返します。 -
REXML
:: Attribute # prefix -> String (610.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 # to _ s -> String (610.0) -
正規化された属性値を返します。
正規化された属性値を返します。
属性値の正規化については XML の仕様を参考にしてください。 -
REXML
:: Attribute # value -> String (610.0) -
正規化されていない属性値を返します。
正規化されていない属性値を返します。
属性値の正規化については XML の仕様を参考にしてください。 -
REXML
:: Attribute # xpath -> String (610.0) -
その属性を指定する xpath 文字列を返します。
その属性を指定する xpath 文字列を返します。
例えば "/foo/bar/@ns:r" という文字列を返します。 -
REXML
:: Attributes # [](name) -> String | nil (610.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 # prefixes -> [String] (610.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
:: CData # to _ s -> String (610.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 (610.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
:: DocType # attribute _ of(element , attribute) -> String | nil (610.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
:: DocType # public -> String | nil (610.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
:: DocType # system -> String | nil (610.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
:: Formatters :: Pretty # width -> Integer (610.0) -
出力のページ幅を返します。
出力のページ幅を返します。
デフォルトは80です。
@see REXML::Formatters::Pretty#width= -
REXML
:: Text # to _ s -> String (610.0) -
テキストの内容を正規化(すべての実体をエスケープ)された状態で返します。
...トとして妥当です。
結果は 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"
t.value # => "< & foobar"
//}... -
REXML
:: Text # value -> String (610.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 # xmldecl(version , encoding , standalone) -> () (610.0) -
内容を更新します。
内容を更新します。
@param version バージョン(文字列)
@param encoding エンコーディング(文字列 or nil)
@param standalone スタンドアロン文章かどうか("yes", "no", nil)