aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rexml/document.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-03 03:53:09 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-03 03:53:09 +0000
commit3f817764e24eb05aceef884e213d4a7043c292fa (patch)
tree165579f07248ac404674563c5fc9d1bfec863683 /lib/rexml/document.rb
parent69eedf6a18d0c21b06d30ec4bc4a550d4ac125dd (diff)
downloadruby-3f817764e24eb05aceef884e213d4a7043c292fa.tar.gz
* lib/rexml/document.rb (REXML::Document#write): Document encoding
option. Now different encoding between XML file's encoding and XML declaration's encodiong is support. [Feature #4872] (work in progress) * lib/rexml/xmldecl.rb (REXML::XMLDecl#write): Always use XMLDecl's encoding. * test/rexml/test_document.rb: Update tests for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/document.rb')
-rw-r--r--lib/rexml/document.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb
index 5508a60be4..f9fdbdaab3 100644
--- a/lib/rexml/document.rb
+++ b/lib/rexml/document.rb
@@ -145,8 +145,8 @@ module REXML
end
# :call-seq:
- # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false)
- # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false})
+ # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil)
+ # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil})
#
# Write the XML tree out, optionally with indent. This writes out the
# entire XML document, including XML declarations, doctype declarations,
@@ -199,6 +199,10 @@ module REXML
# unable to parse proper XML, we have to provide a hack to generate XML
# that IE's limited abilities can handle. This hack inserts a space
# before the /> on empty tags. Defaults to false
+ # encoding::
+ # Encoding name as String. Change output encoding to specified encoding
+ # instead of encoding in XML declaration.
+ # Defaults to nil. It means encoding in XML declaration is used.
def write(*arguments)
if arguments.size == 1 and arguments[0].class == Hash
options = arguments[0]