252件ヒット
[1-100件を表示]
(0.080秒)
別のキーワード
ライブラリ
-
rexml
/ document (252)
キーワード
-
add
_ attribute (24) -
add
_ attributes (12) -
add
_ element (12) -
add
_ namespace (12) - attribute (12)
-
delete
_ attribute (12) -
delete
_ element (12) -
delete
_ namespace (12) -
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) -
get
_ text (12) -
has
_ elements? (12) - namespace (12)
- namespaces (12)
-
next
_ element (12) - prefixes (12)
- root (12)
-
root
_ node (12) - text (12)
- xpath (12)
検索結果
先頭5件
-
REXML
:: Element # namespaces -> {String => String} (208.0) -
self の文脈で定義されている名前空間の情報を返します。
...義されている名前空間を、{ prefix => 識別子 }
というハッシュテーブルで返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a xmlns:x='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>")
doc.elements['//b'].namespaces # => {"x"=>"1", "y"=>"2"}
//}... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (168.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...列
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
doc.root.each_element_with_text {|e|p e}
# >> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >> <c> ... </>
doc.root.each_ele......ment_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ... </>
//}... -
REXML
:: Element # get _ text(path = nil) -> REXML :: Text | nil (132.0) -
先頭のテキスト子ノードを返します。
...e REXML::Element#text
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
# doc.root (<p> ... </p>) は2つのテキストノード("some text " と " more text"
# を持っているが、前者を返す
doc.root.get_text.value # =>... -
REXML
:: Element # root -> REXML :: Element (132.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_e......lements("/root/children/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root.name # => "root"
//}... -
REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node (132.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_node == doc # => true
grandchildren = doc.get_el......ements("/root/children/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root_node == doc # => true
//}... -
REXML
:: Element # text(path = nil) -> String | nil (132.0) -
先頭のテキスト子ノードの文字列を返します。
...@see REXML::Element#get_text
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
# doc.root (<p> ... </p>) は2つのテキストノード("some text " と " more text"
# を持っているが、前者を返す
doc.root.text # => "s... -
REXML
:: Element # xpath -> String (132.0) -
文書上の対象の要素にのみマッチする xpath 文字列を返します。
...][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/><c/></a>')
c = doc.root.elements[2] # <a> .. </a> の中の <c/> 要素
c # => <c/>
c.xpath # => "/a/c"
doc = REXML::Document.new('<a><b/><b/></a>')
b = doc.root.elements[2] # <a> .. </a> の中の2番目の <b/> 要素
b # => <b/>......b.xpath # => "/a/b[2]"
//}... -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (114.0) -
name で指定される属性を返します。
...列)
//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.attribute("att") # => att='<'
a.attri......bute("att", "http://example.org/bar") # => bar:att='2'
a.attribute("bar:att") # => bar:att='2'
a.attribute("baz") # => nil
//}... -
REXML
:: Element # has _ elements? -> bool (114.0) -
self が一つでも子要素を持つならば true を返します。
...t[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b/><c>Text</c></a>")
doc.root.has_elements? # => true
doc.elements["/a/b"].has_elements? # => false
# /a/c はテキストノードしか持たないので false である
doc.elements["/a/c"].has_elements? # => fal...