3 require_once(
'swordappstatemententry.php');
4 require_once(
'utils.php');
23 $this->sac_xml = $sac_thexml;
26 $this->sac_entries = array();
29 if ($sac_thexml !=
'') {
30 $sac_statement = @
new SimpleXMLElement($sac_thexml);
31 $sac_ns = $sac_statement->getNamespaces(
true);
32 if (!array_key_exists(
'atom', $sac_ns)) $sac_ns[
'atom'] =
'http://www.w3.org/2005/Atom';
33 if (!array_key_exists(
'sword', $sac_ns)) $sac_ns[
'sword'] =
'http://purl.org/net/sword/';
34 $sac_state = $sac_statement->children($sac_ns[
'sword'])->state;
35 if (!empty($sac_state)) {
36 $sac_state_attributes = $sac_state->attributes();
37 $this->sac_state_href = $sac_state_attributes[
'href'];
38 $this->sac_state_description = $sac_state->children($sac_ns[
'sword'])->stateDescription;
40 foreach ($sac_statement->children($sac_ns[
'atom'])->entry as $sac_entry) {
41 $sac_entry_scheme = $sac_entry_term = $sac_entry_label =
'';
42 $sac_category = $sac_entry->children($sac_ns[
'atom'])->category;
43 if (!empty($sac_category)) {
44 $sac_category_attributes = $sac_category->attributes();
45 $sac_entry_scheme = $sac_category_attributes[
'scheme'];
46 $sac_entry_term = $sac_category_attributes[
'term'];
47 $sac_entry_label = $sac_category_attributes[
'label'];
50 $sac_theentry =
new SWORDAPPStatementEntry($sac_entry_scheme, $sac_entry_term, $sac_entry_label);
52 $sac_content = $sac_entry->children($sac_ns[
'atom'])->content;
53 $sac_content_attributes = $sac_content->attributes();
54 $sac_theentry->addContent($sac_content_attributes[
'type'],
55 $sac_content_attributes[
'src']);
57 $sac_theentry->setPackaging($sac_entry->children($sac_ns[
'sword'])->packaging);
59 $sac_theentry->setDepositedOn($sac_entry->children($sac_ns[
'sword'])->depositedOn);
61 $sac_theentry->setDepositedBy($sac_entry->children($sac_ns[
'sword'])->depositedBy);
63 array_push($this->sac_entries, $sac_theentry);
69 print
' - State href: ' . $this->sac_state_href .
"\n";
70 print
' - State description: ' . $this->sac_state_description .
"\n";
71 foreach ($this->sac_entries as $sac_entry) {
72 $sac_entry->toString();