开发者

Netbeans (PHP) catching syntax error on xml declaration

I've just installed and configured Netbeans to work with PHP (including xdebug), and almost everything is working as intended, except that I've been getting "errors" in the IDE after I edited the default webpage template to comply with xhtml 1.1. The template is this:

<?xml version="1.0" encoding="${project.encoding}" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>
  <body>
  </body>
</html>

These are the errors I receive (I can't post images yet).

Page is created OK, character encoding is inherited from project's settings as expected. It's probably something to do with the xml declaration on top of the document, but I don't really know how to "tune" Netbeans to ignore it and not show the 3 errors on every page I create.

The warning is there because NB does not recognize the xhtml 1.1 DTD, so it falls back to html 4.01, which does not support the xmlns attribute in the html tag - and that's the only thing I could find searching around. It will be fixed in the next version, so I'm not worried about it.

I know there's nothing wrong with the markup, but there's probably something I'm missing in NB configuration, and I would like to get rid of those messages because they 开发者_开发百科pretty much take all the space I reserve for errors/warnings/tasks.

So is there any way I can either make NB recognize this xml declaration or make it ignore these specific "errors"?

Thanks.


Turns out it's a IDE/debugger issue: while short_open_tag was set off in my configuration, the project settings in NB, by default, analyzes your code as if you had short_open_tag set to on.

After turning it off in project settings, the errors were gone. Got my answer at Netbeans mailing list. Maybe this is useful for someone out there.


On the left where the line numbers are, left click on the warning/error and see if netbeans allow you to ignore them for the current file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜