diff --git a/lib/oga.rb b/lib/oga.rb index 797fab7..b53f8da 100644 --- a/lib/oga.rb +++ b/lib/oga.rb @@ -34,6 +34,7 @@ require_relative 'oga/xml/xml_declaration' require_relative 'oga/xml/processing_instruction' require_relative 'oga/xml/doctype' require_relative 'oga/xml/namespace' +require_relative 'oga/xml/default_namespace' require_relative 'oga/xml/attribute' require_relative 'oga/xml/element' require_relative 'oga/xml/node_set' diff --git a/lib/oga/xml/attribute.rb b/lib/oga/xml/attribute.rb index d291c4f..9a227de 100644 --- a/lib/oga/xml/attribute.rb +++ b/lib/oga/xml/attribute.rb @@ -21,17 +21,6 @@ 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 => 'http://www.w3.org/XML/1998/namespace' - ).freeze - ## # @param [Hash] options # diff --git a/lib/oga/xml/default_namespace.rb b/lib/oga/xml/default_namespace.rb new file mode 100644 index 0000000..fab44b4 --- /dev/null +++ b/lib/oga/xml/default_namespace.rb @@ -0,0 +1,13 @@ +module Oga + module XML + ## + # The default XML namespace. + # + # @return [Oga::XML::Namespace] + # + DEFAULT_NAMESPACE = Namespace.new( + :name => 'xml', + :uri => 'http://www.w3.org/XML/1998/namespace' + ).freeze + end # XML +end # Oga diff --git a/spec/oga/xml/attribute_spec.rb b/spec/oga/xml/attribute_spec.rb index 686e1bf..0afc4b5 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::Attribute::DEFAULT_NAMESPACE + @default.namespace.should == Oga::XML::DEFAULT_NAMESPACE end end