П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
Поиск по сайту:

О проекте

     HTML & JavaScript
     XML & XSLT
     Unix Shell





Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 164 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 93002 раз(а).

Учебник HTML.
Просмотров 81557 раз(а).

Руководство по PHP5.
Просмотров 51918 раз(а).

Хостинг через призму DNS.
Просмотров 60363 раз(а).

Подборка текстов стандартных документов.
Просмотров 50541 раз(а).

Учебник PHP - Самоучитель
Просмотров 57879 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 59380 раз(а).

Внешние атаки...
Просмотров 48929 раз(а).

Учебник PHP.
Просмотров 42429 раз(а).

SSI в примерах.
Просмотров 32721 раз(а).

| Добавить в избранное | Сделать стартовой | Помощь

Руководство по PHP
Пред. След.


(PHP 4 >= 4.0.1, PECL)

yaz_record -- Returns a record


string yaz_record ( resource id, int pos, string type )

The yaz_record() function inspects a record in the current result set at the position specified by parameter pos.

Список параметров


The connection resource returned by yaz_connect().


The record position. Records positions in a result set are numbered 1, 2, ... $hits where $hits is the count returned by yaz_hits().


The type specifies the form of the returned record.

Замечание: It is the application which is responsible for actually ensuring that the records are returned from the Z39.50/SRW server in the proper format. The type given only specifies a conversion to take place on the client side (in PHP/YAZ).

Besides conversion of the transfer record to a string/array, PHP/YAZ it is also possible to perform a character set conversion of the record. Especially for USMARC/MARC21 that is recommended since these are typically returned in the character set MARC-8 that is not supported by browsers, etc. To specify a conversion, add ; charset=from, to where from is the original character set of the record and to is the resulting character set (as seen by PHP).


The record is returned as a string for simple display. In this mode, all MARC records are converted to a line-by-line format since ISO2709 is hardly readable. XML records and SUTRS are returned in their original format. GRS-1 are returned in a (ugly) line-by-line format.

This format is suitable if records are to be displayed in a quick way - for debugging - or because it is not feasible to perform proper display.


The record is returned as an XML string if possible. In this mode, all MARC records are converted to MARCXML. XML records and SUTRS are returned in their original format. GRS-1 is not supported.

This format is similar to string except that MARC records are converted to MARCXML

This format is suitable if records are processed by an XML parser or XSLT processor afterwards.


The record is returned as a string in its original form. This type is suitable for MARC, XML and SUTRS. It does not work for GRS-1.

MARC records are returned as a ISO2709 string. XML and SUTRS are returned as strings.


The syntax of the record is returned as a string, i.e. USmarc, GRS-1, XML, etc.


The name of database associated with record at the position is returned as a string.


The record is returned as an array that reflects the GRS-1 structure. This type is suitable for MARC and GRS-1. XML, SUTRS are not supported and if the actual record is XML or SUTRS an empty string will be returned.

The array returned consists of a list corresponding to each leaf/internal node of GRS-1. Each list item consists a sub list with first element path and data (if data is available).

The path which is a string holds a list of each tree component (of the structured GRS-1 record) from root to leaf. Each component is a tag type, tag value pair of the form (type, value

String tags normally has a corresponding tag type 3. MARC can also be returned as an array (they are converted to GRS-1 internally).

Возвращаемые значения

Returns the record at position pos or an empty string if no record exists at the given position.

If no database record exists at the given position an empty string is returned.


Пример 1. Array for GRS-1 record

Consider this GRS-1 record:
(4,52)Robert M. Pirsig
(2,7)Transworld Publishers, ltd.
This record has two nodes at root level. First element at root level is (4,52) [tag type 4, tag value 52], and has data Robert M. Pirsig. Second element at root level (4,70) has a subtree with a single element (4,90). (4,90) has yet another sub tree (2,7) with data Transworld Publishers, ltd..

If this record is present at position $p, then

= yaz_record($id, $p, "array");

will output:
[0] => Array
[0] => (4,52)
[1] => Robert M. Pirsig
[1] => Array
[0] => (4,70)
[2] => Array
[0] => (4,70)(4,90)
[3] => Array
[0] => (4,70)(4,90)(2,7)
[1] => Transworld Publishers, ltd.

Пример 2. Working with MARCXML

The following PHP snippet returns a MARC21/USMARC record as MARCXML. The original record is returned in marc-8 (unknown to most XML parsers), so we convert it to UTF-8 (which all XML parsers must support).
= yaz_record($id, $p, "xml; charset=marc-8,utf-8");

The record $rec can be processed with the Sablotron XSLT processor as follows:


= 'display.xsl';
$processor = xslt_create();
$parms = array('/_xml' => $rec);
$res = xslt_process($processor, 'arg:/_xml', $xslfile, NULL, $parms);
$res = preg_replace("'</?html[^>]*>'", '', $res);


For PHP 5 the XSL extension must be used instead of Sablotron XSLT.

Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:

Copyright © 2005-2016 Project.Net.Ru