Here is my HTML
<html xmlns="http://www.TedTheSpeedlearner.com" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TedTheSpeedlearner.com SVG_Bezier_Curve_Webpage_XML_Schema.xsd">
<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 onload="Setup()">
<input type="button" id="Bezier_Curve_Button" value="Click Me!" onclick="Setup2()"/>
<svg:svg id="My_SVG" height="500" width="500">
<svg:path id="Bezier_Curve_1"/>
<svg:path id="Bezier_Curve_2"/>
</svg:svg>
</body>
</html>
And here is my XML Schema
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:svg = "http://www.TedTheSpeedlearner.com" xmlns:target="http://www.TedTheSpeedlearner.com" targetNamespace="http://www.TedTheSpeedlearner.com" elementFormDefault="qualified">
<complexType name="HeadType">
<sequence>
<element name="head" type="target:TitleType"/>
<element name="body" type="target:BodyType"/>
</sequence>
</complexType>
<complexType name="TitleType">
<sequence>
<element name="title" type="string"/>
<element name="link" type="target:LinkType"/>
<element name="script" type="target:ScriptType"/>
</sequence>
</complexType>
<complexType name="LinkType">
<attribute name="rel" type="string"/>
<attribute name="type" type="string"/>
<attribute name="href" type="string"/>
</complexType>
<complexType name="ScriptType">
<attribute name="language" type="string"/>
<attribute name="src" type="string"/>
</complexType>
<complexType name="BodyType">
<sequence>
<element name="input" type="target:InputType"/>
<element name="svg" type="target:SvgType"/>
</sequence>
<attribute name="onload" type="string"/>
</complexType>
<complexType name="SvgType">
<sequence>
<element name="path" type="target:PathType"/>
<element name="path" type="target:Path2Type"/>
</sequence>
<attribute name="id" type="string"/>
<attribute name="height" type="string"/>
<attribute name="width" type="string"/>
</complexType>
<complexType name="InputType">
<attribute name="type" type="string"/>
<attribute name="id" type="string"/>
<attribute name="value" type="string"/>
<attribute name="onclick" type="string"/>
</complexType>
<complexType name="PathType">
<attribute name="id" type="string"/>
</complexType>
<complexType name="Path2Type">
<attribute name="id" type="string"/>
</complexType>
<element name="html" type="target:HeadType"/>
</schema>
As you can see, because I have my SVG in a different namespace, I have these errors.
I don’t know what the errors are referring to, so I could use your assistance.
If I had to guess…
The first error is complaining because it expected the <script>
tag on line 5 to be a single, closed tag, but it found text content (in the form of a line break and some tabs/spaces) between the open and close tags instead.
The second error is complaining because your BodyType tells your schema to expect an SVG element that is of type: target:SvgType
, where target
is "http://www.TedTheSpeedlearner.com"
(from your target declaration at the start).
What is actually in the HTML is an SVG element that is from a different schema.
I wasn’t aware of the spaces between the opening and closing script tags. I did as you suggested and removed the spaces.
I overlooked the fact that xmlns:target was declaring a namespace. So i created a xmlns:svg and declared the appropriate SVG namespace.
But I still have one more problem. I decided to track down all my errors by simplifying my XML schema. Here is my current HTML:
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang = "en" xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xs="http://www.TedTheSpeedlearner.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.TedTheSpeedlearner.com SVG_Bezier_Curve_Webpage_XML_Schema.xsd">
<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"/>
</head>
<body onload="Setup()">
<input type="button" id="Bezier_Curve_Button" value="Click Me!" onclick="Setup2()"/>
<svg:svg id="My_SVG" height="500" width="500">
<svg:path id="Bezier_Curve_1"/>
<svg:path id="Bezier_Curve_2"/>
</svg:svg>
</body>
</html>
And here is my current XML Schema:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:schema = "http://www.w3.org/2001/XMLSchema"
xmlns:xs = "http://www.TedTheSpeedlearner.com"
xmlns:body="http://www.w3.org/1999/xhtml"
xmlns:target="http://www.w3.org/1999/xhtml"
xmlns:svg = "http://www.w3.org/2000/svg"
targetNamespace="http://www.w3.org/1999/xhtml"
elementFormDefault="qualified">
<complexType name="HeadType">
<sequence>
<element name="head" type="target:TitleType"/>
<element name="body" type="svg:BodyType"/>
</sequence>
</complexType>
<element name="html" type="target:HeadType"/>
</schema>
And here is my latest error:
Any assistance would be greatly appreciated.
More guessing on my part. (I should point out i’m not an XML expert)
Well the XSD isnt valid, for starters.
Undefined type: target:TitleType
(At least, I cant find anything labelled TitleType in the XHTML schema?)
Undefined type: svg:BodyType
(Pretty sure the SVG schema doesnt define the HTML Body element.)
The error is saying html is undefined. Your HTML says its default namespace is http://www.w3.org/1999/xhtml
. Which is a little weird because you’d think the xhtml namespace should contain a definition for an html element, but I suspect is still not your intention to use…
megelinic:
TedTheSpeedlearner
would you please give a try to this schema
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:target="http://www.TedTheSpeedlearner.com"
targetNamespace="http://www.TedTheSpeedlearner.com"
elementFormDefault="qualified">
<xs:complexType name="HeadType">
<xs:sequence>
<xs:element name="head" type="target:TitleType"/>
<xs:element name="body" type="target:BodyType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TitleType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="link" type="target:LinkType"/>
<xs:element name="script" type="target:ScriptType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LinkType">
<xs:attribute name="rel" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="href" type="xs:string"/>
</xs:complexType>
<xs:complexType name="ScriptType">
<xs:attribute name="language" type="xs:string"/>
<xs:attribute name="src" type="xs:string"/>
</xs:complexType>
<xs:complexType name="BodyType">
<xs:sequence>
<xs:element name="input" type="target:InputType"/>
<xs:element name="svg" type="target:SvgType"/>
</xs:sequence>
<xs:attribute name="onload" type="xs:string"/>
</xs:complexType>
<xs:complexType name="SvgType">
<xs:sequence>
<xs:element name="path" type="target:PathType"/>
<xs:element name="path" type="target:Path2Type"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="height" type="xs:string"/>
<xs:attribute name="width" type="xs:string"/>
</xs:complexType>
<xs:complexType name="InputType">
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="value" type="xs:string"/>
<xs:attribute name="onclick" type="xs:string"/>
</xs:complexType>
<xs:complexType name="PathType">
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
<xs:complexType name="Path2Type">
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
<xs:element name="html" type="target:HeadType"/>
</xs:schema>
I tried your solution but nothing worked. I also tried to simplify my xml schema in an attempt to locate the error. Here is what I tried:
<web:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:web = "http://www.TedTheSpeedlearner.com"
xmlns:target="http://www.TedTheSpeedlearner.com"
targetNamespace="http://www.TedTheSpeedlearner.com"
elementFormDefault="qualified">
<web:element name="html" type="target:HeadType"/>
</web:schema>
I tried different namespaces as well as no namespaces at all. And I still receive the same error.
I don’t know what to do next.
In order to fix most of the problems I had on my schema, I had to change the schema location. Here is my current HTML:
<?xml version="1.0" encoding="utf-8"?>
<xs:html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xs="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml SVG_Bezier_Curve_Webpage_XML_Schema.xsd">
<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"/>
</head>
<body onload="Setup()">
<input type="button" id="Bezier_Curve_Button" value="Click Me!" onclick="Setup2()"/>
<svg:svg id="My_SVG" height="500" width="500">
<svg:path id="Bezier_Curve_1"/>
<svg:path id="Bezier_Curve_2"/>
</svg:svg>
</body>
</xs:html>
```.
I will give everyone a second reply because of the restrictions on this platform.
And here is my schema code:
<xs:schema xmlns:web="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:svg = "http://www.w3.org/2000/svg"
xmlns:target="http://www.w3.org/1999/xhtml"
targetNamespace="http://www.w3.org/1999/xhtml"
elementFormDefault="qualified">
<xs:complexType name="HeadType">
<xs:sequence>
<xs:element name="head" type="target:TitleType"/>
<xs:element name="body" type="target:BodyType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TitleType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="link" type="target:LinkType"/>
<xs:element name="script" type="target:ScriptType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LinkType">
<xs:attribute name="rel" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="href" type="xs:string"/>
</xs:complexType>
<xs:complexType name="ScriptType">
<xs:attribute name="language" type="xs:string"/>
<xs:attribute name="src" type="xs:string"/>
</xs:complexType>
<xs:complexType name="BodyType">
<xs:sequence>
<xs:element name="input" type="target:InputType"/>
<xs:element name="svg" type="target:SvgType"/>
</xs:sequence>
<xs:attribute name="onload" type="xs:string"/>
</xs:complexType>
<xs:complexType name="InputType">
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="value" type="xs:string"/>
<xs:attribute name="onclick" type="xs:string"/>
</xs:complexType>
<xs:complexType name="SvgType">
<xs:sequence>
<xs:element name="path" type="target:PathType"/>
<xs:element name="path" type="target:PathType"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="height" type="xs:string"/>
<xs:attribute name="width" type="xs:string"/>
</xs:complexType>
<xs:complexType name="PathType">
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
<xs:element name="html" type="target:HeadType"/>
</xs:schema>
And here is the final error that I’m receiving:
I’m not sure what this error code means, but I know it has to do with adding a second namespace to my HTML. I hope someone here can assist me with this.