Cay Horstmann wrote:
> I write XHTML files with documentation for programmers, with many code
> samples in pre elements. I always want xml:space="preserve" set. Is
> there a way for me to tell XXE about my preference? (Sometimes I forget,
> and then the code is a mess when it is saved and reloaded.)
--> There is no need to manually specify xml:space="preserve" on all the
<pre> elements you create. If your XHTML document is valid, all <pre>
elements have xml:space="preserve" by default because this is specified
in the DTD.
--> I think that I have guessed the reason of *all* the problems you
have with XXE and your XHTML documents.
If, for example, I open transitional_sample.xhtml (see attachment) in XXE:
---
<?xml version="1.0" encoding="ISO-8859-1"?>
<html>
<head>
<title>Transitional XHTML</title>
</head>
<body>This document conforms to the Transitional XHTML DTD. Its body can
contain text and<br />line<br />breaks.<pre>This pre contains four lines:
Line #1.
Line #2.
Line #3.</pre></body>
</html>
---
I can reproduce *all* the problems you have.
XXE is configured to associate the XHTML *Strict* DTD to documents
having a <html> root element and no <!DOCTYPE>.
The problem is that transitional_sample.xhtml, being a XHTML
*Transitional* document is invalid according to the XHTML *Strict* DTD.
There is two, easy, solutions to your problem:
[1] Add the proper <!DOCTYPE> to your XHTML documents (using a text
editor). Example transitional_sample2.xhtml (see other attachment):
---
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Transitional XHTML</title>
</head>
<body>This document conforms to the Transitional XHTML DTD. Its body can
contain text and<br />line<br />breaks.<pre>This pre contains four lines:
Line #1.
Line #2.
Line #3.</pre></body>
</html>
---
[2] OR Slightly change the configuration of XXE. For that (quick and
dirty method):
[a] Open XXE_install_dir/addon/config/xhtml/xhtml.xxe using a text editor.
[b] Change:
---
<dtd publicId="-//W3C//DTD XHTML 1.0 Strict//EN"
systemId="dtd/xhtml1-strict.dtd" />
<!--
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
systemId="dtd/xhtml1-transitional.dtd" />
-->
---
to:
---
<!--
<dtd publicId="-//W3C//DTD XHTML 1.0 Strict//EN"
systemId="dtd/xhtml1-strict.dtd" />
-->
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
systemId="dtd/xhtml1-transitional.dtd" />
---
[c] Restart XXE et voil?!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transitional_sample.xhtml
Type: application/xhtml+xml
Size: 307 bytes
Desc: not available
Url :
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20060214/24e70187/attachment.xhtml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transitional_sample2.xhtml
Type: application/xhtml+xml
Size: 429 bytes
Desc: not available
Url :
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20060214/24e70187/attachment-0001.xhtml