492件ヒット
[1-100件を表示]
(0.051秒)
別のキーワード
ライブラリ
- pathname (12)
-
rexml
/ document (468) -
rexml
/ streamlistener (12)
クラス
- Pathname (12)
-
REXML
:: Attributes (144) -
REXML
:: CData (24) -
REXML
:: DocType (24) -
REXML
:: Element (180) -
REXML
:: Elements (72) -
REXML
:: Instruction (24)
モジュール
キーワード
- [] (24)
- []= (12)
-
add
_ attribute (24) -
add
_ element (12) - attribute (12)
- content (12)
- delete (24)
-
delete
_ all (12) -
delete
_ element (12) -
delete
_ namespace (12) - each (24)
-
each
_ attribute (12) -
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) - entitydecl (12)
-
get
_ attribute (12) -
get
_ attribute _ ns (12) -
get
_ text (12) -
has
_ elements? (12) - length (12)
- namespaces (12)
-
next
_ element (12) - prefixes (12)
- public (12)
- root? (12)
-
root
_ node (12) - size (24)
- system (12)
- target (12)
- text (12)
-
to
_ a (24) -
to
_ s (12) - value (12)
- xpath (12)
検索結果
先頭5件
-
REXML
:: Element # root -> REXML :: Element (18256.0) -
self が属する文書のルート要素を返します。
.../emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children").first
children.name # => "children"
children.root.name # => "root"
grandchildren = doc.get_elements("/root/children/......grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root.name # => "root"
//}... -
REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node (6244.0) -
self が属する文書のルートノードを返します。
...mlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children").first
children.name # => "children"
children.root_node == doc # => true
grandchildren = doc.get_elements("/root/childr......en/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root_node == doc # => true
//}... -
Pathname
# root? -> bool (6220.0) -
self がルートディレクトリであれば真を返します。判断は文字列操作によっ て行われ、ファイルシステムはアクセスされません。
...self がルートディレクトリであれば真を返します。判断は文字列操作によっ
て行われ、ファイルシステムはアクセスされません。
//emlist[例][ruby]{
require 'pathname'
Pathname('/').root? # => true
Pathname('/im/sure').root? # => false
//}... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (215.0) -
子要素を追加します。
...t[][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
:: StreamListener # entitydecl(content) -> () (167.0) -
DTDの実体宣言をパースしたときに呼び出されるコールバックメソッドです。
...が異なります。
//emlist[][ruby]{
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
xml = <<EOS
<!DOCTYPE root [
<!ENTITY % YN '"Yes"'>
<!ENTITY % YN 'Yes'>
<!ENTITY WhatHeSaid "He said %YN;">
<!ENTITY open-hatch SYSTEM "http://www.textuali......ty.com/boilerplate/OpenHatch.xml">
<!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
]>
<root />
EOS
class Listener
include REXML::StreamListene......eSaid", "He said %YN;"]
# >> ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"]
# >> ["open-hatch", "PUBLIC", "-//Textuality//TEXT Standard open-hatch boilerplate//EN", "http://www.textuality.com/boilerplate/OpenHatch.xml"]
# >> ["hatch-pic", "SYSTEM", "../grafix/OpenHat... -
REXML
:: Elements # [](index , name = nil) -> REXML :: Element | nil (161.0) -
index が指し示している要素を返します。
...指定した場合は index 番目の子要素を返します。
index は 1-origin です。つまり
最初の要素の index は 1 であり、 0 ではありません。
n 番目の要素の index は n であり、 n-1 ではありません。
これは XPath の仕様に合わせています......す。
name を指定した場合 name という名前を持つ子要素の中で index 番目の
ものを返します。この場合も index は 1-origin です。
整数で指定した場合でも、XPathで指定した場合でも、
指定した要素が存在しない場合は nil を返し......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... -
REXML
:: Elements # delete(element) -> Element (161.0) -
element で指定した子要素を取り除きます。
...トを指定した場合は、その子要素を取り除きます。
整数を指定した場合には element 番目の子要素を削除します(1-originです)。
文字列を指定した場合は、削除する要素を XPath で指定します。
XPathが複数の要素を指している場......ist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c id="1"/></a>'
b = doc.root.elements[1]
doc.root.elements.delete b # => <b/>
doc.root.to_s # => "<a><c/><c id='1'/></a>"
doc.elements.delete("a/c[@id='1']") # => <c id='1'/>
doc.root.to_s......# => "<a><c/></a>"
doc.root.elements.delete 1 # => <c/>
doc.root.to_s # => "<a/>"
doc.root.elements.delete '/a'
doc.root.to_s # => ""
//}... -
REXML
:: Element # add _ attribute(attr) -> () (143.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) -> () (143.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'...