180件ヒット
[1-100件を表示]
(0.021秒)
種類
- インスタンスメソッド (120)
- ライブラリ (36)
- クラス (12)
- 文書 (12)
ライブラリ
- pstore (72)
-
rexml
/ document (60)
クラス
- PStore (60)
-
REXML
:: Attributes (36) -
REXML
:: Elements (24)
キーワード
- PStore (12)
- []= (24)
- abort (12)
- commit (12)
- delete (12)
- fetch (12)
- prefixes (12)
-
rexml
/ parsers / pullparser (12) -
rexml
/ parsers / sax2parser (12) -
rexml
/ parsers / streamparser (12) -
ruby 1
. 8 . 3 feature (12) - transaction (12)
検索結果
先頭5件
-
REXML
:: Elements # [](index , name = nil) -> REXML :: Element | nil (18136.0) -
index が指し示している要素を返します。
...ist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>'
doc.root.elements[1] # => <b/>
doc.root.elements['c'] # => <c id='1'/>
doc.root.elements[2,'c'] # => <c id='2'/>
doc = REXML::Document.new '<a><b><c /><a id="1"/></b></a>'
doc.root.el......ements["a"] # => nil
doc.root.elements["b/a"] # => <a id='1'/>
doc.root.elements["/a"] # => <a> ... </>
//}... -
REXML
:: Attributes # [](name) -> String | nil (18118.0) -
属性名nameの属性値を返します。
...me 属性名(文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
p a.attributes["att"]... -
REXML
:: Elements # []=(index , element) (6142.0) -
集合に要素 element を追加/更新します。
...ト)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a/>'
doc.root.elements[10] = REXML::Element.new('b')
doc.root.to_s # => "<a><b/></a>"
doc.root.elements[1] # => <b/>
doc.root.elements[1] = REXML::Element.new('c')
doc.root.to_s # => "<a><c/></a>"
doc.root.elements['c'] = R......EXML::Element.new('d')
doc.root.to_s # => "<a><d/></a>"
//}... -
REXML
:: Attributes # []=(name , value) (6118.0) -
指定した属性を更新します。
...追加されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes["att"] = "... -
rexml
/ parsers / sax2parser (96.0) -
SAX2 と同等の API を持つストリーム式の XML パーサ。
...サよりは高機能です。
//emlist[][ruby]{
require 'rexml/parsers/sax2parser'
require 'rexml/sax2listener'
parser = REXML::Parsers::SAX2Parser.new(<<XML)
<root n="0">
<a n="1">111</a>
<b n="2">222</b>
<a n="3">333</a>
</root>
XML
elements = []
parser.listen(:start_element){|uri, local......ame, qname, attrs|
elements << [qname, attrs]
}
as = []
parser.listen(:start_element, ["a"]){|uri, localname, qname, attrs|
as << [qname, attrs]
}
texts = []
parser.listen(:characters, ["a"]){|c| texts << c }
parser.parse
elements # => [["root", {"n"=>"0"}], ["a", {"n"=>"1"}], ["b", {"n"=>"2"}],......xml/sax2listener'
xml = <<EOS
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<!DOCTYPE root SYSTEM "foo" [
<!ELEMENT root (a+)>
<!ELEMENT a>
<!ENTITY bar "barbarbarbar">
<!ATTLIST a att CDATA #REQUIRED xyz CDATA "foobar">
<!NOTATION foobar SYST... -
rexml
/ parsers / pullparser (54.0) -
プル方式の XML パーサ。
...rsers::PullEvent#event_type で「開始タグ」「終了タグ」
といったイベントの種類を取得します。
REXML::Parsers::PullEvent#[] でそのイベントのパラメータ
(例えば開始タグなら要素名と属性)を得ることができます。
===[a:event_type] イベ......doctype内のパラメータ実体参照。
//emlist[][ruby]{
require 'rexml/parsers/pullparser'
xml = <<EOS
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<!DOCTYPE root SYSTEM "foo" [
<!ELEMENT root (a+)>
<!ELEMENT a>
<!ENTITY bar "barbarbarbar">......ML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
]>
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar"><![CDATA[cdata is here]]>
<a foo:att='1' bar:att='2' att='<'/>
&& <!-- comment here--> &bar;
</root>
EOS
parser = REXML::Parsers::PullParser.new(xml)... -
rexml
/ parsers / streamparser (54.0) -
ストリーム式の XML パーサ。
...あることに注意してください。
//emlist[][ruby]{
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
class Listener
include REXML::StreamListener
def initialize
@events = []
end
def text(text)
@events << "text[#{text}]"......す。
//emlist[][ruby]{
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
xml = <<EOS
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<!DOCTYPE root SYSTEM "foo" [
<!ELEMENT root (a+)>
<!ELEMENT a......ML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
]>
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar"><![CDATA[cdata is here]]>
<a foo:att='1' bar:att='2' att='<'/>
&& <!-- comment here--> &bar;
</root>
EOS
class Listener
def method_missing(name, *ar... -
PStore
# fetch(name , default = PStore :: Error) -> object (30.0) -
ルートnameに対応する値を得ます。
...nsaction do
p db.roots # => []
ary = db["root"] = [1,2,3,4]
ary[0] = [1,1.5]
end
db.transaction(true) do |pstore|
pstore.fetch("root") # => [[1, 1.5], 2, 3, 4]
pstore.fetch("root", 'aaa') # => [[1, 1.5], 2, 3, 4]
pstore.fetch("not_root") # => 例外発......生
end
@see Hash#fetch, PStore#[]... -
REXML
:: Attributes # prefixes -> [String] (30.0) -
self の中で宣言されている prefix の集合を 文字列の配列で返します。
...ません。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
p doc.root.attributes.prefixes #......=> ["foo", "bar"]
p a.attributes.prefixes # => []
//}...