HTML to XHTML Converter

Related Tags:

  1.   <? Php 
  2.   If (! Empty ($ type)) ( 
  3.   If ($ type == "path") ( 
  4.   If (! Empty ($ path)) ( 
  5.   If (file_exists ($ path) & & is_file ($ path)) ( 
  6.   $ File = file ($ path); 
  7.   If (substr ($ file [0], 0,9)! = "<! DOCTYPE") $ doctype = 0; 
  8.   $ File = join ('', $ file); 
  9.   Else () 
  10.   Die ( "No such file."); 
  11.   ) 
  12.   Else () 
  13.   Die ( "No file specified."); 
  14.   ) 
  15.   ) Elseif ($ type == "file") ( 
  16.   If (! Empty ($ file)) ( 
  17.   Else () 
  18.   Die ( "No file specified."); 
  19.   ) 
  20.   Else () 
  21.   Die ( "No file specified."); 
  22.   ) 
  23.   # Specify html file, check for doctype 
  24.   / / $ File = file ( "file.html"); 
  25.   / / If (substr ($ file [0], 0,9)! = "<! DOCTYPE") $ doctype = 1; 
  26.   / / $ File = join ('', $ file); 
  27.   # Make tags and properties lower case, close empty elements, quote all properties 
  28.   $ Search = array ("'(< \ /?) (\ W +)([^>]*>)' e " 
  29.   " '(<\ /?) (Br | input | meta | link | img )([^>]*)( /")' ie, " 
  30.   " '(<\ /?) (Br | input | meta | link | img )([^>]*)(/>)' ie" 
  31.   " '(<\ /?) (Br | input | meta | link | img )([^>]*)(>)' ie" 
  32.   " '(\ W + =) (\ w +)' ie," 
  33.   " '(\ W +=)(.+?)' ie"); 
  34.   $ Replace = array ( " '\ Ι'. Strtolower ( '\ Κ'). '\ Λ'" 
  35.   " '\ Ι \ Κ \ Λ>'" 
  36.   " '\ Ι \ Κ \ Λ>'" 
  37.   " '\ Ι \ Κ \ Λ / \ Μ'" 
  38.   "Strtolower ( '\ Ι'). '\" \ Κ \ "'" 
  39.   "Strtolower ( '\ Ι'). '\ Κ'"); 
  40.   $ File = preg_replace ($ search, $ replace, $ file); 
  41.   # Return xhtml-compliant document 
  42.   Echo "<textarea cols=\"100\" rows=\"20\">"; 
  43.   If (isset ($ doctype)) echo '<DOCTYPE html PUBLIC "- / / w3c / / DTD XHTML 1.0 Transitional / / EN" "DTD/xhtml1-transitional.dtd ">'." \ n"; 
  44.   Echo stripslashes (stripslashes (stripslashes ($ file))); 
  45.   Echo "</ textarea>"; 
  46.   Else () 
  47.   --> 
  48.   <DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Transitional / / EN" "DTD/xhtml1-transitional.dtd"> 
  49.   <head> <title> HTML -> XHTML Convertor </ title> </ head> 
  50. <body>
  51.   <! - WARNING: this input method is a security risk on open servers //--> 
  52.   <Form action ="<?=$ PHP_SELF?> "Method =" get "> 
  53.   <input Type="hidden" name="type" value="path" /> 
  54.   <font Face="verdana"> File path: </ font> <input type="text" name="path" size="50" /> 
  55.   <input Type="submit" value="Submit" /> 
  56.   </ Form> 
  57.   <b> <font Face="verdana"> OR </ font> </ b> <br /> <br /> 
  58.   <Form action ="<?=$ PHP_SELF?> "Method =" get "> 
  59.   <input Type="hidden" name="type" value="file" /> 
  60.   <font Face="verdana"> File contents: </ font> <br /> 
  61.   <textarea Name="file" rows="10" cols="50"> </ textarea> <br /> 
  62.   <input Type="submit" value="Submit" /> 
  63.   </ Form> 
  64.   </ Body> 
  65.   </ Html> 
  66. <?
  67.   ) 
  68.   --> 



Related articles:

National IP Address Allocation Table (c)
  Col.com.cn, the network industry - Shenzhen, Shenzhen, Guangdong, CN, 203.208.0 .*    Col.com.cn, the network industry - Shenzhen, Shenzhen, Guangdong, CN, 203.208.1 .*    Col.com.cn, the network industry - Shenzhen, Shenzhen, Guangdong, CN, 203.208.2 .*    Cq...
Dr. founder of the Chinese overseas debt repayments blog site
  "Debt repayments on television" to help run the United States debt collection follow-up to Chinese enterprises    Had opened "the United States and debt repayments on network television," the famous Dr. Liuhaishan the United States and there have been new actio...
HTML achieve automatic typesetting rules 2
  Rule 5: the check box, radio button labelled with their separation    Unit will be in the box, radio button with the label controls separation, which can guarantee that when the text change for a long time to correct.    There is a need to design the dialog box, try to ma...
Css Guide: CSS syntax (CSS Syntax)
  CSS Syntax:    CSS syntax    The CSS syntax is made up of three parts: a selector, a property and a value:    CSS syntax consists of three parts: a choice, and a value of an attribute:    Example Source Code [CSS tutorial] selector (property: value)...
CSS vs. Tables [E text]
  About CSS is to control the layout of Web pages to replace the original Table controlled manner, E, it is difficult understood, huh, but the necessary research, and not on how to achieve.    There are many links in the reference cited article, perhaps some clues can be found. ...