問題

最近、Eclipse IDEにAptanaプラグインをインストールしました。その後、Struts 2 xmlファイルで ”

ctrl space

“を押すと、コンテンツアシストはもう機能しません。写真を見る:


dtdが動作していない、title = "dtd-not-working-eclipse-editor"

コンテンツアシストはStruts 2の要素を示唆していません.Struts 2のdtdもxmlファイルの先頭に正しく含まれています。

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
...

Solution

After many tries and errors, i found out this is caused by the Apatana
XML editior. When you double clicks on the xml file,

Eclipse will
always use back the last used xml editor to open it

, in this case, it
is Apatana XML editor (the content assist is not working in this
editor).

The solution is quite simple, just use the normal Eclipse’s XML editor
to open the xml file.

Right on the xml file, and choose the normal XML
editor

. Done, See picture :


dtd working

Now, the content assist is working properly.