Ruby 3.3 リファレンスマニュアル > ライブラリ一覧 > rexml/documentライブラリ > REXML::DocTypeクラス

class REXML::DocType

クラス・モジュールの継承リスト: REXML::DocType < REXML::XMLTokens < REXML::Parent < Enumerable < REXML::Child < REXML::Node < Object < Kernel < BasicObject

要約

XML の DTD(文書型定義、Document Type Definition)を表すクラスです。

rexml では DTD は積極的にはサポートされていません。デフォルトの実体定義(gt, lt, amp, quot apos)の解決のため DTD はある程度はサポートされますが、スキーマの定義や検証をしたい場合は XML schema や RELAX NG などを使ってください。

子ノード(REXML::Parent#children)として、

などを保持しています。

特異メソッド

定義 説明
new(source, parent = nil) -> REXML::DocType

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

インスタンスメソッド

定義 説明
add(child) -> ()

child を子ノード列の最後に追加します。

attribute_of(element, attribute) -> String | nil

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

attributes_of(element) -> [REXML::Attribute]

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

clone -> REXML::DocType

self の複製を返します。

context -> { Symbol => object }

DTD が属する文書の「コンテキスト」を返します。

entities -> { String => REXML::Entity }

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

entity(name) -> String | nil

name という実体参照名を持つ実体を文字列で返します。

external_id -> String | nil

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

name -> String

ルート要素名を返します。

namespaces -> nil

nil を返します。

node_type -> Symbol

Symbol :doctype を返します。

notation(name) -> REXML::NotationDecl | nil

DTD に含まれている記法宣言 (REXML::NotationDecl) で name という名前を持つものを返します。

notations -> [REXML::NotationDecl]

DTD に含まれている記法宣言 (REXML::NotationDecl) を配列で返します。

public -> String | nil

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

system -> String | nil

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

write(output, indent = 0, transitive = false, ie_hack = false) -> ()

output に DTD を出力します。

定数

定義 説明
DEFAULT_ENTITIES -> { String => REXML::Entity }

XML の仕様上デフォルトで定義されている実体の Hash table。

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined !~ <=> == === _dump class clone define_singleton_method display enum_for eql? equal? extend freeze frozen? hash initialize initialize_clone initialize_copy initialize_dup inspect instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself marshal_dump marshal_load method methods nil? object_id pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods psych_to_yaml public_method public_methods public_send remove_instance_variable respond_to? respond_to_missing? send singleton_class singleton_method singleton_methods tap then to_ary to_hash to_int to_io to_proc to_regexp to_s to_str .yaml_tag ::ARGF ::ARGV ::DATA ::ENV ::RUBY_COPYRIGHT ::RUBY_DESCRIPTION ::RUBY_ENGINE ::RUBY_ENGINE_VERSION ::RUBY_PATCHLEVEL ::RUBY_PLATFORM ::RUBY_RELEASE_DATE ::RUBY_REVISION ::RUBY_VERSION ::SCRIPT_LINES__ ::STDERR ::STDIN ::STDOUT ::TOPLEVEL_BINDING bytes document next_sibling next_sibling= parent parent= previous_sibling previous_sibling= remove replace_with << [] []= children deep_clone delete delete_at delete_if each each_index index insert_after insert_before length parent? replace_child unshift