From: Jean-Paul R. <re...@gm...> - 2023-12-16 00:09:21
|
Hi Ted, Further to Pieter's comment, validation:validate-report() was a function available in early version of eXist and was deprecated a long time ago, replaced by validation:parse-report(), validation:jaxv-report() or valation:jing-report() functions (which is why Michael suggested using a different function. When using functions in eXist it is obligatory to check the version you are using against the documentation. For example, you can search functions here https://exist-db.org/exist/apps/fundocs/index.html. (although function documentation is installed automatically in with eXist) You should acquire the habit of using the terminology of Xquery, functions, as it will help you search for solutions. Regards, JPR On Fri, Dec 15, 2023 at 7:54 PM Pieter Lamers <pie...@be...> wrote: > Hi Ted, > > Where on http://exist-db.org/exist/apps/fundocs/index.html did you find a > function validation:validate-report#2 ? I don't see it. > > Best, > Pieter > > On 15/12/2023 18:28, Ted Hickox wrote: > > I finally understand most of what is going on here. The validation module > is sort of like an object in object oriented programming. The clear > grammar cache is like an object method. And the validation report is like > an object method. I inserted the new line of code as everyone here has > suggested. But I received a new error: > > xquery version "3.0"; > import module namespace 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') > return > (validation:clear-grammar-cache(), validation:validate-report($instance, > $schema)) > > Function validation:validate-report() is not defined in module namespace: > http://exist-db.org/xquery/validation [at line 5, column 36] > > I'm guessing that this "method" doesn't exist in this module. Where does > it exist? > > nction validation:validate-report() is not defined in module namespace: > http://exist-db.org/xquery/validation [at line 5, column 36] > > Function validation:validate-report() is not defined in module namespace: > http://exist-db.org/xquery/validation > Function validation:validate-report() is not defined in module namespace: > http://exist-db.org/xquery/validation > > On Thu, Dec 14, 2023 at 6:04 PM Michael Westbay < > wes...@ja...> wrote: > >> Hi Ted, >> >> Let's first break down your program: >> >> 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)) >>> >> >> The two *let* statements assign values to the variables *$schemai and >> $instance*. So far, so good. >> >> Then you make two function calls in the *return* statement, these to: >> >> ・ *validation:clear-grammar-cache*() >> ・ *validation:validate-report*(...) >> >> The *validation* namespace is NOT built into XQuery. It needs to be >> loaded into your program. >> >> A quick check of the XQuery Function Documentation for "validation" ( >> https://exist-db.org/exist/apps/fundocs/index.html) shows that the >> namespace of *http://exist-db.org/xquery/validation >> <http://exist-db.org/xquery/validation>* has the first function, but not >> the second. The closest function to the second is the >> *validation:jaxp-report/3* function: >> >> validation:jaxp-report >> >> validation:jaxp-report($instance as item(), $enable-grammar-cache as xs:boolean, $catalogs as item()*) as node() >> >> Validate document by parsing $instance. Optionally grammar caching can be >> enabled and an XML catalog can be specified. Supported grammars types are >> '.xsd' and '.dtd'. An XML report is returned. >> Parameters: >> $instance The document referenced as xs:anyURI, a node (element or >> result of fn:doc()) or as a Java file object. >> $enable-grammar-cache Set the flag to true() to enable grammar caching. >> $catalogs* The catalogs referenced as xs:anyURI's. Returns: node() : a >> validation report. >> >> >> To import the *validation* namespace into your program, enter the >> following after the XQuery version line: >> >> import module namespace "http://exist-db.org/xquery/validation"; >> >> >> Importing modules is one of the core functionalities of XQuery for code >> reuse. I strongly recommend reading this page about creating (and using) >> XQuery functions from the XQuery WikiBook: >> >> https://en.wikibooks.org/wiki/XQuery/Creating_XQuery_Functions >> >> >> That explains how to create your own modules and import them. The example >> I provided above (which doesn't have the *at* clause) is for modules >> built into eXist. >> >> The XQuery Function Documentation page and XQuery WikiBook are two >> resources you should have bookmarked. >> >> Hope this helps. >> >> -- >> Michael Westbay >> Writer/System Administrator >> http://www.japanesebaseball.com/ >> > > > _______________________________________________ > Exist-open mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/exist-open > > > -- > Pieter Lamers > John Benjamins Publishing Company > Postal Address: P.O. Box 36224, 1020 ME AMSTERDAM, The Netherlands > Visiting Address: Klaprozenweg 75G, 1033 NN AMSTERDAM, The Netherlands > Warehouse: Kelvinstraat 11-13, 1446 TK PURMEREND, The Netherlands > tel: +31 20 630 4747 > web: www.benjamins.com > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > |