PS: If it’s only about BIC validation, you can obviously use standard XQuery:
declare variable $BIC-PATTERN := '[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}'; let $node := <BIC>GEN0DEM1MPW</BIC> return if(matches($node, $BIC-) then 'well done' else 'sigh'
On Fri, Mar 11, 2016 at 11:20 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Ulrike,
The Validation Module should help you here, in particular validate:xsd-report [1]. It allows you to pass on file URIs or XML fragments as arguments.
All the best, Christian
[1] http://docs.basex.org/wiki/Validation_Module
On Fri, Mar 11, 2016 at 10:02 AM, Ulrike Schaper - SideStep Business Solutions GmbH U.Schaper@sidestep-solutions.de wrote:
Hi everybody,
I’m trying to compose XML documents for SEPA transactions via BaseX.
I would like to check certain data against the corresponding schema before putting them into the document, e.g. BIC identifiers.
In the xsd, there’s a simpleType definition for BICs:
<xs:simpleType name="BICIdentifier"> <xs:restriction base="xs:string"> <xs:pattern
value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
</xs:restriction> </xs:simpleType>
I hoped it would be as simple as
declare default element namespace "urn:iso:std:iso:20022:tech:xsd:pain.001.003.03";
let $node := <BIC>GEN0DEM1MPW</BIC>
return if(string($node) instance of BICIdentifier) then (true() (: process... :)) else (false() (: report error :))
But, as I learned now, BaseX doesn’t support import of schemas. Thus, I receive the error message “Unknown type: Q{urn:iso:std:iso:20022:tech:xsd:pain.001.003.03 }BICIdentifier”.
Is there some workaround (other than rebuilding regular expressions from schema to xquery)?
Best regards,
Ulrike.