Loading an XRD file

XRD .xml files may be loaded directly from a file, or from a string:

Loading an XRD file

<?php
try {
   
$xrd->loadFile('/path/to/the/file.xrd''xml');
} catch (
XML_XRD_Exception $e) {
   die(
'Loading XRD file failed: ' $e->getMessage() . "\n");
}
?>

Loading an XRD string

<?php
try {
   
$xrd->loadString($fullXrdXmlHere'xml');
} catch (
XML_XRD_Exception $e) {
   die(
'Loading XRD failed: ' $e->getMessage() . "\n");
}
?>

XML_XRD tries to autodetect if the file is XML or JSON (JRD) and use the correct loader. You can make its life easier (and skip autodetection, and reduce network load) by passing the type parameter:

Loading a JRD file

<?php
try {
   
$xrd->loadFile('/path/to/the/file.jrd''json');
} catch (
XML_XRD_Exception $e) {
   die(
'Loading JRD file failed: ' $e->getMessage() . "\n");
}
?>