Repository navigation
Description
Using STS4 4.6.0 in Eclipse.
In #108 project-based XSD schema resolution was implemented. I'm pretty sure I saw this working in other places, but I have a XML file using Spring Integration namespace XML elements for which this resolution seems to (partially) fail.
I have Spring Integration 4.3.21 in the classpath (both core and http modules) and snippets like these:
<int:header-enricher
input-channel="preAuthRequestChannel"
output-channel="restServiceRequestChannel">
<int:header name="myHeader"
expression="someGreatExpression" />
</int:header-enricher>The above is marked with this error:
cvc-complex-type.3.2.2: Attribute 'expression' is not allowed to appear in element 'int:header'.
Similar errors are given on <int-http:outbound-gateway> attributes like http-method-expression or request-factory.
I'm using the unversioned namespaces:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
default-lazy-init="true"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:int="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/http https://www.springframework.org/schema/integration/http/spring-integration-http.xsd">If I replace the unversioned XSDs with the versioned (4.3) ones, those errors go away. But I would like to avoid it.
The Spring Boot language server log doesn't show any error/exception. The XML where I have this problem seems to be detected as well as any updates to it:
17:22:07.712 [pool-4-thread-1] INFO o.s.i.v.boot.app.SpringSymbolIndex - Update document [xml changed]: file:///home/mauro/svn/DCS-SHOP-trunk/shop-commons/src/main/resources/context/myfile-foo.xml
Basic XML code assist for attribute names work (even for those attributes that are marked in red!), as well as further STS4 code assist within <bean> attributes (like class or property).
If I right click on the editor and choose "Validate", I get "The validation completed with no errors or warnings", yet I have those errors in the left vertical ruler and attributes are underlined in red.
I tried to:
- restart Eclipse
- clean that project
- close and reopen that project
without success.
Any idea on what is going on?
Activity
martinlippert commentedon Apr 17, 2020
Let me check if I can reproduce this locally.
Side note: The project-related XML namespace resolution is not part of the language server, that had to be implemented outside of it as a direct extension to the existing XML infrastructure of the IDE, in this case Eclipse.
martinlippert commentedon Apr 17, 2020
I tried this with the latest Spring Integration guide and tried various things that you describe in the
integration.xmlfile and it seems to work fine there. So there must be an important difference between my guide project and yours.There are two things that we could try:
Integrationguide via the wizard in STS and modify the existingintegration.xmlfile so that it contains the problematic elements - to see if that works or not.What do you think?
mauromol commentedon Apr 22, 2020
Hi Martin,
the second option is unfortunately complex, because I'm experiencing this in a large proprietary project. Regarding the first option, could you please give me some more help? I don't find any STS wizard in Eclipse Import... dialog. Maybe I am missing some STS4 component in my Eclipse installation... Is it part of the "Spring Tool Suite 4 Branding Feature"?
mauromol commentedon Apr 22, 2020
It seems like I was able to reproduce:
TestSTS.zip
This is a small Eclipse+Gradle project. If you open src/main/resources/foo-cms.xml in it, you'll see the errors. Here is a screenshot:
What's interesting is that the errors are reported in the Markers view under the category "Language Servers", and not under XML or such.
Right click -> Validate brings a "the validation completed with no errors or warnings".
I can't find anything relevant (at least to me) in the Language Server log. Here is the contents:
martinlippert commentedon Apr 23, 2020
Do you have additional language servers running in your IDE? Like something that also reacts to XML files, like an XML language server from the Wild Web Developer package, for example?
You can check that in the
Preferences -> Language Server. Is there is another language server associated with XML files, that might the source of those errors showing up - in that case, you should maybe disable that other one... :-)For some background: the XML language server from Wild Web Developer doesn't take our project-specific namespace resolving into account. Our project-specific namespace resolving is implemented as extension for the WTP package in Eclipse.
But we have plans to extend the XML language server from Wild Web with our project-specific namespace resolving, but that will not happen soon.
mauromol commentedon Apr 23, 2020
Good catch Martin... disabling Wild Web Developer language servers and closing and reopening the editor made the errors go away...
Yes, as I stated elsewhere I find the current situation between WTP and Wild Web Developer plugins quite confusing, from a user point of view I would have liked both projects to collaborate to offer a good coherent solution rather than overlapping functionalities from both, with all the consequent risks.
Just out of my curiosity, why isn't the project-related XML namespace resolution part of Spring Boot language server? Probably because, if it were, you would not be able to override the default WTP XML editor behaviour wrt namespace resolution?
martinlippert commentedon Apr 23, 2020
The namespace resolution is done when the tooling parses the XML source. So wherever that happens, we need to inject our extension for this mechanism.
WTP does this inside of its own XML parsing and validation mechanism, so we had to extent that mechanism using the WTP API.
Wild Web Developer does this parsing and validation inside of the Wild Web Developer XML language server, so for that case we need to implement an extension for that specific XML language server, using its specific API.
mauromol commentedon Dec 24, 2020
Hi @martinlippert, I saw the new entry in the "Known limitations and issues" that points here, as discussed in #354 (comment).
My question is then: should this be reopened or a new issue be created in order to track the resolution of this issue, in light of the new STS4 setup? Thank you.
martinlippert commentedon Dec 24, 2020
@mauromol We have an internal issue that is tracking the progress towards the project-related XSD namespace resolution, but I think it would be better to have a public GitHub issue for that. I will create one and move the relevant parts over to that one, which is still in progress. We are slowly getting there, but identified a few issues that prevented our implementation to make it into the 4.9.0 release.
mauromol commentedon Dec 24, 2020
Thanks a lot @martinlippert! I will watch that new issue when it is available.
martinlippert commentedon Jan 4, 2021
@mauromol Here you are... :-)