Re: Still trying to validate an XML Schema

Ted Hickox <[email protected]> Wed, 3 Jul 2024 11:11:44 -0500
Newsgroups gmane.text.xml.exist
Message-ID <CAAsp6Cbm32C6Fzq3J=vtQ-2D79GhCjT12dMX3QjXCm4suA2etg@mail.gmail.com>
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 used the dev tool that you recommended.  And it did find the error.

It says uncaught type error.  It cannot read properties of undefined.  It
says it's reading send.

So now I know that the SVG_Data object doesn't have the send property.  How
can I create the send property for the SVG_Data object?

On Mon, Jun 24, 2024 at 12:34 AM Florian Schmitt <
[email protected]> wrote:

> Hi Ted,
>
> the best way to debug your Javascript is using the browser console
> (because it's the browser, not eXist-db which executes that code). If
> you're using Chrome or Edge, check the following help page:
>
>
> https://learn.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/console/
>
> For Firefox, see:
>
> https://firefox-source-docs.mozilla.org/devtools-user/
>
> Especially, search for information about the Console output and how to
> send debug messages to the console.
>
> HTH
> Florian
>
>
> Am 24.06.24 um 02:46 schrieb Ted Hickox:
> > I feel like such an idiot.  Thanks for helping me validate my data.
> > Since I know my data is valid, I know that there is something wrong
> > with my Javascript.  I'm not sure what that would be, but I will test
> > various things.  In case anyone is curious, here is my Javascript.
> >
> > 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 <
> 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();
> >
> > And here is my revised HTML
> >
> > <html xmlns="http://www.w3.org/1999/xhtml
> > <http://www.w3.org/1999/xhtml>"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> > <http://www.w3.org/2001/XMLSchema-instance>"
> > xsi:schemaLocation="http://www.TedTheSpeedlearner.com
> > <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 <
> 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 <
> 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>
> >
> > On Sun, Jun 23, 2024 at 5:57 PM Florian Schmitt
> > <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     Hi Ted,
> >
> >     taka a close look to the validation result. Instead of "ellipse",
> >     "Ellipse" is expected. You've defined in your schema that the element
> >     name starts with an upper-case "E", which isn't the case in your XML.
> >
> >     Thus, replace
> >
> >     <ellipse>
> >               <X_Center_Coordinate>100</X_Center_Coordinate>
> >               <Y_Center_Coordinate>100</Y_Center_Coordinate>
> >               <X_Radius_Coordinate>30</X_Radius_Coordinate>
> >               <Y_Radius_Coordinate>70</Y_Radius_Coordinate>
> >           </ellipse>
> >
> >     with
> >
> >     <Ellipse>
> >               <X_Center_Coordinate>100</X_Center_Coordinate>
> >               <Y_Center_Coordinate>100</Y_Center_Coordinate>
> >               <X_Radius_Coordinate>30</X_Radius_Coordinate>
> >               <Y_Radius_Coordinate>70</Y_Radius_Coordinate>
> >           </Ellipse>
> >
> >     HTH
> >     Florian
> >
> >
> >     Am 23.06.2024 um 23:24 schrieb Ted Hickox:
> >      > Here is a little update.  I attempted to validate my xml code.
> >     This is
> >      > the result I received:
> >      >
> >      > image.png
> >      >
> >      > I'm assuming that the problem is located in my xml code and not
> >     in my
> >      > xml schema.  Here are my xml and xml schema codes
> >     ...
> >
> >
> >
> >
> >
> >
> >     _______________________________________________
> >     Exist-open mailing list
> >     [email protected]
> >     <mailto:[email protected]>
> >     https://lists.sourceforge.net/lists/listinfo/exist-open
> >     <https://lists.sourceforge.net/lists/listinfo/exist-open>
> >
> >
> >
> > _______________________________________________
> > Exist-open mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/exist-open
>
>
>
> _______________________________________________
> Exist-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open