るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

検索結果

<< 1 2 3 ... > >>

REXML::DocType#write(output, indent = 0, transitive = false, ie_hack = false) -> () (45.0)

output に DTD を出力します。

...

@
param output 出力先の IO オブジェクト
@
param indent インデントの深さ。指定しないでください。
@
param transitive 無視されます。指定しないでください。
@
param ie_hack 無視されます。指定しないでください。

//emlist[][ruby]{
require
'...
...new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book
author CDATA #REQUIRED
title CDATA #REQUIRED
publisher CDATA "foobar publisher">
<!ENTITY p "foobar publisher">
<!ENTITY % q "quzz">
]>
EOS

doctype.write(STDOUT)...

REXML::Element#each_element_with_attribute(key, value = nil, max = 0, name = nil) {|element| ... } -> () (45.0)

特定の属性を持つすべての子要素を引数としてブロックを呼び出します。

...視されます(0個ではありません)。

@
param key 属性名(文字列)
@
param value 属性値(文字列)
@
param max ブロック呼出の対象とする子要素の最大個数
@
param name xpath文字列

//emlist[][ruby]{
require
'rexml/document'
doc = REXML::Document.new("<a><b id='1'/><c...

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

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

...値は 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");...

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

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

...値は 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");...

REXML::Element#add_element(element, attrs = nil) -> Element (39.0)

子要素を追加します。

...要素の最後に追加されます。

返り値は追加された要素です。

@
param element 追加する要素
@
param attrs 追加する要素に設定する属性

//emlist[][ruby]{
require
'rexml/document'
doc = REXML::Document.new('<a/>')
el = doc.root.add_element 'my-tag' # => <my-tag/>...
...'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::Element#each_element_with_text(text = nil, max = 0, name = nil) {|element| ... } -> () (39.0)

テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。

...定は無視されます(0個ではありません)。

@
param text テキストの中身(文字列)
@
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...

REXML::Attributes#get_attribute(name) -> Attribute | nil (33.0)

name という名前の属性を取得します。

...取得します。

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:...

REXML::Attributes#get_attribute_ns(namespace, name) -> REXML::Attribute | nil (33.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...

REXML::DocType#attribute_of(element, attribute) -> String | nil (33.0)

DTD 内の属性リスト宣言で、 element という名前の要素の attribute という 名前の属性のデフォルト値を返します。

...す。

@
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 CDATA #REQUIRED...
...title CDATA #REQUIRED
publisher CDATA "foobar publisher">
]>
EOS

p doctype.attribute_of("book", "publisher") # => "foobar publisher"
p doctype.attribute_of("bar", "foo") # => nil
p doctype.attribute_of("book", "baz") # => nil
p doctype.attribute_of("book", "title") # => nil
//}...
<< 1 2 3 ... > >>