Skip to content
Ruby RDF/XML reader/writer for RDF.rb.
Find file
New pull request

RDF::RDFXML reader/writer

RDF/XML reader/writer for RDF.rb.

Gem Version Build Status


RDF::RDFXML is an RDF/XML reader/writer for Ruby using the RDF.rb library suite.


RDF::RDFXML parses RDF/XML into statements or triples and serializes triples, statements or graphs. It also serializes graphs to RDF/XML.

Fully compliant RDF/XML parser and serializer.

Install with gem install rdf-rdfxml

  • 100% free and unencumbered public domain software.
  • Implements a complete parser for RDF/XML.
  • Compatible with Ruby >= 1.9.2.


Instantiate a parser and parse source, specifying type and base-URL"./etc/doap.xml") do |reader|
  reader.each_statement do |statement|
    puts statement.inspect

Define xml:base and xmlns definitions, and use for serialization using :base_uri an :prefixes options.

Canonicalize and validate using :canonicalize and :validate options.

Write a graph to a file:"etc/test.ttl") do |writer|
   writer << graph



Full documentation available on

Principle Classes

  • {RDF::RDFXML::Format}
  • {RDF::RDFXML::Reader}
  • {RDF::RDFXML::Writer}

Additional vocabularies

  • {RDF::XML}


  • Consider a SAX-based parser for improved performance





This repository uses Git Flow to mange development and release activity. All submissions must be on a feature branch based on the develop branch to ease staging and integration.

  • Do your best to adhere to the existing coding conventions and idioms.
  • Don't use hard tabs, and don't leave trailing whitespace on any line.
  • Do document every method you add using YARD annotations. Read the tutorial or just look at the existing code for examples.
  • Don't touch the .gemspec, VERSION or AUTHORS files. If you need to change them, do so on your private branch only.
  • Do feel free to add yourself to the CREDITS file and the corresponding list in the the README. Alphabetical order applies.
  • Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an explicit public domain dedication on record from you.


This is free and unencumbered public domain software. For more information, see or the accompanying {file:UNLICENSE} file.


Something went wrong with that request. Please try again.