validate:xsd-info agains more than one schema
Friday, 4 March 2022 · 3 messages
AP
Arantza Etxebarria Pablo4 Mar 2022 10:28 #
Dear Community,
We have been trying to validate a file using the function
*
validate:xsd-info*($input as item(), $schema as item()?) as xs:string* against several different schemas and, we don't know how to send the parameter “schema” with more than one schema for this function.
We have tried to declare the variable *schema *like this :
let $schema:= "
http://inspire.ec.europa.eu/schemas/bu-base/4.0/BuildingsBase.xsd http://schemas.opengis.net/gml/3.2.1/gml.xsd"
But it returns this error message:
XML document 'example.gml': -1:-1: schema_reference.4: Failed to read schema document '
http://inspire.ec.europa.eu/schemas/bu-base/4.0/BuildingsBase.xsd http://schemas.opengis.net/gml/3.2.1/gml.xsd' , because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
I have tried this function when no schema is given and it takes the contain of schemaLocation attribute, and in this case, is able to validate more than one schema. But I need to pass the schemas through a variable
Could any of you point us in the right direction?
Thanks--
*Arantza Etxebarria *
ZD
Zimmel, Daniel4 Mar 2022 10:40 #
Why not pass both schemas as a string? You could then tokenize it and get two validation reports. Or do you want one validation report for two schemas at once? I am not sure if that’s possible...
let $schema:= "http://inspire.ec.europa.eu/schemas/bu-base/4.0/BuildingsBase.xsd http://schemas.opengis.net/gml/3.2.1/gml.xsd"
let $schemas := tokenize($schema,'\s')
for $sch in $schemas
return validate:xsd-info($xml,$sch)Daniel
Quoted text · BaseX-Talk · 15 lines
Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> Im Auftrag von Arantza Etxebarria Pablo Gesendet: Freitag, 4. März 2022 10:29 An: basex-talk at mailman.uni-konstanz.de Betreff: [basex-talk] validate:xsd-info agains more than one schema Dear Community, We have been trying to validate a file using the function validate:xsd-info($input as item(), $schema as item()?) as xs:string* against several different schemas and, we don't know how to send the parameter “schema” with more than one schema for this function. We have tried to declare the variable schema like this : let $schema:= "http://inspire.ec.europa.eu/schemas/bu-base/4.0/BuildingsBase.xsd http://schemas.opengis.net/gml/3.2.1/gml.xsd" But it returns this error message: XML document 'example.gml': -1:-1: schema_reference.4: Failed to read schema document 'http://inspire.ec.europa.eu/schemas/bu-base/4.0/BuildingsBase.xsd http://schemas.opengis.net/gml/3.2.1/gml.xsd' , because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. I have tried this function when no schema is given and it takes the contain of schemaLocation attribute, and in this case, is able to validate more than one schema. But I need to pass the schemas through a variable Could any of you point us in the right direction? Thanks -- Arantza Etxebarria
MH
Quoted text · Arantza Etxebarria Pablo · 18 lines
On 04.03.2022 10:28, Arantza Etxebarria Pablo wrote: > > Dear Community, > > > We have been trying to validate a file using the function > *validate:xsd-info*($input as item(), $schema as item()?) as > xs:string* against several different schemas and, we don't know how to > send the parameter “schema” with more than one schema for this function. > > > We have tried to declare the variable *schema *like this : > > > let $schema:= > "http://inspire.ec.europa.eu/schemas/bu-base/4.0/BuildingsBase.xsd > http://schemas.opengis.net/gml/3.2.1/gml.xsd" >
It seems the first schema imports the second so I would think using the first schema as the $schema parameter should suffice to have the validator load any imports. Or did you try that and got other errors or warnings?
Quoted text · Arantza Etxebarria Pablo · 25 lines
> > But it returns this error message: > > XML document 'example.gml': -1:-1: schema_reference.4: Failed to read > schema document > 'http://inspire.ec.europa.eu/schemas/bu-base/4.0/BuildingsBase.xsd > http://schemas.opengis.net/gml/3.2.1/gml.xsd' , because 1) could not > find the document; 2) the document could not be read; 3) the root > element of the document is not <xsd:schema>. > > I have tried this function when no schema is given and it takes the > contain of schemaLocation attribute, and in this case, is able to > validate more than one schema. But I need to pass the schemas through > a variable > > > Could any of you point us in the right direction? > > > Thanks > > > -- > *Arantza Etxebarria * >
Written for BaseX 9.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery