-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XML Validation with GWT or other complex DOCTYPE - Error: Element type "ui:UiBinder" must be declared. #571
Comments
Can you please try latest snapshot from https://download.eclipse.org/wildwebdeveloper/snapshots/ and report whether this works or not? |
At first I think you have this error because you declare DOCTYPE like: <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client.form"
xmlns:c="urn:import:com.blazent.web.client.widgets.controls"
xmlns:gxtcontainer="urn:import:com.sencha.gxt.widget.core.client.container"
xmlns:sl="urn:import:com.blazent.web.client.widgets.saveLoadOverlay"
xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form"
xmlns:w="urn:import:com.blazent.web.client.widgets"
xmlns:html="urn:import:com.blazent.web.client.widgets.html"
xmlns:button="urn:import:com.blazent.web.client.widgets.button"
xmlns:lists="urn:import:com.blazent.web.client.widgets.lists">
<g:HTMLPanel>
... page stuff here ...
</g:HTMLPanel>
</ui:UiBinder> Is that? I suggest you remove this DOCTYPE. At this step you will see no errors, no completion based on XSD. You need to write a XML catalog which defines a mapping between uri and XSD. Create a XML file catalog <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri
name="urn:ui:com.google.gwt.uibinder"
uri="http://dl.google.com/gwt/dtd/uibinder.xsd" />
<uri
name="urn:import:com.google.gwt.user.client.ui"
uri="http://dl.google.com/gwt/dtd/com.google.gwt.user.client.ui.xsd" />
</catalog> GWT Eclipse plugin does that too https:/gwt-plugins/gwt-eclipse-plugin/blob/d2478f8ca89d7c388442f810cec0a44f8962aa22/plugins/com.gwtplugins.gwt.eclipse.core/plugin.xml#L946 And after that you need to register the catalog with WWD preferences: Once you did that, you can open your XML and you should benefit with completion based on XSD: Please note that as UiBinder is defined in http://dl.google.com/gwt/dtd/uibinder.xsd as mixed: <xs:element
name="UiBinder">
<xs:complexType
mixed="true"> you can write any element inside it (you will not have some error).
I suggest that you create an issue for that, because by default the XML Language Server disable the load of external entities (for security reason). You can enable it with |
Unfortunately, the problem remains.
…On Tue, Nov 24, 2020 at 1:46 PM Mickael Istria ***@***.***> wrote:
Can you please try latest snapshot from
https://download.eclipse.org/wildwebdeveloper/snapshots/ and report
whether this works or not?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#571 (comment)>,
or unsubscribe
<https:/notifications/unsubscribe-auth/AF4PC46JURALTR2PNPKZMK3SRQLSVANCNFSM4UBJB5PQ>
.
|
Angelo - THANK YOU - great explanation!! I hate when eclipse updates that
it enables security that causes errors like this.
…On Wed, Nov 25, 2020 at 3:28 AM Angelo ***@***.***> wrote:
Element type "ui:UiBinder" must be declared.
At first I think you have this error because you declare DOCTYPE like:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client.form"
xmlns:c="urn:import:com.blazent.web.client.widgets.controls"
xmlns:gxtcontainer="urn:import:com.sencha.gxt.widget.core.client.container"
xmlns:sl="urn:import:com.blazent.web.client.widgets.saveLoadOverlay"
xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form"
xmlns:w="urn:import:com.blazent.web.client.widgets"
xmlns:html="urn:import:com.blazent.web.client.widgets.html"
xmlns:button="urn:import:com.blazent.web.client.widgets.button"
xmlns:lists="urn:import:com.blazent.web.client.widgets.lists">
<g:HTMLPanel>
... page stuff here ...
</g:HTMLPanel>
</ui:UiBinder>
Is that?
I suggest you remove this DOCTYPE. At this step you will see no errors, no
completion based on XSD. You need to write a XML catalog which defines a
mapping between uri and XSD.
Create a XML file catalog gwt-catalog.xml like this :
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri
name="urn:ui:com.google.gwt.uibinder"
uri="http://dl.google.com/gwt/dtd/uibinder.xsd" />
<uri
name="urn:import:com.google.gwt.user.client.ui"
uri="http://dl.google.com/gwt/dtd/com.google.gwt.user.client.ui.xsd" />
</catalog>
GWT Eclipse plugin does that too
https:/gwt-plugins/gwt-eclipse-plugin/blob/d2478f8ca89d7c388442f810cec0a44f8962aa22/plugins/com.gwtplugins.gwt.eclipse.core/plugin.xml#L946
And after that you need to register the catalog with WWD preferences:
[image: image]
<https://user-images.githubusercontent.com/1932211/100214664-70992900-2f10-11eb-905d-489e49cb8be4.png>
Once you did that, you can open your XML and you should benefit with
completion based on XSD:
[image: image]
<https://user-images.githubusercontent.com/1932211/100214804-96bec900-2f10-11eb-84a6-c1b34e17da4c.png>
Please note that as UiBinder is defined in
http://dl.google.com/gwt/dtd/uibinder.xsd as mixed:
<xs:element
name="UiBinder">
<xs:complexType
mixed="true">
you can write any element inside it (you will not have some error).
Next Issue - Imbedded <!ENTITY records are not processed
I suggest that you create an issue for that, because by default the XML
Language Server disable the load of external entities (for security
reason). You can enable it with xml.validation.resolveExternalEntities
like we do in vscode-xml
https:/redhat-developer/vscode-xml/blob/master/docs/Validation.md#resolve-external-entities
but WWD doesn't provide this preference. Please create it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#571 (comment)>,
or unsubscribe
<https:/notifications/unsubscribe-auth/AF4PC463VKQZQES3Z6WUXWDSRTL3VANCNFSM4UBJB5PQ>
.
|
Which problems? You have again a validation problem even if you remove the DOCTYPE? if you configure catalog, you should have completion based on XSD, no?
It's not Eclipse, it's the default behavior of the XML Language Server used https:/eclipse/lemminx/ It prevent from XXE atacks, see https://www.shielder.it/blog/2019/10/dont-open-that-xml-xxe-to-rce-in-xml-plugins-for-vs-code-eclipse-theia/ The only thing that WWD must provide is the settings |
From Wild Web Developer, it looks like this is more a UX issue that a bug.
@angelozerr do you want me to open tickets to lemminx about that, or are those stories already covered is some way Wild Web Developer fails at leveraging? For this example, I'd suggest @RobertMolenda you use actual XSD path (eg http://dl.google.com/gwt/dtd/uibinder.xsd ) in the xmlns elements instead of the "to be resolved" |
XML errors are reported by Xerces, and in this case, Xerces consider that it's a XML valid, because you can use namespace without XSD association. I think it's possible to support this warning, but I'm not sure it's an easy task. When XML is not bound to a XSD, DTD grammar, you can see an information on the root element. The last release of LemMinx provides several code actions to generate XSD / DTD and associate it:
I think it's a new CodeAction that we should implement like we did to generate XSD, DTD. An idea is to generate the XML catalog and if LSP client have the capability,it can register the catalog on settings client side. We did this kind of feature when XML catalog path is wrong.
Why, XML catalogs is working for that, no? I'm not sure that @RobertMolenda want to modify the gwt xml which uses namespaces. |
What's to be done on LSP4E on that matter? It seems like everything is in place to make it work. |
For which feature? To fix this issue WWD should provide the settings |
Validation Issues with {module}.ui.xml
Sample XML
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client.form"
xmlns:c="urn:import:com.blazent.web.client.widgets.controls"
xmlns:gxtcontainer="urn:import:com.sencha.gxt.widget.core.client.container"
xmlns:sl="urn:import:com.blazent.web.client.widgets.saveLoadOverlay"
xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" xmlns:w="urn:import:com.blazent.web.client.widgets"
xmlns:html="urn:import:com.blazent.web.client.widgets.html"
xmlns:button="urn:import:com.blazent.web.client.widgets.button"
xmlns:lists="urn:import:com.blazent.web.client.widgets.lists">
<g:HTMLPanel>
... page stuff here ...
</g:HTMLPanel>
</ui:UiBinder>
Error Message:
Element type "ui:UiBinder" must be declared.
Next Issue - Imbedded <!ENTITY records are not processed
Sample XML
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" ...
In the file place and it will be flagged as not being declared
I like the tool for Angular - but I also have to support GWT based projects -
Thanks
Robert Molenda
The text was updated successfully, but these errors were encountered: