3

In my GWT 2.8 based project Eclipse 2020-03 shows me lots of error message under Markers -> Language Servers I am sure that these are not errors. For some reason, Eclipse cannot interpret ui.xml files correctly. The application compiles and runs fine:

error messages in eclipse

My eclipse wide settings for XML validation are as follows:

eclipse settings

There are not project-specific settings for this

Here is an extract (not the complete source!!!) of one example of a something.ui.xml file. The project contains lots of those files:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder 
    xmlns:ui="urn:ui:com.google.gwt.uibinder" 
    xmlns:g="urn:import:com.google.gwt.user.client.ui"
    xmlns:b="urn:import:org.gwtbootstrap3.client.ui"
    xmlns:a="urn:import:com.myapp.client.widgets"
    ui:generateFormat="com.google.gwt.i18n.rebind.format.PropertiesFormat"
    ui:generateKeys="com.google.gwt.i18n.server.keygen.MD5KeyGenerator"
    ui:generateLocales="default" >

<ui:with type="com.myapp.resources.text.CommonMessages" field="msgs" />
<ui:with type="com.myapp.resources.text.SummaryMessages" field="sMsgs" />

<b:Modal closable="true" fade="true" dataBackdrop="STATIC" dataKeyboard="true" 
    b:id="dialog" 
    ui:field="dialog">
    <b:ModalHeader title="{sMsgs.transferOwnership}" />
    <b:ModalBody>
        <g:HTML><ui:text from="{sMsgs.transferOwnershipDescription}"/></g:HTML>

        <b:ListBox 
            ui:field="userListBox"
            multipleSelect="false"
            width="100%"
             />

        <b:Alert type="DANGER" ui:field="participantWarning">
            <b:Icon type="WARNING"/>
            <g:HTML><ui:text from="{sMsgs.transferOwnershipNotParticipantWarning}" /></g:HTML>
        </b:Alert>
    </b:ModalBody>
    <b:ModalFooter>

These are the error messages: error messages

Mouseover on the error always shows: individual error message

although it is declared above: [...]

xmlns:b="urn:import:org.gwtbootstrap3.client.ui"

[...]

Import: The application compiles and runs fine. So I just want to suppress those error messages (show in error) as they are not really error messages. :-)

These resources might be helpful:

HHeckner
  • 4,722
  • 4
  • 23
  • 33

3 Answers3

3

You can disable this validation by unchecking the box at Eclipse -> Preferences -> Language Servers -> XML.

johnthuss
  • 2,732
  • 2
  • 16
  • 7
3

I had the same problem (Eclipse 2020-06).

Disabling XML Language Server for XML content type worked for me:

enter image description here

Adam
  • 5,403
  • 6
  • 31
  • 38
  • Worked for me. Thanks. But I would love if you would explain a little bit about this 'Language Server'. I have no idea how it relates to the validation of xml. Just disabling the xml validation has no effect in relation to this error. – Heri Jan 05 '21 at 14:09
  • Worked after a restart of Eclipse. – Craigo Aug 07 '21 at 04:03
0

By "must be declared", it means declared in a Document Type Definition (DTD) or XML Schema, also known as "grammar".

The line you quoted:

xmlns:b="urn:import:org.gwtbootstrap3.client.ui"

It says there's a namespace "b", but this line has no other meaning. It doesn't, for instance, declare which elements (like Alert) are valid in that namespace.

If you are not worried about validating your XML, and only wish to turn off the error messages, I would suggest you change your options:

No grammar specified: Warning → Ignore

This will stop Eclipse trying to validate the XML against a grammar, but should still show errors for malformed XML (tags closed twice etc.). You can configure this option on a per-project basis, if you prefer.

The alternative would be to provide a DTD or Schema and reference it in the XML. You will probably have to write such a grammar yourself unless gwtbootstrap3 provides one (which I don't think it does).

To clear existing validation errors, you may have to manually delete them.

ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66