Solved

Error in PHP when validating W3C

Posted on 2014-09-19
10
775 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 109

Accepted Solution

by:
Ray Paseur earned 333 total points
ID: 40332500
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
ID: 40332514
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
ID: 40332524
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:amucinobluedot
ID: 40332527
The page works just fine, its only when I run DW validation that displays those errors.
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 333 total points
ID: 40332541
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
 

Author Comment

by:amucinobluedot
ID: 40332551
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 109

Expert Comment

by:Ray Paseur
ID: 40332562
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
ID: 40332571
:)
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40333125
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 109

Expert Comment

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

803 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