RIF-CS XML parser in Ruby
This is currently a work in progress.
This is a parser for parsing the Registry Interchange Format - Collections and Services (RIF-CS) XML format in Ruby. The parser takes takes in the XML parsed by REXML, performs schema validation on it, and produces objects to represent the data.
An XML document is parsed into an object that can easily be walked by code. The methods on that object match the names of the attribute and content model of the XML document as much as possible.
Elements are represented by a method with the same name as the element.
<person id="24601">
<name>John Citizen</name>
<email>[email protected]</name>
<dob>1970-01-01</dob>
</person>
person.id
person.name
person.email
person.dob
If the element is non-repeatable (i.e. maxOccurs
is 1) the method
returns an object representing it, or nil
if the element is not
present.
If the element is repeatable (i.e. maxOccurs
is greater than one or
is unbounded) the method always returns an array. If the element
is not present, an empty array is returned.
Attributes are represented by a method with the same name as the attribute.
If the attribute is not present, the value will be nil
.
Repeating element are represented as Ruby Arrays.
person.email is an array
email.type
email._value
- Registry Interchange Format - Collections and Services (RIF-CS) http://www.ands.org.au/resource/rif-cs.html