Reference XSD files in XML files across modules

Answered

I have two modules in my project. Module A and B.

Module B inherits from module A.

In module A is an XSD file and an XML file  in the same package. The XML file references to the XSD file via the following line:

xsi:noNamespaceSchemaLocation='Blubb.xsd'

This works very well. I get on demand warnings and erros if something is not valid against this XSD file.

 

In module B is also an XML file (same package) which should be valid against the XSD file from module A.

I tried many solutions:

xsi:noNamespaceSchemaLocation='Blubb.xsd'>
xsi:noNamespaceSchemaLocation='same.package.as.in.module.a.Blubb.xsd'>

The reference of the second solution works. I can open it via "Ctrl + b". But I don't get on demand warnings and errors.

 

The only solutions which worked perfectly was to specify the reference via a relative or absolute path like:

xsi:noNamespaceSchemaLocation='../../../../../../../../../../../a/src/main/resources/same/package/as/in/module/a/Blubb.xsd'>
xsi:noNamespaceSchemaLocation='file:/C:/prj/project/a/src/main/resources/same/package/as/in/module/a/Blubb.xsd'>

Is there any possibility to solve this issue without an absolute or relative path?

2
3 comments
Avatar
Yaroslav Bedrov

Hello,

Have you tried to put caret on "Blubb.xsd", press Alt+Enter, choose "Manually setup external resource" and select needed XSD?

0
Avatar
Permanently deleted user

Hello

Thank you for the fast response!

I tried it but it doesn't work.

 

I created a new project with the same structure as in our project. Maybe you could take a short look on it and can help me with the problem:

https://www.dropbox.com/s/tbwcpvqh1jr8cvs/Project.zip?dl=0 

ModuleA and ModuleB are structured as mentioned in my first post.

I additionally added ModuleC where I used a relative path to the XSD in ModuleA. This solution would work. But how does it work without a relative/absolute path?

0
Avatar
Yaroslav Bedrov

Thanks for example! Seems my suggestion won't work in this case.

I reported issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-215664. Please follow it for updates.

0

Please sign in to leave a comment.