Can you parse JSON with the eXist database?
Ted Hickox <[email protected]> Sun, 18 Aug 2024 11:25:28 -0500
| Newsgroups | gmane.text.xml.exist |
|---|---|
| Message-ID | <CAAsp6Cb7x5T4JPfHwicpcd4SXSLZydngxD1w9c55wpC2NLBApg@mail.gmail.com> |
If it's possible to parse JSON with the eXist database, why is the
following code retrieving any data from my JSON document:
JSON Example.xhtml
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>First JSON Experiment</title>
<link rel="stylesheet" type="text/css" href="
http://localhost:8080/exist/rest/db/apps/HTML_Student/JSON_Example.css"/>
<script language="javascript" src="
http://localhost:8080/exist/rest/db/apps/HTML_Student/JSON_Example.js"/>
</head>
<body onload = "Setup()">
<input type = "text" id = "JSON_Text">
</input>
</body>
</html>
JSON Example.css
#JSON_Text {
position: absolute;
top: 200px;
left: 300px;
height: 25px;
width: 300px;
}
JSON Example.js
function Setup() {
var XMLHttp;
var JSON_Data;
XMLHttp = new XMLHttpRequest();
XMLHttp.onreadystatechange = function () {
if(XMLHttp.readyState == 4){
JSON_Data = JSON.parse(XMLHttp.responseText);
}
};
XMLHttp.open("Get", "
http://localhost:8080/exist/rest/db/apps/HTML_Student/people.json", true);
XMLHttp.send();
document.getElementById("JSON_Text").value = JSON_Data;
}
People.json
{
"People":{
{
"name": "Alex",
"online": true
},
{
"name": "Billy",
"online": false
}
}
}
_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open