473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP and XML vs PHP and XHTML

The following code works just fine on my
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC
  2. "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
page, but won't work on my
Expand|Select|Wrap|Line Numbers
  1. ?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" >
page. Plus, it delivers 9 validation errors that I don't know how to handle, and one caution.
Expand|Select|Wrap|Line Numbers
  1. <div class="colmask fullpage">
  2.     <div class="col1">
  3.  
  4.         <!-- Start Content -->
  5.  
  6.         <?php
  7.         include("dbinfo.inc.php");
  8.         $query="SELECT * FROM webhosts ORDER BY progname ASC";
  9.         $result=mysql_query($query)or die(mysql_error()); 
  10.         $num=mysql_numrows($result);
  11.         $i=0;
  12.         mysql_close();
  13.         ?>
  14.  
  15.         <table>
  16.           <tr> 
  17.             <th>Host Name</th>
  18.                 <th>Established</th>
  19.                 <th>Price</th>
  20.                 <th>Disk Space</th>
  21.                 <th>Bandwidth</th>
  22.                 <th>Economy Plan Available</th>
  23.                 <th>Allows Mailing Lists</th>
  24.                 <th>Server Platform</th>
  25.                 <th>SSL Included</th>
  26.                 <th>eCommerce Ready</th>
  27.                 <th>Affiliate Program</th>
  28.           </tr>
  29.  
  30.             <?php
  31.             while ($i < $num) {
  32.             $hostname=mysql_result($result,$i,"hostname");
  33.             $url=mysql_result($result,$i,"url");
  34.             $established=mysql_result($result,$i,"established");
  35.             $price=mysql_result($result,$i,"price");
  36.             $diskspace=mysql_result($result,$i,"diskspace");
  37.             $bandwidth=mysql_result($result,$i,"bandwidth");
  38.             $econplan=mysql_result($result,$i,"econplan");
  39.             $maillists=mysql_result($result,$i,"maillists"); 
  40.             $platform=mysql_result($result,$i,"platform"); 
  41.             $ssl=mysql_result($result,$i,"ssl"); 
  42.             $ecommerce=mysql_result($result,$i,"ecommerce"); 
  43.             $affiliate=mysql_result($result,$i,"affiliate");
  44.         ?>
  45.             <tr>
  46.           <td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>
  47.                 <td><?php echo $established; ?></td>
  48.                 <td><?php echo $diskspace; ?></td>
  49.                 <td><?php echo $bandwidth; ?></td>
  50.                 <td><?php echo $econplan; ?></td>
  51.                 <td><?php echo $maillists; ?></td> 
  52.                 <td><?php echo $platform; ?></td> 
  53.                 <td><?php echo $ssl; ?></td> 
  54.                 <td><?php echo $ecommerce; ?></td> 
  55.                 <td><?php echo $affiliate; ?></td>
  56.       </tr>
  57.       <?php
  58.             ++$i;
  59.             } 
  60.             ?>
  61.         </table>
  62.  
  63.         <!-- End Content -->
  64.  
  65.   </div>
  66. </div>
The errors delivered are as follows:

Line 86, Column 20: character "<" is the first character of a delimiter but occurred as data.
<td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
This message may appear in several cases:

You tried to include the "<" character in your page: you should escape it as "&lt;"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.

Line 86, Column 20: XML Parsing Error: Unescaped '<' not allowed in attributes values.
<td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
Line 86, Column 20: XML Parsing Error: attributes construct error.
<td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
Line 86, Column 20: XML Parsing Error: Couldn't find end of Start Tag a line 86.
<td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
Line 86, Column 69: XML Parsing Error: Opening and ending tag mismatch: td line 86 and a.
…?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
Line 86, Column 74: XML Parsing Error: Opening and ending tag mismatch: tr line 85 and td.
…$url; ?>"><?php echo $hostname; ?></a></td>✉
Line 96, Column 11: XML Parsing Error: Opening and ending tag mismatch: table line 55 and tr.
</tr>✉
Line 101, Column 10: XML Parsing Error: Opening and ending tag mismatch: div line 42 and table.
</table>✉
Line 106, Column 6: XML Parsing Error: Opening and ending tag mismatch: body line 27 and div.
</div>✉
Line 168, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 3 and body.
</body>
Mar 14 '08 #1
3 2840
ronverdonk
4,258 Expert 4TB
What do you mean by XML page? What does that look like?. And what are these errors?

Ronald
Mar 15 '08 #2
Golly gee whiz Batman. I got the darned thing to validate on my own. Problem is, still no output, or at least not the output I intended.

Go to [REMOVED] to see what I mean.

To view the results of the same code on the other website (the one using xhtml transitional) go to [REMOVED]

Different database used on this second website (above).

I even tried changing the doctype of the first page to the same as the other, but still no output as desired. Could it be a CSS error? The first page is written using CSS, while the second uses the old table formatting.

Just give me a nudge in the right direction, that's all I'm asking.
Mar 15 '08 #3
Sorry about the links. Didn't read the Reply Guidelines. Was just trying to give you complete information. No offense intended.
Mar 15 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Peter Rohleder | last post by:
Hi, I have a few simple questions in order to use modularized xhtml and getting it to work. A simple example may make this obviouse: Lets say we want to create a simple xml-file to reflect...
59
by: Philipp Lenssen | last post by:
I've tested some of the new Nokia 6600 functionality. It ships with WAP2 and XHTML Support (it says). What it does is check the Doctype -- if it's not the XHTML Mobile Profile Doctype, but a...
32
by: jp29 | last post by:
My take on problems composing, serving and rendering XHTML documents/web pages: 1. Typical conscientious web authors are producing XHTML documents (Web pages) that feature valid Markup and with...
16
by: Mcginkel | last post by:
I am trying to find a way to load XHTML content in an Iframe. I use to do this in html by using the following code : var iframeObject = document.createElement("iframe");...
82
by: Buford Early | last post by:
I read this in http://annevankesteren.nl/2004/12/xhtml-notes "A common misconception is that XHTML 1.1 is the latest version of the XHTML series. And although it was released a bit more than a...
2
by: Joris Janssens | last post by:
I'm trying to write a program for validating XHTML 1.1-documents against the XHTML 1.1 DTD (which is actually the same as validating an XML-file) but I always get a "(404) Not found" error. This...
12
by: Alex D. | last post by:
How can I stop asp.net from rendering XHTML istead of HTML? My javascripts are rendering wrong because of that. It is rendering &amp; to clients instead of &. Any help? Thanks, Alejandro.
11
by: Tomek Toczyski | last post by:
What is the best way to attach a caption to an image in xhtml? I can attach a caption to a table by a "<caption>" tag but I would like to do sth similar to an image. How to do it in a natural...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.