The dreaded Bandersnatch of CONTENTdm API coding is compound objects, because of the complexity of the data types that can be compound objects.

API: dmGetCompoundObjectInfo

INVOKED: <server address>/dmwebservices/index.php?q=dmGetCompoundObjectInfo/<collection>/<pointer>/xml

EXAMPLE: https://server16614.contentdm.oclc.org/dmwebservices/index.php?q=dmGetCompoundObjectInfo/p16614coll12/2/xml

The first difficulty in working with compound objects is the different encoding schema. Consider a simple postcard:



sharing the same structure as a Document type:


      <pagetitle>Front Cover</pagetitle>
      <pagetitle>AIFF File</pagetitle>
      <pagetitle>MIDI File</pagetitle>
      <pagetitle>MP3 File</pagetitle>
      <pagetitle>Whole Score</pagetitle>


By contrast, the Monograph type adds <node> and <nodetitle> elements, which allow chapters, etc.

         A map for a maze: Illinois' system of funding residential schools: a report to the General Assembly
         <pagetitle>Font Cover</pagetitle>
         <pagetitle>Title Page</pagetitle>



This program will get the various and sundry bits of the XML record, no matter its structure. The important bit that we’re grabbing is the page pointer, which will allow us to get the thumbnail or full sized image (or digital object) pointed to by the record.


$xmlData = file_get_contents('https://server16614.contentdm.oclc.org/dmwebservices/index.php?q=dmGetCompoundObjectInfo/isl/40168/xml');

// Create the document object

$xml = simplexml_load_string($xmlData);

$cpd = $xml->{"type"};
$title = $xml->{"node"}->{"nodetitle"};
$pointer = $xml->{"node"}->{"page"}[0]->{"pageptr"};

$result = array();

// Get the <page> nodes and loop them

if ($cpd == "Monograph") {
        foreach ($xml->xpath('//node') as $record) {
                foreach ($record->xpath('//page') as $page) {
                        $result[] = array(
                                'nodeTitle' => (string) $record->nodetitle,
                                'pageTitle' => (string) $page->pagetitle,
                                'pageFile' => (string) $page->pagefile,
                                'pagePtr' => (string) $page->pageptr
else {
foreach ($xml->xpath('//page') as $record) {
                $result[] = array(
                        'nodeTitle' => "NONE",
                        'pageTitle' => (string) $record->pagetitle,
                        'pageFile' => (string) $record->pagefile,
                        'pagePtr' => (string) $record->pageptr

// $resultCount is the number of elements in the $result array; the first element is result[0]

$resultCount = count($result) - 1;

$oldNodeTitle = "";

for ($i=0;$i<=$resultCount;$i++) {
        $nodeTitleStr = $result[$i]["nodeTitle"];
        $pageTitleStr = $result[$i]["pageTitle"];
        $jpegStr = $result[$i]["pageFile"];
        $pointer = $result[$i]["pagePtr"];
        if ($oldNodeTitle != $nodeTitleStr) { echo "NODE TITLE: $nodeTitleStr\n"; }
        $oldNodeTitle = $nodeTitleStr;
        echo "$pageTitleStr $jpegStr $pointer\n";