るりまサーチ

最速Rubyリファレンスマニュアル検索!
96件ヒット [1-96件を表示] (0.031秒)

別のキーワード

  1. rexml/document new
  2. rexml/document write
  3. rexml/document to_s
  4. rexml/document clone
  5. rexml/document node_type

検索結果

REXML::Elements#[](index, name = nil) -> REXML::Element | nil (18118.0)

index が指し示している要素を返します。

...前(文字列)

//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='1'/>
doc.root.elements[2,'c'] # => <c id='2'/>

doc = REXML::Document.new '<a><b><c /><a id="1"/>...

REXML::Attributes#[](name) -> String | nil (18112.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='2...

Psych::Handler#start_document(version, tag_directives, implicit) -> () (6125.0)

YAML ドキュメントの始まりで呼び出されます。

..._document に渡される引数は以下の通りです
version # => [1, 1]
tag_directives # => tenderlovemaking.com,2009:"
implicit # => false

以下の YAML に対しては
- x
- y
start_document に渡される引数は以下の通りです。
version # => []...
...tag_directives # => []
implicit # => true...

REXML::Attributes#[]=(name, value) (6112.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::Elements#[]=(index, element) (6112.0)

集合に要素 element を追加/更新します。

...れます。

@param index 要素を更新する位置
@param element 要素(REXML::Elementオブジェクト)

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a/>'
doc.root.elements[10] = REXML::Element.new('b')
doc.root.to_s # => "<a><b/></a>"
doc.root.elements[1] # => <b/>...

絞り込み条件を変える

Psych::Nodes::Document.new(version=[], tag_directives=[], implicit=false) -> Psych::Nodes::Document (3335.0)

Document オブジェクトを生成します。

...
Document
オブジェクトを生成します。

version にはドキュメントのバージョンを指定します。
[major, minor] という配列で指定します。

tag_directives には tag directive の配列を指定します。
それぞれの tag は [prefix, suffix] という文字...
...YAML 1.1 のドキュメントで、
tag directive を1つ持ち、 implicit にドキュメントが開始
している Document オブジェクトを生成しています。

Psych::Nodes::Document.new(
[1,1],
tenderlovemaking.com,2009:",
true)

@see Psych::Handler#start_document...

rexml/parsers/sax2parser (30.0)

SAX2 と同等の API を持つストリーム式の XML パーサ。

...サよりは高機能です。

//emlist[][ruby]{
require 'rexml/parsers/sax2parser'
require 'rexml/sax2listener'

parser = REXML::Parsers::SAX2Parser.new(<<XML)
<root n="0">
<a n="1">111</a>
<b n="2">222</b>
<a n="3">333</a>
</root>
XML

elements = []
parser.listen(:start_element){|uri, local...
...name, qname, attrs|
elements << [qname, attrs]
}
as = []
parser.listen(:start_element, ["a"]){|uri, localname, qname, attrs|
as << [qname, attrs]
}
texts = []
parser.listen(:characters, ["a"]){|c| texts << c }
parser.parse
elements # => [["root", {"n"=>"0"}], ["a", {"n"=>"1"}], ["b", {"n"=>"2"}]...
...include_private)
name != :call
end
end

parser = REXML::Parsers::SAX2Parser.new(xml)
parser.listen(Listener.new)
parser.parse
# >> [:start_document]
# >> [:xmldecl, "1.0", "UTF-8", nil]
# >> [:progress, 39]
# >> [:characters, "\n"]
# >> [:progress, 91]
# >> [:processing_instruction, "xml-styl...

REXML::Attributes#prefixes -> [String] (18.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='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p doc.root.attributes.prefixes # => ["foo", "bar"]
p a.attributes.prefixes # => []
//}...