Distinguish default attribute/element namespaces

The previous commit messed this up because I wasn't fully awake.
This commit is contained in:
Yorick Peterse 2015-03-26 00:43:50 +01:00
parent 68ada997a8
commit f2d69af33b
3 changed files with 13 additions and 2 deletions

View File

@ -21,6 +21,17 @@ module Oga
class Attribute class Attribute
attr_accessor :name, :namespace_name, :element, :value 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 # @param [Hash] options
# #

View File

@ -6,7 +6,7 @@ module Oga
# @return [Oga::XML::Namespace] # @return [Oga::XML::Namespace]
# #
DEFAULT_NAMESPACE = Namespace.new( DEFAULT_NAMESPACE = Namespace.new(
:name => 'xml', :name => 'xmlns',
:uri => 'http://www.w3.org/XML/1998/namespace' :uri => 'http://www.w3.org/XML/1998/namespace'
).freeze ).freeze
end # XML end # XML

View File

@ -33,7 +33,7 @@ describe Oga::XML::Attribute do
end end
it 'returns the default XML namespace when the "xml" prefix is used' do 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
end end