Solved

Error in PHP when validating W3C

Posted on 2014-09-19
10
704 Views
Last Modified: 2014-09-19
I am running validation on one of my new PHP pages.

This is the line:

<?php require_once( "../../webassist/security_assist/helper_php.php" ); ?>

This is the error:

Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)
0
Comment
Question by:amucinobluedot
10 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 333 total points
Comment Utility
That means that your PHP script is not getting parsed through the PHP parser.  Do you have the correct file suffix?  You can check some of this with a little script like this one, shown here in its entirety.

<?php phpinfo();

Open in new window

0
 

Author Comment

by:amucinobluedot
Comment Utility
Yes. the file is:  default.php and it displays just fine.

I get those errors when I run the Validation in Dreamweaver

Your script shows a page with all PHP info
0
 
LVL 11

Assisted Solution

by:Radek Baranowski
Radek Baranowski earned 167 total points
Comment Utility
maybe you need to set expilictly that the file is of php type.

but best try to run this file in a browser within working PHP container (server) to see if the code works.

if it works, then probably this is only Dreamweaver validation issue.
0
 

Author Comment

by:amucinobluedot
Comment Utility
The page works just fine, its only when I run DW validation that displays those errors.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 333 total points
Comment Utility
Dreamweaver was a good tool for building simple web sites many years ago, but nobody does that any more.  Today we use things like the Laravel framework instead.  And you can feed your finished script directly to the validator -- you do not need (and probably do not want) the interference of Dreamweaver.
http://validator.w3.org/
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:amucinobluedot
Comment Utility
Well .. I am using DW because I have been using it for years and I currently have some great extensions (DMXZone) and (Webassist) which help me code fast. So for now I will stick to it and about the errors I will simply ignore the DW hints  :)   Plus I can't validate a page that is inside an intranet I don't think.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Don't know about your intranet, but you can probably copy the HTML and paste it into a public-facing document then fire up the validator.  I often do that just to make sure I'm on track and not doing something like accidentally duplicating ID attributes.
0
 

Author Comment

by:amucinobluedot
Comment Utility
:)
0
 
LVL 70

Expert Comment

by:Jason C. Levine
Comment Utility
I get those errors when I run the Validation in Dreamweaver

Don't do it that way.  DW can't parse PHP at all, so what it does is transfer the entire page markup (minus things like Template or Library code) to W3.  So all PHP code gets treated like HTML.

Always, always make W3 look at RENDERED code.  That means giving it a working web link.  Use Firebug and a browser to make this fast and easy.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Firebug and a browser
Google Chrome Dev Tools are pretty good, too.
http://discover-devtools.codeschool.com/
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
echo button 13 45
Printing unique/distinct values PHP, MSSQL, Codeigniter 58 89
Angular JS form 8 24
resizeing PHP image 2 21
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now