るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.009秒)
トップページ > クエリ:xpath[x] > クエリ:Transitive[x]

別のキーワード

  1. rexml/document xpath
  2. xpath first
  3. xpath match
  4. xpath each
  5. element xpath

ライブラリ

検索結果

REXML::Formatters::Transitive (18036.0)

XMLドキュメントをテキストの内容を変えずに 多少の整形を加えて出力するクラスです。

...quire '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
output = StringIO.new
transitive
_formatter.write(doc, output)
output.string
# =>...
...>> <root
# >> ><children
# >> >
# >> <grandchildren foo='bar'
# >> />
# >> </children
# >> ></root
# >> >

output = StringIO.new
transitive
_formatter.write(REXML::XPath.first(doc, "/root/children"), output)
output.string
# => "<children\n>\n<grandchildren foo='bar'\n />\n</children\n>"
//}...