My Javascript refuses to open my XQuery
Ted Hickox <[email protected]> Wed, 17 Jul 2024 08:25:29 -0500
| Newsgroups | gmane.text.xml.exist |
|---|---|
| Message-ID | <CAAsp6CY4df_zHGcKG_RDqLh9vNvgrL0G5GHGXqunCQ=gsZ6j7w@mail.gmail.com> |
Here is my XHTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SVG_Bezier_Curve</title>
<link rel="stylesheet" type="text/css" href="
http://localhost:8080/exist/rest/db/apps/HTML_Student/SVG_Bezier_Curve.css
"/>
<script language="javascript" src="
http://localhost:8080/exist/rest/db/apps/HTML_Student/SVG_Bezier_Curve_2.js
">
</script>
</head>
<body>
<input type="text" id="My_Text" value="I was here."/>
<input type="button" onclick="Setup2()"/>
<input type="button" onclick="Setup()"/>
<p id="My_Paragraph"/>
<svg xmlns="http://www.w3.org/2000/svg" id="My_SVG" height="500"
width="500">
<path id="Bezier_Curve_1"/>
<path id="Bezier_Curve_2" d="M 300, 200 A 50, 50 0,0,1 400,200"
stroke="red" stroke-width="3" fill="none">
</path>
</svg>
</body>
</html>
Here is my Javascript:
function Setup() {
var Bezier_Curve_Identification;
var Attribute_Name;
var Attribute_Name_2;
var Coordinate;
var My_Properties;
document.getElementById("My_Text").value = "My Setup.";
Attribute_Name = "d";
Attribute_Name_2 = "style";
My_Properties = "stroke: blue; stroke-width: 3; fill: none;";
Coordinate = "M 300 200 A 20 20 0 0 0 400 200";
Bezier_Curve_Identification = document.getElementById('Bezier_Curve_1');
Bezier_Curve_Identification.setAttribute(Attribute_Name, Coordinate);
Bezier_Curve_Identification.setAttribute(Attribute_Name_2,
My_Properties);
}
function Setup2() {
var SVG_Data;
var Retrieved_Data;
SVG_Data = new XMLHttpRequest();
SVG_Data.open("GET","
http://localhost:8080/exist/rest/db/apps/HTML_Student/SVG_Bezier_Curve.xq",
true);
SVG_Data.onreadystatechange = function () {
if (SVG_Data.readyState == 4) {
Retrieved_Data = SVG_Data.responseText;
document.getElementById("My_Text").value = Retrieved_Data;}
};
SVG_Data.send();}
Here is my Xquery:
xquery version "3.0";
declare default element namespace "http://www.TedTheSpeedlearner.com";
declare option exist:serialize "method=text media-type=text/plain";
let $header-addition :=
response:set-header("Access-Control-Allow-Origin","*");
let $doc :=
doc("SVG_Bezier_Curve_Data.xml")/SVG_Data_Collection/Bezier_Curve_1;
let $First_Data_Name := $doc/Main_Attribute;
let $Data := concat($First_Data_Name, "*");
let $Second_Data_Name := $doc/Initial_Attribute;
let $Data := concat($Data, $Second_Data_Name, "-");
let $Third_Data_Name := $doc/Coordinate_Start;
let $Data := concat($Data, $Third_Data_Name, "-");
let $Fourth_Data_Name := $doc/Arc_Attribute;
let $Data := concat($Data, $Fourth_Data_Name, "-");
let $Fifth_Data_Name := $doc/Bezier_Arc;
let $Data := concat($Data, $Fifth_Data_Name, "-");
let $Sixth_Data_Name := $doc/Terminal_Coordinate;
let $Data := concat($Data, $Sixth_Data_Name);
return $Data;
Here is my data:
<SVG_Data_Collection xmlns="http://www.TedTheSpeedlearner.com" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.TedTheSpeedlearner.com SVG_Bezier_Curve_Data_Schema.xsd">
<Bezier_Curve_1>
<Main_Attribute>d</Main_Attribute>
<Initial_Attribute>M</Initial_Attribute>
<Coordinate_Start>300 200</Coordinate_Start>
<Arc_Attribute>A</Arc_Attribute>
<Bezier_Arc>20 20 0 0 0</Bezier_Arc>
<Terminal_Coordinate>400 200</Terminal_Coordinate>
<Style_Attribute>style</Style_Attribute>
<Style_Color>stroke: red;</Style_Color>
<Style_Width>stroke-width: 3;</Style_Width>
<Style_Fill>fill: none;</Style_Fill>
</Bezier_Curve_1>
<Bezier_Curve_2>
<Main_Attribute>d</Main_Attribute>
<Initial_Attribute>M</Initial_Attribute>
<Coordinate_Start>300 200</Coordinate_Start>
<Arc_Attribute>A</Arc_Attribute>
<Bezier_Arc>20 20 0 0 0</Bezier_Arc>
<Terminal_Coordinate>400 200</Terminal_Coordinate>
<Style_Attribute>style</Style_Attribute>
<Style_Color>stroke: blue;</Style_Color>
<Style_Width>stroke-width: 3;</Style_Width>
<Style_Fill>fill: none;</Style_Fill>
</Bezier_Curve_2>
</SVG_Data_Collection>
I already validated the XML data. Why do I get this error:
<html><head><meta http-equiv="Content-Type"
content="text/html;charset=ISO-8859-1"/><title>Error 404 Document
/db/apps/HTML_Student/SVG_Bezier_Curve.xq not
found</title></head><body><h2>HTTP ERROR 404 Document
/db/apps/HTML_Student/SVG_Bezier_Curve.xq not
found</h2><table><tr><th>URI:</th><td>/exist/rest/db/apps/HTML_Student/SVG_Bezier_Curve.xq</td></tr><tr><th>STATUS:</th><td>404</td></tr><tr><th>MESSAGE:</th><td>Document
/db/apps/HTML_Student/SVG_Bezier_Curve.xq not
found</td></tr><tr><th>SERVLET:</th><td>EXistServlet</td></tr></table><hr/><a
href="https://eclipse.org/jetty">Powered by Jetty://
9.4.50.v20221201</a><hr/></body></html>
_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open