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.
Extracted from the original issue 194939: I have had some more time working with the fixed build. As a consequence of the fix, some HTML errors, possibly due to the name-spaced tags are now no longer flagged as errors but as warnings. For example, if you try in the attachment "Testcase": <tr wicket:id="idRow"> <th colspan="2">ID:</td> <td colspan="2" wicket:id="id">12356</td> </tr> (the first <th> is unmatched (incorrectly matched by </td>) then there is a yellow warning icon not a red one as in version 9.1. I think we need the error flagging for the real HTML errors otherwise one cannot see that the file is invalid as a whole. I found this when I missed a </html> tag and the file was still valid. You can try this with the testcase and there is no red icon as a conseequence.
Warnings are used since most of the real word html source files simply contain them but the browsers interprets them well. Many users complained about too strict validation marking most of their "correct" files as erroneous. As for the missing </html> ... it's optional.
Thanks for splitting the original issue. With the new HTML parser I feel we are walking on a cliff - hard to get it right. I agree real HTML files contain errors and browsers ignore them in some cases. I strongly disagree with your conclusion that the HTML editor should not mark errors as errors because of the fact that such errors exist in the wild, and because some users complain. As serious developers we need meaningful validation in the editor, and NetBEans 6.9 does this for us. While most browsers tolerate HTML errors in plain pages, they use strict unforgiving parsers for HTML fed into the DOM via JavaScript (eg AJAX). The testcase is such an example - a Wicket panel. Wicket sends part of it to the browser as part of an AJAX response. The browser uses a strict HTML parser for injecting HTML into the DOM via JavaScript, a parser that simply refuses to process invalid markup. In our development process, the editor is currently our only tool that protects us from such errors. Therefore we cannot accept that an HTML editor treats a missing end tag as a warning not an error. This is even less acceptable in light of issue 197144. We have no problems whatsoever with NetBeans 6.9.
I would also add that there can be problems with mixed html and php (i dont know about other languages) for example <a href="<?php echo $href; ?>">link</a> gets flagged as an error because href cannot be empty, clear in this case it isn t (unless $href is empty, but then thats where it gets a bit blurry...) also, at one point, though possibly not in the rc, i cannot remember, it marks errors in files that dont start with <html><head> etc... a lot of partial template files that are later included into other files are like this. ideally these things wouldn't get marked as errors, but whilst they do i think it is best that files are not marked as containing errors because a lot of these are not 'real' errors...
PHP files are not HTML files, they are something else. The original issue 194939 is concerned with HTML only. This should possibly be reflected in the subject so we don't get distracted. I am concerned that malformed HTML documents, eg documents containing unmatched tags, are not currently flagged as erroneous.
fixed in web-main#081b2f1f1b46 The html validator error checks are now configurable to some extent. I plan to do much more fine grained customization options for 7.1, but the current changes should cover the problem described in the issue. There are some new hints options for HTML language in the editor options. There are three new subcategories of Html Validator category - Encoding issues, Tags matching issues and Others. You may enable/disable the particular hint or change its severity. If a hint is disabled, the tasklist should also does not show the errors from its category. The severity set in the hints options won't be reflected in the tasklist (will be implemented for 7.1). There will be a separate checkbox in "Show in tasklist" for each hint in 7.1 as well so it will be possible to have the hint enabled just for the editor and not for tasklist. It may happen that some of the error messages from the validator are not properly added to the hint category (there's no central registry of the messages in the validator so I have to do some pattern recognition on the messages text). If you find such, please report it in a new issue. Thanks.
Integrated into 'main-golden', will be available in build *201105050000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/081b2f1f1b46 User: Marek Fukala <mfukala@netbeans.org> Log: #197935 - Wrong Encoding Warning on HTML-Files - even NB7 own Templates ; #197145 - Html validator doesn't flag a file as erroneous
Thanks for adding this functionality. I tried it with IDE Dev (Build 201105050000) and enabled HTML error with tag matching by removing the body end tag. The result is an error text 'Fatal Error: the element type "body" must be terminated ...' However, the icon in the left margin is the yellow warning icon and the file is not marked as erroneous.
Created attachment 108144 [details] Options Dialog
changeset: 193606:691f29ddeba0 summary: #197145 - adding new message pattern to the TagsMatching rule I'm sorry but I warned you there might be such issues :-). I would appreciate if you possibly gather some of the uncategorized messages before reopening the bug. I'll go through the validator sources and try to categorize as much of the messages as possible later. They are simply spread in the classes w/o any reasonable declaration in the messageEmitter.error("bla bla ...") way :-(
I've went through part of the code and categorized some more messages to: <file name="org-netbeans-modules-html-editor-hints-AttributeSyntax.instance"/> <file name="org-netbeans-modules-html-editor-hints-CharacterReference.instance"/> <file name="org-netbeans-modules-html-editor-hints-Comments.instance"/> <file name="org-netbeans-modules-html-editor-hints-Doctype.instance"/> <file name="org-netbeans-modules-html-editor-hints-ForeignContent.instance"/> <file name="org-netbeans-modules-html-editor-hints-Form.instance"/> <file name="org-netbeans-modules-html-editor-hints-Ids.instance"/> <file name="org-netbeans-modules-html-editor-hints-Nesting.instance"/> <file name="org-netbeans-modules-html-editor-hints-Normalization.instance"/> <file name="org-netbeans-modules-html-editor-hints-ProcessingInstruction.instance"/> <file name="org-netbeans-modules-html-editor-hints-StrayContent.instance"/> <file name="org-netbeans-modules-html-editor-hints-Table.instance"/> <file name="org-netbeans-modules-html-editor-hints-TagSyntax.instance"/> <file name="org-netbeans-modules-html-editor-hints-UnexpectedChars.instance"/>
Integrated into 'main-golden', will be available in build *201105070000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/691f29ddeba0 User: Marek Fukala <mfukala@netbeans.org> Log: #197145 - adding new message pattern to the TagsMatching rule
Created attachment 108669 [details] New testcase A new testcase does not show any error/warning.
Bug 199104 - No error for unmatched <div> tag
verified, the problem described in first comment ("#0") works, there is red icon and there is a way to configure validator in Options