欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

eclipse <header> is not recognized How to let Eclipse accept the canvas tag?

shiping1 的头像
Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I installed the Aptana plugin in my Eclipse, and I use canvas tag in my html file. I find that the Eclipse can't recognize the canvas tag, it highlight my canvas tags, and display follow msg:

< canvas > is not recognized

How can I fix this problem? thx in advance.

share|improve this question
 
4 
It would be better to make the question more generic: how can I change Eclipse to make it accept HTML5 tags. –  sorin Jul 9 '10 at 11:24
add comment

This is most likely coming from the Tidy HTML validator packaged with Aptana's version of Eclipse. If you open the preferences for your HTML browser within Aptana, you can add a regular expression to filter the validation errors.

This can be done by going to the Window > Preferences dialog window. Then, expand Aptana > HTML and select 'Validation'.

The filter would probably look like this:

.*<canvas> is not recognized.*

share|improve this answer
 
   
I'm using Aptana Studio 3 (beta) and I was not able to find your option. Any idea? –  sorin Jul 9 '10 at 11:27
   
@sorin -- malaxuer meant Aptana > Editors > HTML > Validation. pasting the recommended filter text into a new filter in the 'Filter for Validation View Errors' eliminated the <canvas> complaint for me. –  ericsoco Jun 19 '11 at 0:24 
add comment

The specific rule under the Aptana>Editors>HTML>Validation filter is

.*<\s*canvas\s*> is not recognized.*

Doing something more generic like .* is not recognized.* lets any Bad Tag in

share|improve this answer
 add comment

The answer, in clear terms, is to go to the HTML>Validation view under preferences as Malaxeur said (for Aptana2 on OSX it was Aptana Studio>Preferences, then Aptana>Editors>HTML>Validation), and createa new rule that resembles the following.

.* is not recognized.*

that's what worked for me. how or why it works, i can't explain.

share|improve this answer
 add comment

The error will disappear if using the HTML5 doctype and a more recent version of Eclipse. I'm running Eclipse IDE for Java EE Developers (Build id: 20110218-0911) and do not have this issue.

share|improve this answer
 
   
This doesn't seem to be true, JTidy still complains –  Gabe Jul 22 '11 at 17:37
1 
@Gabe In that case it sounds like JTidy isn't respecting the default validation mechanisms provided by Eclipse. Have they corrected this issue yet? –  Josh H Nov 10 '11 at 0:22
add comment

I think it's already fixed in the current Aptana 3 beta. But in Aptana 2 it's still a problem. To allow not all, but multiple HTML5 Tags you could do it with a filter rule like that:

<(nav|header|section|article|canvas)> is not recognized.

Of course there are some more tags to consider. Just add the ones you need.

share|improve this answer
 add comment

Your Answer

 

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged     or ask your own question.



来自 http://stackoverflow.com/questions/1216762/how-to-let-eclipse-accept-the-canvas-tag/1427150
普通分类: