n@519: ');
n@519: if (is_array($saves))
n@519: {
n@519: foreach($saves as $filename) {
n@519: $xml_string = file_get_contents($filename, FILE_TEXT);
n@519: $xml_object = simplexml_load_string($xml_string);
n@519: $test_struct = $comment_struct->addChild("test");
n@519: if ($xml_object == false) {
n@519: echo "
FATAL
could not parse file ".$filename.": ";
n@519: foreach(libxml_get_errors() as $error) {
n@519: echo "
", $error->message;
n@519: }
n@519: } else {
n@519: // Iterate over each audioHolder node
n@519: foreach($xml_object->page as $pageInstance)
n@519: {
n@519: $page_struct = $test_struct->addChild("page");
n@519: // Get the page-id and attach
n@519: $page_struct->addAttribute("page-id",$pageInstance['id']);
n@519:
n@519: // Get the audioelements of the page
n@519: foreach($pageInstance->audioelement as $fragment)
n@519: {
n@519: $fragment_struct = $page_struct->addChild("audioelement");
n@519: // Get the element-id and attach
n@519: $page_struct->addAttribute("element-id",$fragment['id']);
n@519: $page_struct->addAttribute("presented-id",$fragment['presentedId']);
n@519: $page_struct->addAttribute("url",$fragment['url']);
n@519: // Append the comment data
n@519: echo "Comment: ".$fragement->comment."
";
n@519: $comment = $fragment_struct->addChild("comment");
n@519: }
n@519: }
n@519: }
n@519: }
n@519: // Now we have a sub containing all comment data
n@519: echo $comment_struct->asXML();
n@519: } else {
n@519: echo "FATAL - No saved XML files discovered";
n@519: }
n@519: ?>