Cacofonix::DTDs provides an XML catalog for locally accessible ONIX 2.0 and 2.1 DTDs.
This is important in order to parse ONIX files correctly and reliably given that the original DTDs are no longer online.
This gem was published for use by Cacofonix, a complete ONIX mapping gem. Cacofonix will use these DTDs automatically, no extra configuration required.
You can also use it directly with Nokogiri or any other libxml-based system. For this, see the installation and usage instructions below.
Add this line to your application's Gemfile
:
gem "cacofonix-dtds"
And then execute:
$ bundle
Or install it yourself as:
$ gem install cacofonix-dtds
To set the XML_CATALOG_FILES
environment variable to the XML catalog file:
require "cacofonix/dtds"
Cacofonix::DTDs.apply_libxml_env!
# Do your nokogiri parsing here
If you want to clean up your environment afterwards:
require "cacofonix/dtds"
env_value = nil
Cacofonix::DTDs.apply_libxml_env! { |previous_value| env_value = previous_value }
# Do your nokogiri parsing here
ENV[Cacofonix::DTDs.libxml_env_key] = env_value
Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Cacofonix::DTDs codebase, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.