i am trying to show a turtle file on a very simple homepage i made.
<p class="lead" id="testbed-meta">
<script>
$.ajax({
cache: false,
type: "GET",
async: false,
url: "/native/api/resources/turtle",
success: function(data,status){
document.getElementById("testbed-meta").innerHTML = data;
},
error: function(xhl,status){
document.getElementById("testbed-meta").innerHTML = "Error";
},
statusCode:{
201: function(){
alert("Error");
}
}
});
</script>
HTML don't understand that it's turtle and makes it to one long String without line brakes and also deletes some parts. Maybe because there are some "<" and ">" that are not escaped.
Is there a nice way to show a ttl file via html and maybe javascript?
EDIT: By the way, i forgot to say that i get something like this in the answer:
@prefix omn-federation: <http://open-multinet.info/ontology/omn-federation#> .
But HTML don't show the "http:/....." part. Only:
@prefix omn-federation: .
Maybe because of the "<" and ">" ?!
\@prefix omn-federation:
\@prefix rdf:
I used the .text and then then the .replace Method, but now i have "
" tags in my text and still no line brakes. With
` which should not be escaped and other tags which should be... See my edited answer – ben Jul 02 '15 at 14:01