るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.037秒)
トップページ > クエリ:map[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

種類

ライブラリ

検索結果

rexml/document (38012.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 versi...
...itle>
</bookmark>
<bookmark href="https://rubygems.org/gems/bitclust-core" />
</xbel>
XML

bookmarks = REXML::XPath.match(doc, "/xbel/bookmark").map do |bookmark|
href = bookmark.attribute("href").value
title_element = bookmark.elements["title"]
title = title_element ? title_element.text...

REXML::ExternalEntity (8012.0)

DTD 内の宣言でパラメータ実体参照を使って宣言が されているものを表わすクラスです。

...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 }.map(&:to_s)
#...