bernard01 opened a new issue, #6226:
URL: https://github.com/apache/netbeans/issues/6226

   ### Apache NetBeans version
   
   Apache NetBeans 18
   
   ### What happened
   
   If an XML file loaded in the editor is validated against multiple schema 
files, then validation breaks under an observed condition.
   
   The condition is that definitions in the schema files reference each other. 
In this case, it appears to be important that the validator builds the schema 
from the multiple files in such a way that the order in which the files are 
loaded is matching the hierarchy. Dependent files need to be loaded after the 
files that they depend on.
   
   I am coming to this conclusion after writing a test case. This test case 
builds the schema in the correct way, using an iterative brute force approach.
   
   If the schema files are loaded in the incorrect order, then the schema 
cannot be built, and validation is not even started.
   
   I am donating the code in the test case to Apache Netbeans with the aim that 
the validation using the editor is fixed, using the insight gained from the 
test case.
   
[MultiSchemaValidation.zip](https://github.com/apache/netbeans/files/12093607/MultiSchemaValidation.zip)
   
   
   ### How to reproduce
   
   Open file mtn_2020-06-29_full_S1_R0.xml in directory xml.
   
   In the editor, right click|Validate XML
   
   Result:
   
   cvc-elt.1.a: Cannot find the declaration of element 'rde:deposit'. [15] 
   
   
   The main class ValidateXmlXsd.java in the attached project contains code to 
validate the XML.
   
   Without any tricks, the validation crashes with a similar error.
   
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Windows 7
   
   ### JDK
   
   Java: 14; Java HotSpot(TM) 64-Bit Server VM 14+36-1461
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   However, when a trick is applied via boolean CREATE_SCHEMA_ITERATIVELY in 
the attached class ValidateXmlXsd.java, then the validation proceeds normally 
with genuine validation errors printed.
   
   I am not an expert in this area. So I would not know what the real error 
here is. Perhaps there is something else.
   
   But NetBeans is very powerful tool and it has served me well whenever I 
needed it. Perhaps this is worthwhile fixing.
   
   
   ### Are you willing to submit a pull request?
   
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to