RelatonIana: Ruby XMLDOC impementation.

gem install relaton-iana -v 1.9.2



RelatonIana is a Ruby gem that implements the IsoBibliographicItem model.

You can use it to retrieve metadata of W3C Standards from, and access such metadata through the BibliographicItem object.


Add this line to your application’s Gemfile:

gem 'relaton-iana'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install relaton-iana


Search for a standard using keywords

require 'relaton_iana'
=> true

item = RelatonIana::IanaBibliography.get "IANA service-names-port-numbers"
[relaton-iana] ("IANA service-names-port-numbers") fetching...
[relaton-iana] ("IANA service-names-port-numbers") found IANA service-names-port-numbers
=> #<RelatonBib::BibliographicItem:0x00007f7c6cc024d0

XML serialization

=> "<bibitem id="IANAservice-names-port-numbers" type="standard">
  <title format="text/plain">Service Name and Transport Protocol Port Number Registry</title>
  <uri type="src"></uri>
  <docidentifier type="IANA">IANA service-names-port-numbers</docidentifier>
  <date type="updated">
    <role type="publisher"/>
      <name>Internet Assigned Numbers Authority</name>

Each IANA document has src type link.
=> "src"
=> #<Addressable::URI:0x9ec URI:>

Create bibliographic item from XML

=> #<RelatonBib::BibliographicItem:0x00007f7c6b837248

Create bibliographic item from YAML

hash = YAML.load_file 'spec/fixtures/service-names-port-numbers.yaml'
=> {"id"=>"IANAservice-names-port-numbers",
 "title"=>{"content"=>"Service Name and Transport Protocol Port Number Registry", "format"=>"text/plain"},

bib_hash = RelatonIana::HashConverter.hash_to_bib hash
=> {:id=>"IANAservice-names-port-numbers",
 :title=>{:content=>"Service Name and Transport Protocol Port Number Registry", :format=>"text/plain"},
... **bib_hash
=> #<RelatonBib::BibliographicItem:0x007f9381ec6a00

Fetch data

There is a IANA dataset which can be converted into RelatonXML/BibXML/BibYAML formats.

The method RelatonIana::DataFetcher.fetch(output: "data", format: "yaml") converts all the documents from the dataset and save them to the ./data folder in YAML format. Arguments:

  • output - folder to save documents (default './data').

  • format - format in which the documents are saved. Possimle formats are: yaml, xml, bibxml (default yaml).

Started at: 2021-11-19 13:32:05 +0100
Stopped at: 2021-11-19 13:34:40 +0100
Done in: 155 sec.
=> nil

This method uses GitHub search API to fetch the documents. The search API has a rate limitaion of 30 requests per minute for authenticated users and 10 requests per minute for unauthenticated users. Usually, the rate limit is not reached because the search API is used only for the files list fetching. But if you run the method multiple times in a short period, it is possible that the rate limit will be reached. In this case, the method will wait until the rate limit is reset.

You can use pesonal access token to increase the rate limit. To do this, add your pesonal access token to the GITHUB_TOKEN environment variable.


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to [](


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the [MIT License](