XML-Validation return value
Friday, 18 July 2014 · 4 messages · last reply 31 Jul 2014
M
mar-hartmann18 Jul 2014 13:16 #
Hello everybody,
as a part of my thesis I deal with XML-Validation in BaseX by using XML-Schema/XSD.
Now it would be interesting if there is a possibility to get other return values instead of the default string that is returned by BaseX such as for example the IDs of faulty elements.
Any ideas how that could be realized in BaseX?
Many thanks in advance and kind regards
Martin Hartmann
CG
Christian Grün19 Jul 2014 11:47 #
Hi Martin,
Quoted text · mar-hartmann · 4 lines
> Now it would be interesting if there is a possibility to get other return > values instead of the default string that is returned by BaseX such as for > example the IDs of faulty elements. > Any ideas how that could be realized in BaseX?
Unfortunately, there is currently no such option in BaseX. The reason is that we are relying on external components (like Java or Saxon) when validate resources. For our own use cases, we have built an XQuery validation framework, which gives us more flexibility than XSD or Schematron.
What kind of tests are you performing via XSD?
Christian
MH
Martin Hartmann22 Jul 2014 18:03 #
Hi Christian,
thank you for your reply!
We have a client that communicates with BaseX. Users have the possibility to do changes by using this client. I want to validate these changes via XSD and Schematron. The objective is to provide a detailed feedback that is not only valid/not valid.
So do you know any possibility to identify the faulty nodes (nodes-id) e.g. with an X-Path expression?
Many thanks and kind regards
Martin Hartmann
CG
Christian Grün31 Jul 2014 00:03 #
Here's a forwarded mail that was meant as an answer to your post (it has been stuck in our mailing list filter last week, sorry)...
Quoted text · Lukas Kircher · 47 lines
From: Lukas Kircher <lukaskircher1 at gmail.com> Subject: Re: [basex-talk] XML-Validation return value Date: 23 Jul 2014 15:43:56 GMT+2 To: Martin Hartmann <mar-hartmann at gmx.de> Cc: basex-talk at mailman.uni-konstanz.de Hi Martin, I'm currently developing our XQuery validation framework, that takes some inspiration from Schematron, some from XSD etc. Up to now the framework is rather project specific and neither generic, nor open source (eventually, both subject to change in the future). As XSD and Schematron are rather limited to work with, we started at some point to develop our own approach. At the core we have a set of tests (modeled as funtion items) that verify a set of given elements. In case of errors we get an XML report that includes erroneous elements as well as some unique identification, f.i. DB ids and an xpath expression to these elements. Schema- tron does something similar here by returning a path. Using our custom approach it is far simpler to combine schema tests and logical (BI) tests and also directly get back at the faulty node - even correcting it automatically, if possible. The BaseX specific functions xquery:eval [1] and xquery:update [2] help us to dynamically evaluate location steps coming from the report XML. I hope this answers at least part of your question? Cheers, Lukas [1] http://docs.basex.org/wiki/XQuery_Module#xquery:eval [2] http://docs.basex.org/wiki/XQuery_Module#xquery:update On Tue, Jul 22, 2014 at 6:03 PM, Martin Hartmann <mar-hartmann at gmx.de> wrote: > Hi Christian, > > thank you for your reply! > We have a client that communicates with BaseX. Users have the possibility to > do changes by using this client. I want to validate these changes via XSD > and Schematron. The objective is to provide a detailed feedback that is not > only valid/not valid. > So do you know any possibility to identify the faulty nodes (nodes-id) e.g. > with an X-Path expression? > > Many thanks and kind regards > Martin Hartmann
Written for BaseX 7.9. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery