33件ヒット
[1-33件を表示]
(0.199秒)
ライブラリ
-
rexml
/ document (33)
クラス
-
REXML
:: Attribute (22) -
REXML
:: Element (11)
検索結果
先頭3件
-
REXML
:: Attribute # prefix -> String (33325.0) -
属性の名前空間を返します。
...す。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new( "elns:myelement" )
e.add_attribute( "nsa:a", "aval" )
e.add_attribute( "b", "bval" )
p e.attributes.get_attribute( "a" ).prefix # -> "nsa"
p e.attributes.get_attribute( "b" ).prefix # -> "elns"
a = REXML::Attribute.new( "......x", "y" )
p a.prefix # -> ""
//}... -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (18606.0) -
name で指定される属性を返します。
...name で指定される属性を返します。
属性は REXML::Attribute オブジェクトの形で返します。
name は "foo:bar" のように prefix を指定することができます。
namespace で名前空間の URI を指定することで、その名前空間内で
name という......il を返します。
@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//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='&l......t;'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attribute("att") # => att='<'
a.attribute("att", "http://example.org/bar") # => bar:att='2'
a.attribute("bar:att") # => bar:att='2'
a.attribute("baz") # => nil
//}... -
REXML
:: Attribute # namespace(arg = nil) -> String | nil (9330.0) -
属性の名前空間の URI を返します。
...URI を返します。
URI が定義されていない場合は nil を返します。
@param arg この値を指定すると、その属性の名前空間でなく、arg という名前空間
の URI が返されます。
通常は省略します。
//emlist[][ruby]{
require 'rexml....../document'
e = REXML::Element.new("el")
e.add_attribute("xmlns:ns", "http://www.example.com/ns")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").prefix # => "ns"
p e.attributes.get_attribute("r").namespace # => "http://www.example.com/ns"
//}...