summaryrefslogtreecommitdiff
path: root/lib/rexml/element.rb
diff options
context:
space:
mode:
authorser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-02 12:18:07 +0000
committerser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-02 12:18:07 +0000
commit07d9346ded3dccc825c320316fe23e088d782f5e (patch)
tree61facf427f0288270730a064ac30b8e59852af1a /lib/rexml/element.rb
parentdf067e31c0cc3ced138b0f53767cfd458c7a5fc0 (diff)
* Fixes a bug in the pretty printer related to an incomplete refactoring.
* Fixes another bug related to the formatting code refactoring in 3.1.7 * Fixes ticket:99, and adds Henrik's unit test (with minor modifications) * Fixes ticket:102. Fix provided by kevinj -- thanks! Great job. * Implements namespace validation in the baseparser. This means that, as per the XML namespace spec, unbound prefixes generate UndefinedNamespaceException. Also, as per the namespace spec, the 'xml' prefix must be bound to http://www.w3.org/XML/1998/namespace, and the 'xmlns' prefix must not be declared. in the XML. * Eggbeater missed one. * Fix for ticket:115 * Fixes a bug in the pretty printer related to an incomplete refactoring. * Merge code cleanups * Fixes another bug related to the formatting code refactoring in 3.1.7 * Indentation fix. * r1342@bean (orig r12846): nobu | 2007-07-25 17:18:55 -0400 * lib/rexml/formatters/*.rb: set properties. * r1358@bean (orig r12883): nobu | 2007-08-06 04:36:31 -0400 * lib/rexml/encodings/{ISO-8859-15,CP-1252}.rb: fixed invalid syntax. * r1359@bean (orig r13096): nobu | 2007-08-18 02:03:45 -0400 * lib/rexml/rexml.rb: removed doubled constant. * r1360@bean (orig r13097): nobu | 2007-08-18 02:12:48 -0400 * lib/rexml/rexml.rb: added encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@13600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/element.rb')
-rw-r--r--lib/rexml/element.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb
index f757cfffa8..92612036a1 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -553,6 +553,7 @@ module REXML
def attribute( name, namespace=nil )
prefix = nil
prefix = namespaces.index(namespace) if namespace
+ prefix = nil if prefix == 'xmlns'
attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" )
end
@@ -854,15 +855,15 @@ module REXML
# Source (see Element.initialize). If not supplied or nil, a
# new, default Element will be constructed
# Returns:: the added Element
- # a = Element.new 'a'
- # a.elements.add Element.new 'b' #-> <a><b/></a>
- # a.elements.add 'c' #-> <a><b/><c/></a>
+ # a = Element.new('a')
+ # a.elements.add(Element.new('b')) #-> <a><b/></a>
+ # a.elements.add('c') #-> <a><b/><c/></a>
def add element=nil
rv = nil
if element.nil?
- Element.new "", self, @element.context
+ Element.new("", self, @element.context)
elsif not element.kind_of?(Element)
- Element.new element, self, @element.context
+ Element.new(element, self, @element.context)
else
@element << element
element.context = @element.context