るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 > >>

REXML::Text#doctype -> REXML::DocType | nil (26209.0)

テキストノードが属する文書の DTD を返します。

...テキストノードが属する文書の DTD を返します。

そのような文書(REXML::Document)が存在しない、すなわち
テキストノードの親ノードを辿っても REXML::Document に到達しない、
場合には nil を返します。

@see REXML::DocType...

REXML::Document#doctype -> REXML::DocType | nil (26203.0)

文書の DTD を返します。

文書の DTD を返します。

文書が DTD を持たない場合は nil を返します。

REXML::DocType#clone -> REXML::DocType (11114.0)

self の複製を返します。

...self の複製を返します。

external_id (REXML::DocType#external_id) と
名前(REXML::DocType#name) のみ複製されるため、
結果として得られるオブジェクトはあまり有用ではないでしょう。...

REXML::DocType#external_id -> String | nil (11067.0)

DTD が外部サブセットを用いている場合は "SYSTEM", "PUBLIC" の いずれかの文字列を返します。

...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(<<EOS).doctype
<!DOCTYPE...
...books [
<!ELEMENT books (book+)>
<!ELEMENT book (title,author)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
]>
EOS
doctype
.name # => "books"
doctype
.external_id # => nil
//}...

REXML::DocType#public -> String | nil (11067.0)

DTD の公開識別子を返します。

...][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
.system # => "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype
.public # => "-//...
...W3C//DTD XHTML 1.0 Strict//EN"

doctype
= REXML::Document.new(<<EOS).doctype
<!DOCTYPE root SYSTEM "foobar">
EOS
doctype
.system # => "foobar"
doctype
.public # => nil
//}...

絞り込み条件を変える

REXML::DocType#system -> String | nil (11067.0)

DTD のシステム識別子を返します。

...][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
.system # => "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype
.public # => "-//...
...W3C//DTD XHTML 1.0 Strict//EN"

doctype
= REXML::Document.new(<<EOS).doctype
<!DOCTYPE root SYSTEM "foobar">
EOS
doctype
.system # => "foobar"
doctype
.public # => nil
//}...

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

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

...{
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
//}...

REXML::DocType#attributes_of(element) -> [REXML::Attribute] (11043.0)

DTD 内の属性リスト宣言で、 element という名前の要素に対し宣言されている 属性の名前とデフォルト値を REXML::Attribute の配列で返します。

...{
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.attributes...
..._of("book")
# => [author='', title='', publisher='foobar publisher']
p doctype.attributes_of("book")[0].name # => "author"
p doctype.attributes_of("book")[0].value # => ""
//}...

REXML::DocType#entities -> { String => REXML::Entity } (11037.0)

DTD で宣言されている実体の集合を Hash で返します。

...
doctype
= REXML::Document.new(<<EOS).doctype
<!DOCTYPE foo [
<!ENTITY bar "barbarbarbar">
]>
EOS

p doctype.entities # => { "gt" => #<REXML::Entity: ...>,
# "lt" => #<REXML::Entity: ...>, ... }
p doctype.entities["bar"].to_s # => "<!ENTITY bar \"barbarbarbar\">"
p doctype...
<< 1 2 3 > >>