summaryrefslogtreecommitdiffstats
path: root/lib/rexml/element.rb
diff options
context:
space:
mode:
authorser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-23 15:44:30 +0000
committerser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-23 15:44:30 +0000
commit73fca1e1868fd8e7b3874cf644d88a8d1134eb04 (patch)
treeb2ee8d4e0c6f78c96cfa26c1d2a754e12fc82151 /lib/rexml/element.rb
parentdc5a8c07f65ac4a8a8542ac59b13cd8a130d8061 (diff)
downloadruby-73fca1e1868fd8e7b3874cf644d88a8d1134eb04.tar.gz
ruby-73fca1e1868fd8e7b3874cf644d88a8d1134eb04.tar.xz
ruby-73fca1e1868fd8e7b3874cf644d88a8d1134eb04.zip
* Non-String attributes are now converted to Strings; this means code such as
elem.attributes["a"] = 1 will not cause an error when dumping the XML. It also means that: elem.attributes["a"] # => "1", not 1 * Transitive indenting has been cleaned up. * Fixed a potential bug in parsing non-ASCII encoded streams * Fixed a bug where trying to fill in ParseException data was causing an IO error (stream closed) * Changes to Text mean that Element (and Text) can be used outside of a Document context. * In some rare cases, the base parser wasn't reading enough bytes from the stream for the parsing algorithm to work properly. This has been fixed (this was Ruby bug #48426) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/element.rb')
-rw-r--r--lib/rexml/element.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb
index aba57d708..40cac168b 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -635,7 +635,12 @@ module REXML
end unless @attributes.empty?
if @children.empty?
- writer << " " if ie_hack
+ if transitive and indent>-1
+ writer << "\n"
+ indent( writer, indent )
+ elsif ie_hack
+ writer << " "
+ end
writer << "/"
else
if transitive and indent>-1 and !@children[0].kind_of? Text
@@ -646,7 +651,7 @@ module REXML
write_children( writer, indent, transitive, ie_hack )
writer << "</#{expanded_name}"
end
- if transitive and indent>-1
+ if transitive and indent>-1 and !@children.empty?
writer << "\n"
indent -= 1 if next_sibling.nil?
indent(writer, indent)