Using Schema+Schematron on XML files with XMLNS error

Having trouble installing Oxygen? Got a bug to report? Post it all here.
aujunior
Posts: 28
Joined: Thu Feb 16, 2023 11:00 pm

Using Schema+Schematron on XML files with XMLNS error

Post by aujunior »

I'm having issues using schema validation along with Schematron validation when the XML file contains a XMLNS tag.

We are developing a framework to work with ATA2300, and in this specification, the namespace xmlns="http://www.ataebiz.org/XMLSchema" is used. A catalog file was created to apply the schema to the XML files. A Schematron was also created to validate some rules apart from the schema. However, when we have the XMLNS tag, Oxygen doesn't take the Schematron into account. When I remove the XMLNS tag, the Schematron works, but the schema stops working.

Am I doing something wrong, or is it really a tool issue?

Validation scenario:
image.png
image.png (14.23 KiB) Viewed 371 times
Catalog:
image.png
image.png (9.73 KiB) Viewed 371 times
Simple Schematron:
image.png
image.png (14.22 KiB) Viewed 371 times
File with XMLNS working with Schema, but not with schematron:
image.png
image.png (26.76 KiB) Viewed 371 times
File without XMLNS working with Schematron, but not with schema:
image.png
image.png (33.25 KiB) Viewed 371 times

We are having the same problem when using xsi:noNamespaceSchemaLocation instead of xsi:schemaLocation
aujunior
Posts: 28
Joined: Thu Feb 16, 2023 11:00 pm

Re: Using Schema+Schematron on XML files with XMLNS error

Post by aujunior »

I found the solution.

The following declaration is missing in schematron:
<sch:ns uri="http://www.ataebiz.org/XMLSchema" prefix="ata"/>

Now it working fine.


I'm sorry.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Using Schema+Schematron on XML files with XMLNS error

Post by Radu »

Hi,
Right, once your XML is in a certain namespace, the XPath expressions in the Schematron need to match elements in that namespace.
So either write flexible matches like *:para or match directly elements in the namespace by using ata:para and mapping the "ata" prefix to the namespace.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply