Google

NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ ">

ZOOM::record

A ZOOM::record object represents a chunk of data from a resultSet returned from a server.

The class has this declaration:


    class record {
    public:
      ~record ();
      enum syntax {
	UNKNOWN, GRS1, SUTRS, USMARC, UKMARC, XML
      };
      record *clone () const;
      syntax recsyn () const;
      const char *render () const;
      const char *rawdata () const;
    };
  

Records returned from Z39.50 servers are encoded using a record syntax: the various national MARC formats are commonly used for bibliographic data, GRS-1 or XML for complex structured data, SUTRS for simple human-readable text, etc. The record::syntax enumeration specifies constants representing common record syntaxes, and the recsyn() method returns the value corresponding to the record-syntax of the record on which it is invoked.

The simplest thing to do with a retrieved record is simply to render() it. This returns a human-readable, but not necessarily very pretty, representation of the contents of the record. This is useful primarily for testing and debugging, since the application has no control over how the record appears. (The application must not delete the returned string - it is ``owned'' by the record object.)

More sophisticated applications will want to deal with the raw data themselves: the rawdata() method returns it. Its format will vary depending on the record syntax: SUTRS, MARC and XML records are returned ``as is'', and GRS-1 records as a pointer to their top-level node, which is a Z_GenericRecord structure as defined in the <yaz/z-grs.h> header file. (The application must not delete the returned data - it is ``owned'' by the record object.)

Perceptive readers will notice that there are no methods for access to individual fields within a record. That's because the different record syntaxes are so different that there is no even a uniform notion of what a field is across them all, let alone a sensible way to implement such a function. Fetch the raw data instead, and pick it apart ``by hand''.