Re: Importing namespace XML schema

Michael Westbay <[email protected]> Wed, 7 Aug 2024 09:19:54 +0900
Newsgroups gmane.text.xml.exist
Message-ID <CAJ6MVuNTrqJGhc2iq33eRWzktJY2Ux=Ek8gCUOmwDAd=b+oFrw@mail.gmail.com>
Hi Ted,

You have the answer of how to link to an external namespace in your first
XML file. Namely, use the `xmlns:xsi` and `xsi:schemaLocation` to point to
an instance of the SVG schema.

Good luck!



On Wed, Aug 7, 2024 at 4:26 AM Ted Hickox <[email protected]> wrote:

> Currently I have a project with the following 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>
>
> And I have a XML Schema that looks like this:
>
> <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:import namespace="http://www.w3.org/2000/svg"/>
>      <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>
>
> Because the SVG elements in the HTML document are in a different
> namespace, I'm generating a validation error.  Can I create a XML Schema
> for the SVG tags in my HTML and import that schema into the schema I have
> now?  Would this finally validate my svg tags in my HTML code?
> _______________________________________________
> Exist-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>


-- 
Michael Westbay
Writer/System Administrator
http://www.japanesebaseball.com/

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