def test_valid_with_optional_elements
    @ws.page_margins.set :left => 9
    @ws.page_setup.set :fit_to_width => 1
    @ws.print_options.set :headings => true
    @ws.auto_filter.range = "A1:C3"
    @ws.merge_cells "A4:A5"
    @ws.add_chart Axlsx::Pie3DChart
    @ws.add_table "E1:F3"
    @ws.add_pivot_table  'G5:G6', 'A1:D10'
    schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
    doc = Nokogiri::XML(@ws.to_xml_string)
    assert(schema.validate(doc).map { |e| puts e.message; e }.empty?, schema.validate(doc).map { |e| e.message }.join('\n'))
  end
Make sure the XML for all optional elements (like pageMargins, autoFilter, ...)
is generated in correct order.