Sha256: a89eaa68becabe89eff1ca0966bafa9ee109d42d4a0d356b1321ac38c0d362c6

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 Bytes

Contents

module ZCI
  def parse_section_xml(xml_file)
    doc = Nokogiri::XML.parse(xml_file)
    section_xml = doc.xpath("//section").first

    section = {
      id: section_xml[:id],
      category_id: section_xml[:category_id],
      name: section_xml.xpath('name').text,
      description: section_xml.xpath('description').text,
      position: section_xml[:position],
    }

    return section
  end

  def parse_article_xml(xml_file)
    doc = Nokogiri::XML.parse(xml_file)
    article_xml = doc.xpath('//article').first

    article = {
      id: article_xml[:id],
      section_id: article_xml[:section_id],
      title: article_xml.xpath('title').text,
      body: article_xml.xpath('body').text,
      position: article_xml[:position],
    }

    return article
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zci-0.0.5 lib/zci/export.rb
zci-0.0.4 lib/zci/export.rb
zci-0.0.3 lib/zci/export.rb
zci-0.0.2 lib/zci/export.rb
zci-0.0.1 lib/zci/export.rb