From: Ted H. <meg...@gm...> - 2024-06-21 19:38:29
|
Good afternoon. I finally took a better look at my code and noticed that my file had been saved as an Xquery instead of a Javascript file. So I copied and pasted my text to a new file. I destroyed the old file and renamed the new file. That took care of the previous error. Now I have a different error. It's called an assignment in a conditional error. Here is the code again if you need to see it. var SVG_Data; var Retrieved_Data; var Attribute_List; var Coordinate_List; var Counter; function Setup() { SVG_Data = new XMLHttpRequest(); SVG_Data.open("GET"," http://localhost:8080/exist/rest/db/apps/HTML_Student/SVG_Ellipse.xq", true); SVG_Data.onreadystatechange = function () { if (SVG_Data.readyState = 4) { Retrieved_Data = SVG_Data.responseText; Retrieved_Data = Retrieved_Data.split("*"); Attribute_List = ""; Coordinate_List = ""; for (Counter = 0; Counter < 8; Counter++) { Attribute_List = Attribute_List + Retrieved_Data[Counter] + "*"; Counter = Counter + 1; Coordinate_List = Coordinate_List + Retrieved_Data[Counter] + "*";} Attribute_List = Attribute_List.split("*"); Coordinate_List = Coordinate_List.split("*"); Coordinate = "<ellipse id = 'My_Ellipse'"; for (Counter = 0; Counter < 4; Counter++) { Coordinate = Coordinate + " " + Attribute_List[Counter] + " = '" + Coordinate_List[Counter] + "'";} Coordinate = Coordinate + ">"; document.getElementById("Image_Box").innerHTML = Coordinate; } }; } SVG_Data.send(); On Thu, Jun 20, 2024 at 7:52 PM Ted Hickox <meg...@gm...> wrote: > I wasn't aware that the eXist database had the arrow on the bottom of the > screen. I clicked the arrow and the schema for my HTML page appeared. But > I also discovered another error in my code. This involves the javascript > document that my HTML document references in my script tag. > > The error states that I have an unexpected token and it refers to my > SVG_Data variable. I have no idea what a token is or why SVG_Data was > considered a token. Here is my javascript code: > > var SVG_Data > var Retrieved_Data > var Attribute_List > var Coordinate_List > var Counter > function Setup() { > SVG_Data = new XMLHttpRequest(); > SVG_Data.open("GET"," > http://localhost:8080/exist/rest/db/apps/HTML_Student/SVG_Ellipse.xq", > true); > SVG_Data.onreadystatechange = function () { > if (SVG_Data.readyState = 4) { > Retrieved_Data = SVG_Data.responseText; > Retrieved_Data = Retrieved_Data.split("*"); > Attribute_List = ""; > Coordinate_List = ""; > for (Counter = 0; Counter < 8; Counter++) { > Attribute_List = Attribute_List + Retrieved_Data[Counter] + "*"; > Counter = Counter + 1; > Coordinate_List = Coordinate_List + Retrieved_Data[Counter] + "*";} > Attribute_List = Attribute_List.split("*"); > Coordinate_List = Coordinate_List.split("*"); > Coordinate = "<ellipse id = 'My_Ellipse'"; > for (Counter = 0; Counter < 4; Counter++) { > Coordinate = Coordinate + " " + Attribute_List[Counter] + " = '" > + Coordinate_List[Counter] + "'";} > Coordinate = Coordinate + ">" > document.getElementById("Image_Box").innerHTML = Coordinate; > } > } > SVG_Data.send(); > > I'm presuming that my SVG_Data becomes an object and that a new > XMLHTTPRequest is stored in this object. Or is it that when the variable > SVG_Data is equalled to the new XMLHTTPRequest that the variable just > becomes an programming object. I don't seem to have a full grasp on the > Document Object Model. But I'm trying to grasp this concept as fast as I > can. > > On Thu, Jun 20, 2024 at 10:57 AM Florian Schmitt < > ml-...@fl...> wrote: > >> Hi Ted, >> >> i assume "*open in the eXist database*" means to open the file in *eXide*. >> If yes, then check the file type in the upper right corner. If it's HTML, >> you can't "run" or "eval" it in eXide: >> >> >> Changing the file type to "xquery" should at least enable the "eval" >> button. >> >> For static HTML files (as in your case), you can use the arrow symbol in >> the lower left corner of the code area to open the file in a new browser >> tab: >> >> >> Greetings, >> Florian >> >> >> Am 20.06.24 um 01:40 schrieb Ted Hickox: >> >> I adjusted my code and my project finally worked. My HTML document was >> properly validated by my schema. But I have a new problem. This is my >> HTML code: >> >> <html xmlns="http://www.TedTheSpeedlearner.com" xmlns:xsi=" >> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" >> http://www.TedTheSpeedlearner.com SVG_Ellipse_Webpage_XML_Schema.xsd"> >> <head> >> <title>SVG Ellipse</title> >> <link rel="stylesheet" type="text/css" href=" >> http://localhost:8080/exist/rest/db/apps/HTML_Student/SVG_Ellipse.css"/> >> <script language="javascript" src=" >> http://localhost:8080/exist/rest/db/apps/HTML_Student/SVG_Ellipse.js"/> >> </head> >> <body onload="Setup()"> >> <svg id="Image_Box"> >> <ellipse id="My_Ellipse"/> >> </svg> >> </body> >> </html> >> >> When I open this in the eXist database, the run button is grayed out. Is >> there something wrong with my code? >> >> >> _______________________________________________ >> Exist-open mailing list >> Exi...@li... >> https://lists.sourceforge.net/lists/listinfo/exist-open >> > |