Validating with XML schema
Saturday, 30 July 2016 · 3 messages · last reply 31 Jul 2016
CC
Chahd Chahd30 Jul 2016 21:34 #
Hi,
I am using the web application of BaseX. How can I validate a base (that contains a XML file) with a XML schema file?
thank you
CG
Christian Grün30 Jul 2016 22:24 #
Hi Chahd,
Quoted text · Chahd Chahd · 2 lines
> I am using the web application of BaseX. How can I validate a base (that > contains a XML file) with a XML schema file?
I invite you to have a look into our documentation [1].
Hope this helps
Christian
[1] http://docs.basex.org/wiki/Validation_Module#XML_Schema_Validation
CG
Christian Grün31 Jul 2016 23:01 #
Hi Chahd (cc to the list),
Quoted text · Christian Grün · 1 line
> Can I do it with the Rest service?
Yes you can [1]:
http://localhost:8984/rest/MyFirstBase/text.xml?query=validate:xsd(., db:open('MyFirstBase/text.xml'))
I agree this doesn’t look very straightforward. If you are interested in spending some more time with XQuery, you could use RESTXQ [2] to provide more intuitive URLs. An example:
Your URI:
http://localhost:8984/restxq/validate/text.xml?schema=validate:xsd
Your server-side RESTXQ code (see the documentation and the example in the zip/exe distributions for more details):
declare
%rest:path('/validate/{$doc}')
%rest:query-param('schema', '{$schema}')
function local:validate($doc, $schema) {
let $db := 'MyFirstBase'
return validate:xsd(db:open($db, $doc), db:open($db, $schema))
};Quoted text · Chahd Chahd · 17 lines
On Sat, Jul 30, 2016 at 11:41 PM, Chahd Chahd <chahd.chahddd at gmail.com> wrote: > > 2016-07-30 22:24 GMT+02:00 Christian Grün <christian.gruen at gmail.com>: >> >> Hi Chahd, >> >> > I am using the web application of BaseX. How can I validate a base (that >> > contains a XML file) with a XML schema file? >> >> I invite you to have a look into our documentation [1]. >> >> Hope this helps >> Christian >> >> [1] http://docs.basex.org/wiki/Validation_Module#XML_Schema_Validation > >
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery