Skip to content

Commit 455d39d

Browse files
committed
docs: Update README
1 parent 6a2c88f commit 455d39d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,34 @@ composer require scriptotek/marc dev-master
2222

2323
## Reading records
2424

25-
Records are loaded into a `Collection` object using
26-
`Collection::fromFile` or `Collection::fromStringString`,
27-
which autodetects if the data is Binary MARC or XML:
25+
Use `Collection::fromFile` or `Collection::fromString` to read one or more
26+
MARC records from a file or string. The methods autodetect if the data is
27+
Binary MARC or XML (namespaced or not).
2828

2929
```php
3030
use Scriptotek\Marc\Collection;
3131

3232
$collection = Collection::fromFile($someFileName);
3333
foreach ($collection->records as $record) {
34-
echo $record->getField('250')->getSubfield('a') . "\n";
34+
echo $record->getField('250')->getSubfield('a')->getData() . "\n";
3535
}
3636
```
3737

38-
The package will extract MARC records from any container XML,
39-
so you can load an SRU or OAI-PMH response directly:
38+
The package can extract MARC records from any container XML, so you can load
39+
an SRU or OAI-PMH response directly:
4040

4141
```php
42-
$response = file_get_contents('http://lx2.loc.gov:210/lcdb?' . http_build_query(array(
43-
'operation' => 'searchRetrieve',
44-
'recordSchema' => 'marcxml',
45-
'version' => '1.1',
42+
$response = file_get_contents('http://lx2.loc.gov:210/lcdb?' . http_build_query([
43+
'operation' => 'searchRetrieve',
44+
'recordSchema' => 'marcxml',
45+
'version' => '1.1',
4646
'maximumRecords' => '10',
47-
'query' => 'bath.isbn=0761532692',
48-
)));
47+
'query' => 'bath.isbn=0761532692',
48+
]));
4949

5050
$collection = Collection::fromString($response);
5151
foreach ($collection->records as $record) {
52-
echo $record->getField('245')->getSubfield('a') . "\n";
52+
...
5353
}
5454

5555
```

0 commit comments

Comments
 (0)