13件ヒット
[1-13件を表示]
(0.020秒)
別のキーワード
キーワード
- Comment (1)
- Default (1)
- DocType (1)
- Entity (1)
- ExternalEntity (1)
- Instruction (1)
- NotationDecl (1)
- ParseException (1)
- Pretty (1)
- Transitive (1)
- TreeParser (1)
- XMLDecl (1)
検索結果
-
REXML
:: Document (54043.0) -
XMLの完全な文書(ドキュメント)を表すクラス。
...どを含んでいます。
ドキュメントは直下の子ノードをただ一つ持っています(rootと呼び、
REXML::Document#root でアクセスできます)。
2つ目の要素を(REXML::Element#add_elementなどで)追加しようとすると
例外(RuntimeError)が発生します。... -
REXML
:: XMLDecl (133.0) -
XML 宣言を表すクラス。
...XML 宣言を表すクラス。
文書から XML 宣言を取り出すには REXML::Document#xml_decl を使います。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<e />
EOS
xml_decl = doc.xml_decl
xml_decl.......e 'rexml/document'
doc = REXML::Document.new(<<EOS)
<e />
EOS
xml_decl = doc.xml_decl
xml_decl.version # => "1.0"
xml_decl.encoding # => "UTF-8"
xml_decl.standalone # => nil
xml_decl.writethis # => false
//}
//emlist[XML 宣言が encoding 属性を持たない場合の例][ruby]{
require 'rexml/d......ocument'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" ?>
<e />
EOS
xml_decl = doc.xml_decl
xml_decl.version # => "1.0"
xml_decl.encoding # => "UTF-8"
xml_decl.standalone # => nil
xml_decl.writethis # => true
//}... -
REXML
:: Entity (61.0) -
XML における実体(エンティティ、entity)の宣言(declaration)を表わすクラス。
...る実体(エンティティ、entity)の宣言(declaration)を表わすクラス。
DTD(REXML::DocType)内の実体宣言に対応するものです。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<!DOCTYPE document [
<!ENTITY f "foo bar baz">
<!ENTITY x SYSTEM "x.... -
REXML
:: DocType (55.0) -
XML の DTD(文書型定義、Document Type Definition)を表すクラスです。
...XML の DTD(文書型定義、Document Type Definition)を表すクラスです。
rexml では DTD は積極的にはサポートされていません。
デフォルトの実体定義(gt, lt, amp, quot apos)の解決のため DTD は
ある程度はサポートされますが、スキーマの定......義や検証をしたい場合は
XML schema や RELAX NG などを使ってください。
子ノード(REXML::Parent#children)として、
* REXML::ElementDecl
* REXML::ExternalEntity
* REXML::Entity
* REXML::NotationDecl
* REXML::AttlistDecl
などを保持しています。... -
REXML
:: ParseException (46.0) -
XML のパースに失敗したときに生じる例外です。
...XML のパースに失敗したときに生じる例外です。
//emlist[][ruby]{
require 'rexml/document'
begin
REXML::Document.new("<a>foo\n</b></a> ")
rescue REXML::ParseException => ex
ex.position # => 16
ex.line # => 2
ex.context # => [16, 2, 2]
end
//}... -
REXML
:: Comment (43.0) -
XML コメントを表すクラス。
...XML コメントを表すクラス。
コメントとは <!-- と --> で挟まれたテキストです。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<!-- xx -->
<root>
<!-- yy -->
text
<!-- zz -->
</root>
EOS
doc[0].string # => " xx "
doc.root[1].string # => " yy... -
REXML
:: ExternalEntity (43.0) -
DTD 内の宣言でパラメータ実体参照を使って宣言が されているものを表わすクラスです。
.../emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE xhtml [
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
]>
EOS
p doctype.children.find_all{|child| REXML::ExternalEntity === child... -
REXML
:: Formatters :: Default (43.0) -
XMLドキュメントを(文字列として)出力するクラスです。
...列として)出力するクラスです。
REXML::Formatters::Pretty と
異なりテキストの改行や空白を修正せずにそのまま出力します。
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/formatters/default'
doc = REXML::Document.new <<EOS
<root>
<children>
<grand......ren>
</root>
EOS
default_formatter = REXML::Formatters::Default.new
output = StringIO.new
default_formatter.write(doc, output)
output.string
# => "<root>\n<children>\n <grandchildren/>\n</children>\n</root>\n"
output = StringIO.new
default_formatter.write(REXML::XPath.first(doc, "/root/children")......, output)
output.string
# => "<children>\n <grandchildren/>\n</children>"
ie_hack_formatter = REXML::Formatters::Default.new(true)
output = StringIO.new
ie_hack_formatter.write(doc, output)
output.string
# => "<root>\n<children>\n <grandchildren />\n</children>\n</root>\n"
//}... -
REXML
:: Formatters :: Pretty (43.0) -
XMLドキュメントを(文字列として)見た目良く出力するクラスです。
...た目良く出力するクラスです。
REXML::Formatters::Default と
異なり見た目のためテキストの改行や空白を修正して出力します。
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/formatters/pretty'
doc = REXML::Document.new <<EOS
<root>
<children>
<gra......ndchildren foo='bar'/>
</children>
</root>
EOS
pretty_formatter = REXML::Formatters::Pretty.new
output = StringIO.new
pretty_formatter.write(doc, output)
output.string
# => "<root>\n <children>\n <grandchildren foo='bar'/>\n </children>\n</root>"
# この出力結果は入力のXMLよりも空... -
REXML
:: Formatters :: Transitive (43.0) -
XMLドキュメントをテキストの内容を変えずに 多少の整形を加えて出力するクラスです。
...結果になるでしょう。
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/formatters/transitive'
doc = REXML::Document.new <<EOS
<root><children>
<grandchildren foo='bar' />
</children></root>
EOS
transitive_formatter = REXML::Formatters::Transitive.new
output = StringIO.new
transit......>> <root
# >> ><children
# >> >
# >> <grandchildren foo='bar'
# >> />
# >> </children
# >> ></root
# >> >
output = StringIO.new
transitive_formatter.write(REXML::XPath.first(doc, "/root/children"), output)
output.string
# => "<children\n>\n<grandchildren foo='bar'\n />\n</children\n>"
//}... -
REXML
:: Instruction (43.0) -
XML 処理命令(XML Processing Instruction, XML PI)を表すクラス。
...<?xml version=... ?>)はXML処理命令ではありませんが、
似た見た目を持っています。
//emlist[][ruby]{
require '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] # =... -
REXML
:: NotationDecl (43.0) -
DTD の記法宣言を表すクラスです。
...DTD の記法宣言を表すクラスです。
//emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE foo [
<!NOTATION type-image-svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!NOTATION type-image-g... -
REXML
:: Parsers :: TreeParser (25.0) -
内部用です。使わないでください。
...内部用です。使わないでください。
XML 文書から DOMオブジェクトを組み立てるパーサです。
REXML::Document.new などから使われます。...