Moved default namespace into Oga::XML

The default namespace is now located at Oga::XML::DEFAULT_NAMESPACE
instead of Oga::XML::Attribute::DEFAULT_NAMESPACE.
This commit is contained in:
Yorick Peterse 2015-03-26 00:35:28 +01:00
parent 5802d9d62c
commit 68ada997a8
4 changed files with 15 additions and 12 deletions

View File

@ -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'

View File

@ -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
#

View File

@ -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

View File

@ -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