クラス
-
REXML
:: AttlistDecl (6) -
REXML
:: Attribute (14) -
REXML
:: Attributes (15) -
REXML
:: CData (3) -
REXML
:: Child (5) -
REXML
:: Comment (1) -
REXML
:: Declaration (2) -
REXML
:: DocType (10) -
REXML
:: Document (6) -
REXML
:: Element (32) -
REXML
:: Elements (11) -
REXML
:: Entity (6) -
REXML
:: ExternalEntity (2) -
REXML
:: Formatters :: Default (1) -
REXML
:: Formatters :: Pretty (4) -
REXML
:: Instruction (3) -
REXML
:: NotationDecl (7) -
REXML
:: Parent (28) -
REXML
:: ParseException (4) -
REXML
:: Parsers :: PullEvent (15) -
REXML
:: Parsers :: PullParser (6) -
REXML
:: Parsers :: SAX2Parser (7) -
REXML
:: Parsers :: StreamParser (1) -
REXML
:: Parsers :: UltraLightParser (2) -
REXML
:: Text (4) -
REXML
:: XMLDecl (5)
モジュール
-
REXML
:: Namespace (8) -
REXML
:: Node (3) -
REXML
:: SAX2Listener (17) -
REXML
:: StreamListener (14)
キーワード
- << (3)
- == (1)
- [] (6)
- []= (5)
- add (5)
-
add
_ attribute (2) -
add
_ attributes (1) -
add
_ element (1) -
add
_ namespace (2) - attlistdecl (2)
- attlistdecl? (1)
- attribute (1)
-
attribute
_ of (1) - attributes (1)
-
attributes
_ of (1) - cdata (2)
- cdata? (1)
- cdatas (1)
- characters (1)
- children (1)
- clone (2)
- collect (1)
- comment (2)
- comment? (1)
- compact (1)
- compact= (1)
- content= (1)
- context (1)
- context= (1)
- deafen (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)
- doctype? (1)
-
doctype
_ end (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= (1)
-
element
_ name (1) - elementdecl (2)
- elementdecl? (1)
- empty? (1)
-
end
_ document (1) -
end
_ element (1) -
end
_ element? (1) -
end
_ prefix _ mapping (1) - entity (2)
- entitydecl (2)
- entitydecl? (1)
-
event
_ type (1) - external (1)
-
external
_ id (1) -
get
_ attribute (1) -
get
_ attribute _ ns (1) -
get
_ elements (1) -
get
_ text (1) -
has
_ attributes? (1) -
has
_ elements? (1) -
has
_ name? (1) -
has
_ next? (1) -
has
_ text? (1) - include? (1)
- index (1)
-
index
_ in _ parent (1) - inject (1)
-
insert
_ after (1) -
insert
_ before (1) - instruction (1)
- instruction? (1)
- instructions (1)
- length (2)
- line (1)
- listen (5)
-
local
_ name (1) - name (5)
- name= (1)
- namespace (2)
- namespaces (3)
- ndata (1)
-
next
_ element (1) -
next
_ sibling= (1) -
node
_ type (2) - normalized (1)
- normalized= (1)
- notation (1)
- notationdecl (2)
- notationdecl? (1)
- notations (1)
- parent (1)
- parent= (1)
- parent? (2)
- parse (3)
- peek (1)
- position (1)
- prefix (2)
- prefix= (1)
- prefixes (2)
-
previous
_ sibling= (1) -
processing
_ instruction (1) - progress (1)
- public (1)
- public= (1)
- pull (1)
- push (1)
- raw (2)
- raw= (1)
- remove (1)
-
replace
_ child (1) -
replace
_ with (1) - rewind (1)
- size (3)
-
stand
_ alone? (2) - standalone (1)
- standalone= (1)
-
start
_ document (1) -
start
_ element (1) -
start
_ element? (1) -
start
_ prefix _ mapping (1) - string= (1)
- system (1)
- system= (1)
-
tag
_ end (1) -
tag
_ start (1) - target (1)
- target= (1)
- text (2)
- text= (1)
- text? (1)
-
to
_ a (3) -
to
_ s (6) -
to
_ string (1) - unnormalized (1)
- unshift (2)
- value (4)
- value= (1)
- version= (1)
- whitespace (1)
- width (1)
- width= (1)
- write (10)
- xmldecl (3)
- xmldecl? (1)
- xpath (2)
検索結果
先頭5件
-
REXML
:: Parsers :: UltraLightParser # parse -> Array (36607.0) -
XML 文書のパース結果を配列による木で返します。
...返します。
返される木構造配列については lib:rexml/parsers/ultralightparser#nodes
を参照してください。
@raise REXML::ParseException XML文書のパースに失敗した場合に発生します
@raise REXML::UndefinedNamespaceException XML文書のパース中に、定... -
REXML
:: Parsers :: SAX2Parser # parse -> () (36307.0) -
REXML::Parsers::SAX2Parser.new で指定した XML を パースし、その結果によって REXML::Parsers::SAX2Parser#listen で 指定したコールバックを呼び出します。
...REXML::Parsers::SAX2Parser.new で指定した XML を
パースし、その結果によって REXML::Parsers::SAX2Parser#listen で
指定したコールバックを呼び出します。
@raise REXML::ParseException XML文書のパースに失敗した場合に発生します
@raise REXML::Undefin... -
REXML
:: Parsers :: StreamParser # parse -> () (36307.0) -
入力をパースします。
...スします。
このメソッドの中からコールバックが呼び出されます。
@raise REXML::ParseException XML文書のパースに失敗した場合に発生します
@raise REXML::UndefinedNamespaceException XML文書のパース中に、定義されていない名前空間... -
REXML
:: Attributes # get _ attribute _ ns(namespace , name) -> REXML :: Attribute | nil (27733.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='2' a... -
REXML
:: Attributes # get _ attribute(name) -> Attribute | nil (27697.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... -
REXML
:: Namespace # name=(name) (27607.0) -
名前を設定します。
名前を設定します。
prefix を持つ名前も持たない名前も受け付けます。
@param name 名前(文字列) -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (27379.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 fo... -
REXML
:: Attribute # xpath -> String (27307.0) -
その属性を指定する xpath 文字列を返します。
その属性を指定する xpath 文字列を返します。
例えば "/foo/bar/@ns:r" という文字列を返します。 -
REXML
:: Namespace # expanded _ name -> String (27307.0) -
REXML::Namespace#name= で設定された名前を返します。
...REXML::Namespace#name= で設定された名前を返します。
name= で指定した名前が prefix を含んでいれば
prefix を含む名前を返し、そうでなければ
prefix を含まない名前を返します。
@see REXML::Namespace#prefix... -
REXML
:: Namespace # fully _ expanded _ name -> String (27307.0) -
完全修飾名を返します。
完全修飾名を返します。 -
REXML
:: Namespace # has _ name?(other , ns = nil) -> bool (27307.0) -
self が other と ns で指定した名前を持っているならば真を返します。
...れます。
other が ":" を含んでいる(つまり prefix を含んでいる)場合は
REXML::Namespace#fully_expanded_name と other を比較します。
どちらでもない場合は other と REXML::Namespace#name を直接
比較します。
@param other 比較する名前(文字列)
@pa... -
REXML
:: Namespace # local _ name -> String (27307.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Namespace # name -> String (27307.0) -
prefix を含まない「ローカルな」名前を返します。
prefix を含まない「ローカルな」名前を返します。 -
REXML
:: Parent # parent? -> bool (27307.0) -
true を返します。
...true を返します。
@see REXML::Node#parent... -
REXML
:: Parsers :: PullEvent # start _ element? -> bool (27307.0) -
XML要素の開始タグなら真を返します。
XML要素の開始タグなら真を返します。 -
REXML
:: Parsers :: PullParser # each {|event| . . . } -> () (27307.0) -
XMLをパースし、得られたイベント列を引数として順にブロックを呼び出します。
...し、得られたイベント列を引数として順にブロックを呼び出します。
@raise REXML::ParseException XML文書のパースに失敗した場合に発生します
@raise REXML::UndefinedNamespaceException XML文書のパース中に、定義されていない名前空間... -
REXML
:: Parsers :: PullParser # has _ next? -> bool (27307.0) -
未処理のイベントが残っている場合に真を返します。
...未処理のイベントが残っている場合に真を返します。
@see REXML::Parsers::PullParser#empty?... -
REXML
:: Parsers :: SAX2Parser # deafen(listener) -> () (27307.0) -
REXML::Parsers::SAX2Parser#listen で指定した listener を 取り除きます。
...
REXML::Parsers::SAX2Parser#listen で指定した listener を
取り除きます。
@param listener 取り除く listener... -
REXML
:: Parent # replace _ child(to _ replace , replacement) -> () (18907.0) -
子ノード列上の to_replace を replacement に置き換えます。
子ノード列上の to_replace を replacement に置き換えます。
to_replace の parent は nil に、
replacement の parent は selfに変更されます。
@param to_replace 置き換え元のノード
@param replacement 置き換え先のノード -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (18733.0) -
name で指定される属性を返します。
...name で指定される属性を返します。
属性は REXML::Attribute オブジェクトの形で返します。
name は "foo:bar" のように prefix を指定することができます。
namespace で名前空間の URI を指定することで、その名前空間内で
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='2' at... -
REXML
:: Text # value=(val) (18733.0) -
テキストの内容を val に変更します。
...は非正規化された(エスケープされていない)文字列を渡さなければ
なりません。
//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
:: Element # delete _ namespace(namespace = "xmlns") -> self (18661.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.delete_name... -
REXML
:: StreamListener # attlistdecl(element _ name , attributes , raw _ content) -> () (18661.0) -
DTDの属性リスト宣言をパースしたときに呼び出されるコールバックです。
DTDの属性リスト宣言をパースしたときに呼び出されるコールバックです。
@param element_name 要素名が文字列で渡されます
@param attributes 属性名とそのデフォルト値の対応が
{ 属性名文字列 => デフォルト値文字列(無ければnil) } という
ハッシュテーブルで渡されます
@param raw_content 文書内の属性リスト宣言の文字列がそのまま渡されます
=== 例
<!ATTLIST a att CDATA #REQUIRED xyz CDATA "foobar">
という属性リスト宣言に対しては
element_... -
REXML
:: Attribute # normalized=(value) (18607.0) -
正規化された属性値を設定します。
正規化された属性値を設定します。
通常はライブラリが自動的にこの値を設定するので
ユーザはこれを使う必要はないでしょう。
@param value 正規化された属性値 -
REXML
:: Child # parent -> REXML :: Parent|nil (18607.0) -
親ノードを返します。
...親ノードを返します。
ルートノードの場合は nil を返します。
@see REXML::Child#parent=... -
REXML
:: DocType # attribute _ of(element , attribute) -> String | nil (18607.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 # attributes _ of(element) -> [REXML :: Attribute] (18607.0) -
DTD 内の属性リスト宣言で、 element という名前の要素に対し宣言されている 属性の名前とデフォルト値を REXML::Attribute の配列で返します。
...デフォルト値を REXML::Attribute の配列で返します。
名前とデフォルト値のペアは、各 Attribute オブジェクトの
REXML::Attribute#name と
REXML::Attribute#value で表現されます。
//emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS... -
REXML
:: DocType # notation(name) -> REXML :: NotationDecl | nil (18607.0) -
DTD に含まれている記法宣言 (REXML::NotationDecl) で name という名前を持つものを返します。
...DTD に含まれている記法宣言 (REXML::NotationDecl) で
name という名前を持つものを返します。
name という名前を持つ記法宣言が存在しない場合は nil を返します。
@param name 検索する記法名... -
REXML
:: DocType # notations -> [REXML :: NotationDecl] (18607.0) -
DTD に含まれている記法宣言 (REXML::NotationDecl) を 配列で返します。
...DTD に含まれている記法宣言 (REXML::NotationDecl) を
配列で返します。... -
REXML
:: Element # attributes -> REXML :: Attributes (18607.0) -
要素が保持している属性の集合を返します。
要素が保持している属性の集合を返します。 -
REXML
:: Element # cdatas -> [REXML :: CData] (18607.0) -
すべての cdata 子ノードの配列を返します。
すべての cdata 子ノードの配列を返します。
返される配列は freeze されます。 -
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 # =>... -
REXML
:: Element # add _ namespace(prefix , uri) -> self (18487.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")
a.t... -
REXML
:: Element # add _ namespace(uri) (18487.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")
a.t... -
REXML
:: Element # xpath -> String (18487.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
:: Element # add _ attribute(attr) -> () (18433.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...で渡す方法と REXML::Attribute オブジェクトを
渡す方法です。
文字列2つで指定する場合、属性値は unnormalized な文字列を渡す必要があります。
@param 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 # => <e a='b' x:a='c'/>
doc.root.add_attribute(REXML::Attribute.new("b", "d"))
doc.root # => <e a='b' x:... -
REXML
:: Element # add _ attribute(key , value) -> () (18433.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...で渡す方法と REXML::Attribute オブジェクトを
渡す方法です。
文字列2つで指定する場合、属性値は unnormalized な文字列を渡す必要があります。
@param 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 # => <e a='b' x:a='c'/>
doc.root.add_attribute(REXML::Attribute.new("b", "d"))
doc.root # => <e a='b' x:... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (18433.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... -
REXML
:: Attributes # delete _ all(name) -> [REXML :: Attribute] (18415.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='2' at... -
REXML
:: SAX2Listener # start _ prefix _ mapping(prefix , uri) -> () (18415.0) -
名前空間の接頭辞(prefix)が導入されたときに呼び出される コールバックメソッドです。
名前空間の接頭辞(prefix)が導入されたときに呼び出される
コールバックメソッドです。
以下のようなXMLを処理
<a xmlns:foo="http://foo.example.org/">
<foo:b />
</a>
すると
start_prefix_mapping("foo", "http://foo.example.org/")
start_element(nil, "a", "a", {"xmlns:foo" => "http://foo.example.org/"})
:
end_element(nil, "a", "a")
end_... -
REXML
:: Element # has _ elements? -> bool (18397.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
:: Elements # to _ a(xpath = nil) -> [REXML :: Element] (18382.0) -
すべての子要素の配列を返します。
...要素の配列を返します。
REXML::Elements#each と同様、REXML::XPath.match などと
異なり、要素以外の子ノードは無視されます。
@param xpath XPath文字列
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a>sean<b/>elliot......t<c/></a>'
doc.root.elements.to_a # => [<b/>, <c/>]
doc.root.elements.to_a("child::node()") # => [<b/>, <c/>]
REXML::XPath.match(doc.root, "child::node()") # => ["sean", <b/>, "elliott", <c/>]
//}... -
REXML
:: Attributes # each {|name , value| . . . } -> () (18379.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.... -
REXML
:: Attributes # namespaces -> { String => String } (18379.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 # add _ attributes(attrs) -> () (18379.0) -
要素の属性を複数追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...属性の属性名と属性値の対の集合(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([["a", "b"], ["c", "d"]])
e # => <e a='b' c='d'/>
//}... -
REXML
:: Elements # delete _ all(xpath) -> [REXML :: Element] (18379.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
:: Attributes # to _ a -> [Attribute] (18346.0) -
属性の配列を返します。
...属性の配列を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a x='1' y='2' z='3' />")
doc.root.attributes.to_a # => [x='1', y='2', z='3']
//}... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (18343.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| . . . } -> () (18343.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> ... </>
# >> <d> .... -
REXML
:: Element # namespace(prefix=nil) -> String (18343.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 # namespaces -> {String => String} (18343.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 # each(xpath = nil) {|element| . . . } -> [REXML :: Elements] (18343.0) -
全ての子要素に対しブロックを呼び出します。
...呼び出します。
REXML::XPath.each などとは異なり、要素以外の
テキストノードなどはすべて無視されることに注意してください。
@param xpath XPath文字列
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a><b/......ments.each('b') {|e|p e} #-> Yields b, b elements
# <b/>,<c/>,<d/>,<b/>,<c/>,<d/> がブロックに渡される
doc.root.elements.each('child::node()') {|e|p e}
# <b/>,<c/>,<d/>,"sean",<b/>,<c/>,<d/> がブロックに渡される
REXML::XPath.each(doc.root, 'child::node()'){|node| p node }
//}... -
REXML
:: Parent # to _ a -> [REXML :: Child] (18310.0) -
子ノード列の配列を返します。
子ノード列の配列を返します。 -
REXML
:: AttlistDecl # each {|name , value| . . . } -> () (18307.0) -
それぞれの属性名、デフォルト値を引数として ブロックを順に呼び出します。
それぞれの属性名、デフォルト値を引数として
ブロックを順に呼び出します。
デフォルト値を持たない属性に関しては nil が渡されます。 -
REXML
:: AttlistDecl # element _ name -> String (18307.0) -
属性を定義しているエレメントの名前を返します。
属性を定義しているエレメントの名前を返します。 -
REXML
:: Attribute # namespace(arg = nil) -> String | nil (18307.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 # value -> String (18307.0) -
正規化されていない属性値を返します。
正規化されていない属性値を返します。
属性値の正規化については XML の仕様を参考にしてください。 -
REXML
:: Attributes # add(attribute) -> () (18307.0) -
属性を追加/更新します。
...更新する属性(REXML::Attribute オブジェクト)を
指定します。既に同じ名前(REXML::Attribute#name)のオブジェクトが
存在する場合は属性が上書きされ、ない場合は追加されます。
@param attribute 追加(更新)する属性(REXML::Attribute オブジ... -
REXML
:: CData # value -> String (18307.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 # parent=(other) (18307.0) -
other を親ノードに設定します。
...メソッドだけでは other の子ノード集合に self は追加されません。
つまりこのメソッドを呼び出した直後は不完全な状態であり、親ノード側を
適切に設定する必要があります。
@param other 新たな親ノード
@see REXML::Child#parent... -
REXML
:: Child # replace _ with(child) -> self (18307.0) -
親ノードの子ノード列上において、 self を child に置き換えます。
...親ノードの子ノード列上において、 self を child に置き換えます。
@param child 置き換え後のノード
@see REXML::Parent#replace_child... -
REXML
:: DocType # add(child) -> () (18307.0) -
child を子ノード列の最後に追加します。
...child を子ノード列の最後に追加します。
REXML::Parent#add を内部で呼び出します。
また、REXML::DocType#entities を更新します。
@param child 追加するノード... -
REXML
:: DocType # external _ id -> String | nil (18307.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 (18307.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 # namespaces -> nil (18307.0) -
nil を返します。
nil を返します。 -
REXML
:: Document # expanded _ name -> String (18307.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Document # name -> String (18307.0) -
""(空文字列)を返します。
""(空文字列)を返します。
XMLの仕様上、このオブジェクトはexpanded name名前を持ちえません。 -
REXML
:: Document # stand _ alone? -> String (18307.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
:: Element # each _ element(xpath = nil) {|element| . . . } -> () (18307.0) -
各子要素を引数としてブロックを呼び出します。
各子要素を引数としてブロックを呼び出します。
xpath に文字列を指定するとそれにマッチする子要素のみを対象とします。
@param xpath XPath 文字列 -
REXML
:: Element # has _ attributes? -> bool (18307.0) -
要素が属性を1つ以上持っていれば真を返します。
要素が属性を1つ以上持っていれば真を返します。 -
REXML
:: Element # has _ text? -> bool (18307.0) -
要素がテキストノードを子ノードとして持つ場合に true を返します。
要素がテキストノードを子ノードとして持つ場合に true を返します。 -
REXML
:: Element # raw -> bool (18307.0) -
その要素が raw モードであるならば真を返します。
...その要素が raw モードであるならば真を返します。
以下のいずれかであれば、raw モードであると判定されます。
* REXML::Element#context の :raw が :all である
* context の :raw の配列に self の要素名が含まれる... -
REXML
:: Element # whitespace -> bool (18307.0) -
要素(self)内で空白が考慮されるならば真を返します。
...要素(self)内で空白が考慮されるならば真を返します。
これは、
* REXML::Element#context に :respect_whitespace も :compress_whitespace も
含まれない
* context の :respect_whitespace に self の要素名が含まれていて、
:compress_whitespace に se......のには :all が指定されている場合と、
配列に含まれている場合の両方があります。
のいずれかの場合に真を返します。
要素名として REXML::Namespace#expanded_name が使われるので、
名前空間の prefix は判定に影響します。... -
REXML
:: Entity # external -> String | nil (18307.0) -
実体が外部実体(external entity)宣言である場合は "SYSTEM" もしくは "PUBLIC" という文字列を返します。
実体が外部実体(external entity)宣言である場合は
"SYSTEM" もしくは "PUBLIC" という文字列を返します。
内部実体(internal entity)宣言である場合には nil を返します。 -
REXML
:: Entity # name -> String (18307.0) -
実体の名前を返します。
実体の名前を返します。 -
REXML
:: Entity # ndata -> String | nil (18307.0) -
解析対象外実体(unparsed entity)宣言である場合には その記法名(notation name)を返します。
解析対象外実体(unparsed entity)宣言である場合には
その記法名(notation name)を返します。
それ以外の場合は nil を返します。 -
REXML
:: Entity # normalized -> String | nil (18307.0) -
正規化された(normalized)実体の値を返します。
...正規化された(normalized)実体の値を返します。
すなわち、一切の実体参照を展開していない値を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#unnormalized... -
REXML
:: Entity # unnormalized -> String | nil (18307.0) -
非正規化された(unnormalized)実体の値を返します。
...体の値を返します。
すなわち、self が属する DTD によってすべての実体参照(&ent; と %ent; の両方)
を展開した文字列を返します。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#value, REXML::Entity#normalized... -
REXML
:: Entity # value -> String | nil (18307.0) -
実体の値を返します。
...ータ実体参照(parameter entity)のみが展開され、
そうでない実体参照(general entity)は展開されて
いないような値が返されます。
外部実体(external entity)宣言の場合は nil を返します。
@see REXML::Entity#unnormalized, REXML::Entity#normalized... -
REXML
:: Formatters :: Pretty # compact -> bool (18307.0) -
出力をコンパクトにするかどうかを返します。
...出力をコンパクトにするかどうかを返します。
これが真の場合、出力の空白をできる限り削除しようとします。
デフォルト値は false です。
@see REXML::Formatters::Pretty#compact=... -
REXML
:: Formatters :: Pretty # compact=(c) (18307.0) -
出力をコンパクトにするかどうかを設定します。
...出力をコンパクトにするかどうかを設定します。
@param c コンパクトな出力をするかどうかを指定します。
@see REXML::Formatters::Pretty#compact... -
REXML
:: Instruction # target -> String (18307.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
:: Instruction # target=(value) (18307.0) -
XML 処理命令のターゲットを value に変更します。
XML 処理命令のターゲットを value に変更します。
@param value 新たなターゲット(文字列) -
REXML
:: Node # each _ recursive {|node| . . . } -> () (18307.0) -
self とその各 element node を引数とし、ブロックを呼び出します。
self とその各 element node を引数とし、ブロックを呼び出します。 -
REXML
:: Node # index _ in _ parent -> Insteger (18307.0) -
self の親における index を返します。
...self の親における index を返します。
返される index は 1-origin です。
ノードが親を持たない(REXML::Child でない)場合は例外を発生させます。... -
REXML
:: Node # parent? -> bool (18307.0) -
子を持つノードであれば真を返します。
...子を持つノードであれば真を返します。
REXML::Parent のサブクラスでは真を返します。
それ以外では偽を返します。
@see REXML::Parent#parent?... -
REXML
:: NotationDecl # name -> String (18307.0) -
記法宣言の名前を返します。
記法宣言の名前を返します。 -
REXML
:: Parent # add(object) -> () (18307.0) -
object を子ノード列の最後に追加します。
object を子ノード列の最後に追加します。
object の親ノードには self が設定されます。
@param object 追加するノード -
REXML
:: Parent # delete _ at(index) -> REXML :: Child | nil (18307.0) -
子ノード列上の index で指定された場所の要素を取り除きます。
子ノード列上の index で指定された場所の要素を取り除きます。
取り除いだノードを返します。indexが範囲外である場合は何もせず
nil を返します。 -
REXML
:: Parent # each -> Enumerator (18307.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each {|object| . . . } -> () (18307.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each _ child -> Enumerator (18307.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each _ child {|object| . . . } -> () (18307.0) -
各子ノードに対しブロックを呼び出します。
各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
REXML
:: Parent # each _ index -> Enumerator (18307.0) -
各子ノードのインデックスに対しブロックを呼び出します。
各子ノードのインデックスに対しブロックを呼び出します。
ブロックが省略された場合は上のような繰り返しをする
Enumerator オブジェクトを返します。 -
REXML
:: Parent # each _ index {|index| . . . } -> () (18307.0) -
各子ノードのインデックスに対しブロックを呼び出します。
各子ノードのインデックスに対しブロックを呼び出します。
ブロックが省略された場合は上のような繰り返しをする
Enumerator オブジェクトを返します。 -
REXML
:: Parent # insert _ after(child1 , child2) -> self (18307.0) -
child2 を child1 で指定したノードの後ろに挿入します。
...ドの後ろに挿入します。
child1 が REXML::Child のインスタンスであるならば、その
子ノードの後ろに挿入されます。
child1 が 文字列であるならば、XPath で場所を指定します。
具体的には REXML::XPath.first(self, child1) で特定される... -
REXML
:: Parsers :: PullEvent # attlistdecl? -> bool (18307.0) -
DTDの属性リスト宣言なら真を返します。
DTDの属性リスト宣言なら真を返します。 -
REXML
:: Parsers :: PullEvent # cdata? -> bool (18307.0) -
cdata セクションなら真を返します。
cdata セクションなら真を返します。 -
REXML
:: Parsers :: PullEvent # notationdecl? -> bool (18307.0) -
DTDの記法宣言なら真を返します。
DTDの記法宣言なら真を返します。 -
REXML
:: Parsers :: PullParser # peek(depth = 0) -> REXML :: Parsers :: PullEvent | nil (18307.0) -
イベントキューの先頭から depth 番目のイベントを取り出します。
...を返します。
@param depth 先頭から depth 番目のイベントを取り出します
@raise REXML::ParseException XML文書のパースに失敗した場合に発生します
@raise REXML::UndefinedNamespaceException XML文書のパース中に、定義されていない名前空間...