883件ヒット
[201-300件を表示]
(0.056秒)
別のキーワード
ライブラリ
- ビルトイン (60)
- fileutils (55)
- pathname (12)
- pstore (12)
- psych (12)
-
rexml
/ document (612) -
rexml
/ streamlistener (12)
クラス
- Dir (36)
- Pathname (12)
-
REXML
:: Attributes (156) -
REXML
:: CData (36) -
REXML
:: DocType (24) -
REXML
:: Element (192) -
REXML
:: Elements (72) -
REXML
:: Instruction (24) -
REXML
:: Text (12) -
REXML
:: XPath (36)
モジュール
- FileUtils (55)
- Math (24)
-
REXML
:: StreamListener (12)
キーワード
- Comment (12)
- Default (12)
- Instruction (12)
-
NEWS for Ruby 2
. 1 . 0 (12) - PStore (12)
- Pretty (12)
- ReFe (12)
- Transitive (12)
- TreeBuilder (12)
- [] (24)
- []= (24)
-
add
_ attribute (24) -
add
_ element (12) - attribute (12)
- cbrt (12)
- chown (12)
-
chown
_ R (12) - chroot (12)
- content (12)
-
cp
_ lr (7) -
cp
_ r (12) - delete (24)
-
delete
_ all (12) -
delete
_ element (12) -
delete
_ namespace (12) - each (36)
-
each
_ attribute (12) -
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) - entitydecl (12)
- first (12)
-
get
_ attribute (12) -
get
_ attribute _ ns (12) -
get
_ text (12) -
has
_ elements? (12) - home (24)
- length (12)
- match (12)
- namespaces (12)
- new (24)
-
next
_ element (12) - prefixes (12)
- public (12)
- rdoc (12)
-
rexml
/ parsers / pullparser (12) -
rexml
/ parsers / sax2parser (12) -
rexml
/ parsers / streamparser (12) -
rexml
/ parsers / ultralightparser (12) - root? (12)
-
root
_ node (12) -
ruby 1
. 8 . 3 feature (12) -
rubygems
/ security (12) - size (24)
- sqrt (12)
- system (12)
- target (12)
- text (12)
- text= (12)
-
to
_ a (24) -
to
_ s (12) - value (12)
- xpath (12)
検索結果
先頭5件
-
REXML
:: Formatters :: Default (48.0) -
XMLドキュメントを(文字列として)出力するクラスです。
...][ruby]{
require 'rexml/document'
require 'rexml/formatters/default'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren/>
</children>
</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 :: Transitive (48.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
outpu......ter.write(doc, output)
output.string
# => "<root\n><children\n >\n<grandchildren foo='bar'\n />\n</children\n ></root\n>\n"
print output.string
# >> <root
# >> ><children
# >> >
# >> <grandchildren foo='bar'
# >> />
# >> </children
# >> ></root
# >> >
output = StringIO.new
transitive_f... -
REXML
:: Element # add _ attribute(attr) -> () (42.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...クト)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<e/>")
doc.root.add_attribute("a", "b"); doc.root # => <e a='b'/>
doc.root.add_attribute("x:a", "c"); doc.root # => <e a='b' x:a='c'/>
doc.root.add_attribute(REXML::Attribute.new("b", "d"))
doc.root # => <e a='b' x:a='c'... -
REXML
:: Element # add _ attribute(key , value) -> () (42.0) -
要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。
...クト)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<e/>")
doc.root.add_attribute("a", "b"); doc.root # => <e a='b'/>
doc.root.add_attribute("x:a", "c"); doc.root # => <e a='b' x:a='c'/>
doc.root.add_attribute(REXML::Attribute.new("b", "d"))
doc.root # => <e a='b' x:a='c'... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (42.0) -
子要素を追加します。
...//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a/>')
el = doc.root.add_element 'my-tag' # => <my-tag/>
doc.root.to_s # => "<a><my-tag/></a>"
el = doc.root.add_element 'my-tag', {'attr1'=>'val1', 'attr2'=>'val2'}
# => <my-tag attr1='val1' attr2='val2'/>
doc.root.to_s # => "<......a><my-tag/><my-tag attr1='val1' attr2='val2'/></a>"
el = REXML::Element.new 'my-tag'
doc.root.add_element el # => <my-tag/>
doc.root.to_s # => "<a><my-tag/><my-tag attr1='val1' attr2='val2'/><my-tag/></a>"
//}
@see REXML::Elements#add, REXML::Element.new... -
REXML
:: Elements # [](index , name = nil) -> REXML :: Element | nil (42.0) -
index が指し示している要素を返します。
...st[][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.ele......ments["a"] # => nil
doc.root.elements["b/a"] # => <a id='1'/>
doc.root.elements["/a"] # => <a> ... </>
//}... -
REXML
:: Element # text=(text) (36.0) -
「先頭の」テキストノードを text で置き換えます。
...ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/></a>')
doc.to_s # => "<a><b/></a>"
doc.root.text = "Foo"; doc.to_s # => "<a><b/>Foo</a>"
doc.root.text = "Bar"; doc.to_s # => "<a><b/>Bar</a>"
doc.root.add_element "c"
doc.root.text = "Baz"; doc.to_s # => "<a><b/>Baz<c/></a>"
doc.root... -
REXML
:: Text . new(arg , respect _ whitespace = false , parent = nil , raw = nil , entity _ filter = nil , illegal = REXML :: Text :: NEEDS _ A _ SECOND _ CHECK) (36.0) -
テキストノードオブジェクトを生成します。
...r テキストがXMLのテキストとして不正な
文字を含んでいる場合に発生します。
//emlist[doctype なしの場合][ruby]{
p REXML::Text.new("<&", false, nil, false).to_s # => "<&"
p REXML::Text.new("<&", false, nil, false).to_s # => "&lt;&amp;"......が宣言されている場合][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE root [
<!ENTITY p "foobar publisher">
<!ENTITY % q "quzz">
]>
<root />
EOS
REXML::Text.new("&quzz", false, doc.root, false).to_s # => "&&q;"
REX......ML::Text.new("quzz", false, doc.root, true).to_s # => "quzz"
//}... -
REXML
:: XPath . first(element , path = nil , namespaces = {} , variables = {}) -> Node | nil (36.0) -
element の path で指定した XPath 文字列にマッチする最初のノードを 返します。
...][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS
a = doc.root.elements[1] # => <a> ... </>
b1 = REXML::XPath.first(a, "b")
b1.text # => "b1"
REXML::XPath.first(doc, "/root/......a/x:c") # => <x:c/>
REXML::XPath.first(a, "x:c") # => <x:c/>
REXML::XPath.first(a, "y:c") # => nil
REXML::XPath.first(a, "y:c", {"y" => "1"}) # => <x:c/>
b2 = REXML::XPath.first(doc, "/root/a/b[text()=$v]", {}, {"v" => "b2"})
b2 # => <b> ... </>
b2.text # => "b2"
//}...