Example #1
0
function caEscapeForXML($ps_text)
{
    $ps_text = caMakeProperUTF8ForXML($ps_text);
    $ps_text = str_replace("&", "&", $ps_text);
    $ps_text = str_replace("<", "&lt;", $ps_text);
    $ps_text = str_replace(">", "&gt;", $ps_text);
    $ps_text = str_replace("'", "&apos;", $ps_text);
    return str_replace("\"", "&quot;", $ps_text);
}
 * ----------------------------------------------------------------------
 *
 * Software by Whirl-i-Gig (http://www.whirl-i-gig.com)
 * Copyright 2010-2015 Whirl-i-Gig
 *
 * For more information visit http://www.CollectiveAccess.org
 *
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * This source code is free and modifiable under the terms of
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
require_once __CA_APP_DIR__ . "/helpers/utilityHelpers.php";
$vo_rest_server = $this->getVar("rest_server");
try {
    $vs_return = $vo_rest_server->handle();
} catch (Exception $e) {
    print "Couldn't build XML. Exception was: " . $e->getMessage();
}
header('Content-Type: text/xml; charset=UTF-8');
print caMakeProperUTF8ForXML($vs_return);