Generate valid XHTML

A

Anna

Hi all.
I have probably a rather stupid question.
If there is an HTML document, XML-formed using JTidy,
is there any tool to convert it to valid XHTML?
I.e. so that all the tags and attribute values will be XHTML compliant.
For example, if the original document has following snippet:
<p><div>text</div></p> (which is not valid XHTML), the output
would be something like <p><span>text</span></p> (which is valid XHTML).

Thank you very much for help.

Anna
 
B

Bjoern Hoehrmann

* Anna wrote in comp.text.xml:
If there is an HTML document, XML-formed using JTidy,
is there any tool to convert it to valid XHTML?
I.e. so that all the tags and attribute values will be XHTML compliant.
For example, if the original document has following snippet:
<p><div>text</div></p> (which is not valid XHTML), the output
would be something like <p><span>text</span></p> (which is valid XHTML).

Well, I am not that familiar with JTidy, but Tidy attempts to do that to
some extend. Current Tidy would turn that fragment into

<div>text</div>
<br />
<br />

which is bad but valid. If you specify the --drop-proprietary-attributes
config option, it would even drop all non-W3C attributes from all
elements, Tidy even tries to convert some known proprietary elements to
other elements, CSS, characters, ... whatever might fit. In fact, if the
result with --drop-proprietary-attributes enabled is not valid, it is
probably a bug and should be reported (this does not apply to invalid
attribute values for valid attributes, Tidy fixes some, but quite a
number cannot be fixed, just dropped, but there is currently no config
option to do that.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top