|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Auto-converting HTML to XHTML
Hi,
Im currently building some software that will allow HTML to be automatically converted to XHTML and then display either the code alone or the actual page to the user. The process would be: User inputs HTML, HTML is then taken, stored in a buffer and converted to XHTML. However, Im rather stuck as to how I will actually complete the process. Or what is the best method available to complete this project? I was recommended PHP and using the search and replacewith functions. This would obviously replace the HTML tags with XHTML tags. Is this the best option though? Or is there an easier way? Any help would be greaty appreciated, cheers |
|
#2
|
|||
|
|||
|
First of all, what you are planning sounds great, but it will take a lot more than just replacing tags or tag names.
XHTML is not only <strong> instead of <b> (and so...), it must be well-formed, and make use of some directives, like DOCTYPE encoding, language, etc... So, you can't just find-and-replace, you need to parse the document, detect unclosed tags and close them, look for incorrectly nested blocks and fix them, identify character usage and state an appropiate encoding... and so on. You might find this page useful... http://www22.brinkster.com/beeandnee/techzone/articles/htmltoxhtml.asp ![]()
__________________
The deal is not to know everything, but to know the email of the one who does. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Auto-converting HTML to XHTML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|