るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

検索結果

<< < 1 2 3 4 5 ... > >>

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

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

...指定した場合は index 番目の子要素を返します。
index は 1-origin です。つまり
最初の要素の index は 1 であり、 0 ではありません。
n 番目の要素の index は n であり、 n-1 ではありません。
これは XPath の仕様に合わせています...
...す。
name を指定した場合 name という名前を持つ子要素の中で index 番目の
ものを返します。この場合も index は 1-origin です。

整数で指定した場合でも、XPathで指定した場合でも、
指定した要素が存在しない場合は nil を返し...
.../><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"/></b></a>'
doc.root.elements["a"] # => nil
doc.root.elements["b/a"] # => <a id='1'/>
doc.root.elements["/a"]...

REXML::Elements#delete(element) -> Element (155.0)

element で指定した子要素を取り除きます。

...トを指定した場合は、その子要素を取り除きます。
整数を指定した場合には element 番目の子要素を削除します(1-originです)。
文字列を指定した場合は、削除する要素を XPath で指定します。
XPathが複数の要素を指している場...
...c.root.elements[1]
doc.root.elements.delete b # => <b/>
doc.root.to_s # => "<a><c/><c id='1'/></a>"
doc.elements.delete("a/c[@id='1']") # => <c id='1'/>
doc.root.to_s # => "<a><c/></a>"
doc.root.elements.delete 1 # => <c/>
doc.root.t...
...o_s # => "<a/>"
doc.root.elements.delete '/a'
doc.root.to_s # => ""
//}...

Psych::Nodes::Node#tag -> String | nil (137.0)

ノードに付加されたタグを返します。

...されていない場合は nil を返します。

ast = Psych.parse(<<EOS)
-
--
-
!!str a
-
b
EOS

p ast.root.children[0].value # => "a"
p ast.root.children[0].tag # => "tag:yaml.org,2002:str"

p ast.root.children[1].value # => "b"
p ast.root.children[1].tag # => nil...

REXML::Element#add_attribute(attr) -> () (137.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

...list[][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:a='c' b='d'/>
//}...

REXML::Element#add_attribute(key, value) -> () (137.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

...list[][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:a='c' b='d'/>
//}...

絞り込み条件を変える

REXML::Instruction#content -> String | nil (137.0)

XML 処理命令の内容を返します。

.../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-stylesheet"
doc[2].content # => "type=\"text/css\" href=\"style.css\""
doc[4]...

REXML::Instruction#target -> String (137.0)

XML 処理命令のターゲットを返します。

...quire '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-stylesheet"
doc[2].content # => "type=\"text/css\" href=\"style.css\""
//}...

PStore#fetch(name, default = PStore::Error) -> object (125.0)

ルートnameに対応する値を得ます。

...nsaction do
p db.roots # => []
ary = db["root"] = [1,2,3,4]
ary[0] = [1,1.5]
end

db.transaction(true) do |pstore|
pstore.fetch("root") # => [[1, 1.5], 2, 3, 4]
pstore.fetch("root", 'aaa') # => [[1, 1.5], 2, 3, 4]
pstore.fetch("not_root") # => 例外発...

REXML::Attributes#namespaces -> { String => String } (125.0)

self の中で宣言されている名前空間の集合を返します。

...quire '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.namespaces
# => {"foo"=>"http://example.org/f...
<< < 1 2 3 4 5 ... > >>