W3C home > Mailing lists > Public > www-html-editor@w3.org > April to June 2000

Possible Error in XHTML1.0

From: Simon Freytag <sjf34@cam.ac.uk>
Date: Fri, 26 May 2000 13:05:01 +0100
Message-ID: <004001bfc70a$9ea0c540$76c66f83@kings.cam.ac.uk>
To: <www-html-editor@w3.org>
Hi,

I believe I may have discovered an error in XHTML1.0. I am, however,
reasonably new to XML and to XHTML in particular so allow me to apologise in
advance if this mail is incorrect and I failed to read the correct
documentation / specification / etc!

---

Firstly, some background. For my final year dissertation I undertook a
project based on XML. Part of this project involved building a small Java
application that parsed an XML document using IBMs XML4J parser. A rendering
of the DOM tree was returned as a Swing component and the errors found by
the parser (the validating parser com.ibm.xml.parsers.DOMParser was used)
were reported to a panel in the application.

---

I am currently about to undertake a new web development project and, given
my recent experience with XML, I decided to specify that all HTML pages
output from the application I will be developing will conform to the Strict
XHTML 1.0 specification [1].

To facilitate my development of the project I decided to use the application
I built for the dissertation to parse the documents I constructed to check
them for their well formed and valid properties. The first simple XHTML
document I built to begin to learn how to do this process is attached to
this mail as testpage.html

I passed this document to my parsing application and the following errors
were returned:

[Warning] at line number, 315: Attribute "xml:space" must be declared as the
enumerated type with allowed values "(default|preserve)".
[Warning] at line number, 325: Attribute "xml:space" must be declared as the
enumerated type with allowed values "(default|preserve)".
[Warning] at line number, 456: Attribute "xml:space" must be declared as the
enumerated type with allowed values "(default|preserve)".

Lines 315, 325 and 456 of the DTD I was using in testpage.html [2] are all
the same and read:

xml:space   (preserve)     #FIXED 'preserve'

I understand this to be a reference to the XML1.0 specification. I looked
this up [3] and in section 2.10 it states that "where declared, it must be
given an enumerated type whose only possible values are 'default' and
'preserve' ". The example given is:

<!ATTLIST poem   xml:space (default|preserve) 'preserve'>

Now, lines 315, 325 and 456 are referring to the <style> <script> and <pre>
ELEMENTs. For these elements I can see it is necessary for whitespace to be
preserved which is why I think the attribute xml:space has been set to
#FIXED 'preserve' for them.

This can be achieved by using an enumeration in line with the XML1.0
specification. For example,

<!ATTLIST pre %attrs; xml:space (default|preserve) 'preserve'>

will mean that <pre> may or may not have an xml:space attribute. If it does,
it may be either "default" or preserve" and I would say it is the document
author's own responsibility if s/he wishes to set a <pre> to <pre
xml:space="default"> and remove the preserved white space! If it doesn't, as
is most likely, the default will be the desired 'preserve' value.

---

I hope I have explained myself clearly, please get in touch if not.
Similalry if I have missed the point, or this is a bug long since spotted,
or if it is a new bug, I would be most interested in hearing the details.

Thanks for your time,

Simon

Simon Freytag (Computer Science Tripos)
King's College
Cambridge
UK

---

[1] http://www.w3.org/TR/xhtml1/
[2] http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
[3] http://www.w3.org/TR/1998/REC-xml-19980210



Received on Friday, 26 May 2000 08:04:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:46 GMT