Re: Import validation

Jean-Paul Rehr <[email protected]> Thu, 14 Dec 2023 23:44:25 +0100
Newsgroups gmane.text.xml.exist
Message-ID <CALcdGbwpgpJXwEzpVjfKAxaO6xNbY8qw-PPj5aWVZ0ZjJXjV3Q@mail.gmail.com>
If you've installed eXist with the default applications, a simple look at
the loaded modules for the apps would give you the basic models to follow.
In this case, validation is a built-in module that comes with eXist so the
import is simple. See the bold part below.

xquery version "3.0";

*import module namespace validation="http://exist-db.org/xquery/validation
<http://exist-db.org/xquery/validation>";*

let $schema :=
xs:anyURI('/db/apps/HTML_Student/SVG_Ellipse_Webpage_XML_Schema.xsd')
let $instance :=
xs:anyURI('/db/apps/HTML_Student/SVG_Ellipse_Webpage_XML.xml')

On Thu, Dec 14, 2023 at 4:18 PM Ted Hickox <[email protected]> wrote:

> I have the following documents:
>
> SVG_Ellipse_Webpage_XQuery_Validator.xq
>
> xquery version "3.0";
> let $schema :=
> xs:anyURI('/db/apps/HTML_Student/SVG_Ellipse_Webpage_XML_Schema.xsd')
> let $instance :=
> xs:anyURI('/db/apps/HTML_Student/SVG_Ellipse_Webpage_XML.xml')
> return
> (validation:clear-grammar-cache(), validation:validate-report($instance,
> $schema))
>
> HTML_Student/SVG_Ellipse_Webpage_XML_Schema.xsd
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:target="
> http://www.TedTheSpeedlearner.com <http://www.tedthespeedlearner.com/>"
> targetNamespace="http://www.TedTheSpeedlearner.com
> <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="svg" type="target:SvgType"/>
>         </sequence>
>         <attribute name="onload" type="string"/>
>     </complexType>
>     <complexType name="SvgType">
>         <sequence>
>             <element name="ellipse" type="target:EllipseType"/>
>         </sequence>
>         <attribute name="id" type="string"/>
>     </complexType>
>     <complexType name="EllipseType">
>         <attribute name="id" type="string"/>
>     </complexType>
>     <element name="html" type="target:HeadType"/>
> </schema>
>
> SVG_Ellipse_Webpage_XML.xml
>
> <html xmlns="http://www.TedTheSpeedlearner.com
> <http://www.tedthespeedlearner.com/>" xmlns:xsi="
> 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"/>
>         <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>
>
> Michael Westbay stated that I didn't import the validation module
> anywhere.  I'm still very new at Xquery.  And I looked up importing
> validation on the internet and found no instructions on how to do this in
> eXist.  What validation module am I importing and what instruction needs to
> be used to perform this importing?
> _______________________________________________
> 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