LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-07-2005, 11:00 AM   #1
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
HTML to XHTML conversion


I need tool to perform a batch conversion of around 200 HTML files into XHTML.

I understand that HTML tidy can be used for this task, and I came up with this:
Code:
tidy --wrap 99999 -c -meq --output-xhtml true file.html
For some reason, this doesn't work. In particular, it doesn't close tags that don't have end tags in HTML. I just get back pretty much what I started with, with a few blank paragraphs removed.

I've tried removing the <DOCTYPE> tag, and using various permutations of --output-xml and --as-xml, but all to no avail.

What am I doing wrong? Or can someone suggest a better utility?
 
Old 01-07-2005, 11:43 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
I tried it on some utter crap html with '-asxhtml' and it didn't provide a doctype, couldn't fix several things which the w3c validator complained about, but did use xhtml empty tags (<br />) and so on, and probably made it better. On some decent html (if I do say so myself ) it worked like a charm (according to the validator, anyway.)

Code:
tidy -asxhtml -o xttest2.htm xttest.htm
Quote:
This Page Is Valid XHTML 1.0 Transitional!
But I'm using 'HTML Tidy for Linux/x86 released on 1st June 2004' which I seem to have compiled at 2004-09-20 15:02. Don't seem to have the --output-xhtml option.
 
Old 01-10-2005, 04:03 AM   #3
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Original Poster
Rep: Reputation: 76
Thank you. It seems to be the -m flag that was confusing it; for some reason, on the port I'm using it was failing to write anything back to the file, hence I wasn't seeing its changes.

I've re-written part of the project to use temporary files and then convert those to XHTML with the right filenames, and this seems to be working now
 
Old 01-10-2005, 07:27 AM   #4
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Ah. I don't trust mass-converters messing with original files, anyway. Glad you got it working.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Numbered headings in XHTML vharishankar Programming 6 08-07-2005 01:12 AM
XHTML strict coding is good but how many browsers support it fully? vharishankar Programming 10 07-06-2005 10:28 AM
XHTML editor with clipping features and validator? tijs Linux - Software 1 08-13-2004 05:53 AM
Can someone recommend a good JavaScript/XHTML forum? davee General 4 10-03-2003 07:34 AM
do you use xhtml ? linowes General 0 01-14-2003 11:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration