n@1107: '); n@1107: if (is_array($saves)) n@1107: { n@1107: foreach($saves as $filename) { n@1107: $xml_string = file_get_contents($filename, FILE_TEXT); n@1107: $xml_object = simplexml_load_string($xml_string); n@1107: $test_struct = $comment_struct->addChild("test"); n@1107: if ($xml_object == false) { n@1107: echo "

FATAL

could not parse file ".$filename.": "; n@1107: foreach(libxml_get_errors() as $error) { n@1107: echo "
", $error->message; n@1107: } n@1107: } else { n@1107: // Iterate over each audioHolder node n@1107: foreach($xml_object->page as $pageInstance) n@1107: { n@1107: $page_struct = $test_struct->addChild("page"); n@1107: // Get the page-id and attach n@1107: $page_struct->addAttribute("page-id",$pageInstance['id']); n@1107: n@1107: // Get the audioelements of the page n@1107: foreach($pageInstance->audioelement as $fragment) n@1107: { n@1107: $fragment_struct = $page_struct->addChild("audioelement"); n@1107: // Get the element-id and attach n@1107: $page_struct->addAttribute("element-id",$fragment['id']); n@1107: $page_struct->addAttribute("presented-id",$fragment['presentedId']); n@1107: $page_struct->addAttribute("url",$fragment['url']); n@1107: // Append the comment data n@1107: echo "

Comment: ".$fragement->comment."

"; n@1107: $comment = $fragment_struct->addChild("comment"); n@1107: } n@1107: } n@1107: } n@1107: } n@1107: // Now we have a sub containing all comment data n@1107: echo $comment_struct->asXML(); n@1107: } else { n@1107: echo "FATAL - No saved XML files discovered"; n@1107: } n@1107: ?>