This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 193284 - HTML validation too strict
Summary: HTML validation too strict
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 7.0
Hardware: PC Windows Vista
: P2 normal (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-12 04:33 UTC by bht
Modified: 2010-12-29 09:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2010-12-12 04:33:05 UTC
Since 7.0, HTML validation is too strict for me. I don't know how to get it right.

In a page such as the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  </head>
  <body>
    <h1>Title</h1>
    <a wicket:id="address">Address</a><br/>
  </body>
</html>


I get 3 warnings in the editor:

Warning: Skipping entity: [dtd] at line 2 column 63
Error: Bad value: Content-Type for attribute "http-equiv" on XHTML element "meta" at line 6 column 62
Fatal Error: Undeclared attribute prefix in wicket:id at line 11 column 23


How can I adapt to the new NetBeans version to avoid these errors while still getting HTML errors highlighted. I need the wicket:id and other attributes - these are essential for server side processing.
Comment 1 Marek Fukala 2010-12-13 12:26:20 UTC
1) there has been some fixes to that area recently so now If co fix the code so it properly declares the wicket namespace:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
  <head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  </head>
  <body>
    <h1>Title</h1>
    <a wicket:id="address">Address</a><br/>
  </body>
</html>

I got only one error: Attribute "id" from namespace http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd is not allowed on XHTML element "a" at this point.

I'll try to find some solution for you...
Comment 2 Marek Fukala 2010-12-13 14:58:04 UTC
fixed in web-main#30ba9c1b1e7a

You need to properly declared the namespace however so add xmlns:wicket="something" into the root tag in your files.

The question is whether the namespaces filtering should be configurable via editor hints. Since I tend to think in most of the cases users wouldn't want their foreign content to cause validation errors I made it hardcoded. But I am open to every idea and opinion...
Comment 3 Quality Engineering 2010-12-14 06:13:46 UTC
Integrated into 'main-golden', will be available in build *201012140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/30ba9c1b1e7a
User: Marek Fukala <mfukala@netbeans.org>
Log: #193284 - HTML validation too strict
Comment 4 bht 2010-12-29 09:05:39 UTC
With the new behavior, the error is gone. Many thanks.
My apologies - I don't underatand the warning on the line:
<a wicket:id="address">Address</a><br/>
"Warning; Content is being hidden from the validator due to namespace filtering
at line 10 column 27 where 17 is the ">" from the div start tag.
How does the name space of an attribute affect the content of the tag?
Comment 5 Marek Fukala 2010-12-29 09:23:28 UTC
It's just a bit confusing message because it's not clear to what area it exactly belongs.  In case of attributes the only attribute from the ignored namespace is ignored, the content of the tag is validated normally.
Comment 6 Marek Fukala 2010-12-29 09:30:45 UTC
Please note I've filled Bug 193904 - html validation error annotations not always points to correct location in the code