Class MusicBrainz::Webservice::MBXML
In: lib/rbrainz/webservice/mbxml.rb
Parent: Object

Class to read the XML data returned by the MusicBrainz web service and create the corresponding model classes. The class understands the MusicBrainz XML Metadata Version 1.0 schema.

See musicbrainz.org/doc/MusicBrainzXMLMetaData for more information on the MusicBrainz XML Metadata schema.

Methods

Classes and Modules

Class MusicBrainz::Webservice::MBXML::ParseError

Public Class methods

Create a new MBXML instance to parse a MusicBrainz metadata document.

Parameters:

stream
An IO object to read the MusicBrainz metadata XML document from.
factory
A model factory. An instance of Model::DefaultFactory will be used if none is given.
Raises:MBXML::ParseError

Public Instance methods

Read the XML string and create an entity model for the given entity type if it is present in the document.

Returns nil if no entity of the given type is present.

Read the XML string and create a list of entity models for the given entity type. The list is returned as a Model::ScoredCollection. There must be an entity-list element as a child of the metadata element in the document.

Returns an empty Model::ScoredCollection if the list is empty or if no entity-list element can be found.

[Validate]