function xml_to_json_features($input) {
libxml_use_internal_errors(true); // without that, we get PHP Warnings if the $input is not well-formed
$xml = new SimpleXMLElement($input); // input
+ if (!ctype_space((string) $xml)) { // there must not be anythin except sub-elements or whitespace
+ throw new Exception('Die Landkarte enthält folgenden ungültigen Text: "' . trim($xml) . '".');
+ }
$json_features = array(); // output
$point_types = array('gasthaus', 'haltestelle', 'parkplatz', 'achtung', 'punkt');
$line_types = array('rodelbahn', 'gehweg', 'alternative', 'lift', 'anfahrt', 'linie');