るりまサーチ

最速Rubyリファレンスマニュアル検索!
1008件ヒット [1-100件を表示] (0.036秒)
トップページ > クエリ:require[x] > クエリ:rexml/document[x]

別のキーワード

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

検索結果

<< 1 2 3 ... > >>

rexml/document (38018.0)

DOM スタイルの XML パーサ。

...セスします。

以下のプログラムではブックマークの XML からデータを取り出します。

//emlist[][ruby]{
require
'rexml/document'
require
'pp'

Bookmark = Struct.new(:href, :title, :desc)

doc = REXML::Document.new(<<XML)
<?xml version="1.0" encoding="UTF-8" ?>
<xbel ve...

REXML::XMLDecl (8036.0)

XML 宣言を表すクラス。

...L 宣言を表すクラス。

文書から 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.ve...
...{
require
'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/document'
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::Elements#each(xpath = nil) {|element| ... } -> [REXML::Elements] (8018.0)

全ての子要素に対しブロックを呼び出します。

...ストノードなどはすべて無視されることに注意してください。

@param xpath XPath文字列

//emlist[][ruby]{
require
'rexml/document'
require
'rexml/xpath'
doc = REXML::Document.new '<a><b/><c/><d/>sean<b/><c/><d/></a>'
# <b/>,<c/>,<d/>,<b/>,<c/>, <d/> がブロックに渡...

REXML::Elements#to_a(xpath = nil) -> [REXML::Element] (8018.0)

すべての子要素の配列を返します。

...:XPath.match などと
異なり、要素以外の子ノードは無視されます。

@param xpath XPath文字列

//emlist[][ruby]{
require
'rexml/document'
require
'rexml/xpath'
doc = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
doc.root.elements.to_a # => [<b/>, <c/>]
doc.root.elements.to...

REXML::Formatters::Default (8018.0)

XMLドキュメントを(文字列として)出力するクラスです。

...XML::Formatters::Pretty と
異なりテキストの改行や空白を修正せずにそのまま出力します。

//emlist[][ruby]{
require
'rexml/document'
require
'rexml/formatters/default'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren/>
</children>
</root>
EOS

default_for...

絞り込み条件を変える

REXML::Formatters::Pretty (8018.0)

XMLドキュメントを(文字列として)見た目良く出力するクラスです。

...:Formatters::Default と
異なり見た目のためテキストの改行や空白を修正して出力します。

//emlist[][ruby]{
require
'rexml/document'
require
'rexml/formatters/pretty'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren foo='bar'/>
</children>
</root>
EOS

pr...

REXML::Formatters::Transitive (8018.0)

XMLドキュメントをテキストの内容を変えずに 多少の整形を加えて出力するクラスです。

...役にたつかもしれません。
ただ、ほとんどの場合は奇妙な出力結果になるでしょう。

//emlist[][ruby]{
require
'rexml/document'
require
'rexml/formatters/transitive'
doc = REXML::Document.new <<EOS
<root><children>
<grandchildren foo='bar' />
</children></root>
EOS

t...

REXML::Attribute#namespace(arg = nil) -> String | nil (8012.0)

属性の名前空間の URI を返します。

...前空間でなく、arg という名前空間
の URI が返されます。
通常は省略します。

//emlist[][ruby]{
require
'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("xmlns:ns", "http://www.example.com/ns")
e.add_attribute("ns:r", "rval")
p e.attributes.get_...

REXML::Attribute#prefix -> String (8012.0)

属性の名前空間を返します。

...属性の名前空間を返します。

//emlist[][ruby]{
require
'rexml/document'
e = REXML::Element.new( "elns:myelement" )
e.add_attribute( "nsa:a", "aval" )
e.add_attribute( "b", "bval" )
p e.attributes.get_attribute( "a" ).prefix # -> "nsa"
p e.attributes.get_attribute( "b" ).prefix # -> "...
<< 1 2 3 ... > >>