empty tags in XHTML serialization
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
Fix Released
|
High
|
Chris Hillery |
Bug Description
Spec sections:
http://
In SGML-based HTML 4 certain elements were permitted to omit the end tag; with the elements that followed implying closure. XML does not allow end tags to be omitted. All elements other than those declared in the DTD as EMPTY must have an end tag. Elements that are declared in the DTD as EMPTY can have an end tag or can use empty element shorthand (see Empty Elements).
http://
Empty elements must either have an end tag or the start tag must end with />. For instance, <br/> or <hr></hr>. See HTML Compatibility Guidelines for information on ways to ensure this is backward compatible with HTML 4 user agents.
http://
Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use <p> </p> and not <p />).
In other words:
There are only 10 legal XHTML empty tags. A quick search for “empty” on the XHTML 1.0 DTD returns the following list of tags that can legally use the empty element shorthand:
<area/>
<base/>
<br/>
<col/>
<hr/>
<img/>
<input/>
<link/>
<meta/>
<param/>
All the other elements must use <ELEM></ELEM>.
Related branches
- Matthias Brantner: Approve
- Chris Hillery: Approve
-
Diff: 211 lines (+58/-38)15 files modifiedChangeLog (+1/-0)
src/api/serialization/serializer.cpp (+6/-38)
test/rbkt/ExpQueryResults/zorba/serialization/html/empty-1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/serialization/html/empty-2.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/serialization/xhtml/empty-1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/serialization/xhtml/empty-2.xml.res (+1/-0)
test/rbkt/Queries/zorba/serialization/html/empty-1.spec (+1/-0)
test/rbkt/Queries/zorba/serialization/html/empty-1.xq (+14/-0)
test/rbkt/Queries/zorba/serialization/html/empty-2.spec (+1/-0)
test/rbkt/Queries/zorba/serialization/html/empty-2.xq (+4/-0)
test/rbkt/Queries/zorba/serialization/xhtml/empty-1.spec (+1/-0)
test/rbkt/Queries/zorba/serialization/xhtml/empty-1.xq (+14/-0)
test/rbkt/Queries/zorba/serialization/xhtml/empty-2.spec (+1/-0)
test/rbkt/Queries/zorba/serialization/xhtml/empty-2.xq (+4/-0)
test/rbkt/testdriver.cpp (+7/-0)
Changed in zorba: | |
milestone: | 2.2 → 2.5 |
Changed in zorba: | |
milestone: | 2.5 → none |
Changed in zorba: | |
milestone: | none → 2.7 |
Changed in zorba: | |
status: | New → Fix Committed |
Changed in zorba: | |
status: | Fix Committed → Fix Released |
I added some test cases (required a minor testdriver change) and determined Zorba is already behaving correctly.
While I was in there, I corrected the corresponding issue for HTML serialization, based on the discussion on zorba-coders in February.
https:/ /lists. inf.ethz. ch/mailman/ private/ zorba-coders/ 2012-February/ 014594. html