diff --git a/lib/kml/container.rb b/lib/kml/container.rb index 5c914de..927d68c 100644 --- a/lib/kml/container.rb +++ b/lib/kml/container.rb @@ -1,11 +1,11 @@ module KML # A Container is an abstract base class that holds one or more Features and allows the creation of nested hierarchies. class Container < Feature - + # Access the features in the container attr_accessor :features attr_accessor :plain_children - + # Get the features in the container def features @features ||= [] diff --git a/lib/kml_file.rb b/lib/kml_file.rb index 0e2796f..a2d7dc5 100644 --- a/lib/kml_file.rb +++ b/lib/kml_file.rb @@ -19,7 +19,12 @@ def objects # Render the KML file def render(xm=Builder::XmlMarkup.new(:indent => 2)) xm.instruct! - xm.kml(:xmlns => 'http://earth.google.com/kml/2.1'){ + xmlnses = {} + xmlnses["xmlns".to_sym] = "http://www.opengis.net/kml/2.2" + xmlnses["xmlns:gx".to_sym] = "http://www.google.com/kml/ext/2.2" + xmlnses["xmlns:kml".to_sym] = "http://www.opengis.net/kml/2.2" + xmlnses["xmlns:atom".to_sym] = "http://www.w3.org/2005/Atom" + xm.kml(**xmlnses) { objects.each { |o| o.render(xm) } } end diff --git a/lib/ruby_kml.rb b/lib/ruby_kml.rb index 3af0e55..3c0c46a 100644 --- a/lib/ruby_kml.rb +++ b/lib/ruby_kml.rb @@ -1,4 +1,3 @@ -require 'rubygems' require 'builder' require 'kml_file' diff --git a/ruby_kml.gemspec b/ruby_kml.gemspec index e1ab6ba..6a53aaa 100644 --- a/ruby_kml.gemspec +++ b/ruby_kml.gemspec @@ -9,4 +9,6 @@ Gem::Specification.new do |s| s.has_rdoc = false s.authors = ["aeden, schleyfox, xaviershay, andykram, IanVaughan"] s.files = Dir['**/**'] + + s.add_runtime_dependency "builder" end