diff --git a/lib/oga/xml/attribute.rb b/lib/oga/xml/attribute.rb index 9a227de..07c3666 100644 --- a/lib/oga/xml/attribute.rb +++ b/lib/oga/xml/attribute.rb @@ -21,6 +21,17 @@ module Oga class Attribute attr_accessor :name, :namespace_name, :element, :value + ## + # The default namespace available to all attributes. This namespace can + # not be modified. + # + # @return [Oga::XML::Namespace] + # + DEFAULT_NAMESPACE = Namespace.new( + :name => 'xml', + :uri => XML::DEFAULT_NAMESPACE.uri + ).freeze + ## # @param [Hash] options # diff --git a/lib/oga/xml/default_namespace.rb b/lib/oga/xml/default_namespace.rb index fab44b4..b486766 100644 --- a/lib/oga/xml/default_namespace.rb +++ b/lib/oga/xml/default_namespace.rb @@ -6,7 +6,7 @@ module Oga # @return [Oga::XML::Namespace] # DEFAULT_NAMESPACE = Namespace.new( - :name => 'xml', + :name => 'xmlns', :uri => 'http://www.w3.org/XML/1998/namespace' ).freeze end # XML diff --git a/spec/oga/xml/attribute_spec.rb b/spec/oga/xml/attribute_spec.rb index 0afc4b5..686e1bf 100644 --- a/spec/oga/xml/attribute_spec.rb +++ b/spec/oga/xml/attribute_spec.rb @@ -33,7 +33,7 @@ describe Oga::XML::Attribute do end it 'returns the default XML namespace when the "xml" prefix is used' do - @default.namespace.should == Oga::XML::DEFAULT_NAMESPACE + @default.namespace.should == Oga::XML::Attribute::DEFAULT_NAMESPACE end end