Trouble Validating a nested list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble Validating a nested list

Tyler Smith

Hi,

I'm a beginner with HTML, and I have found the validator and the W3C
pages very helpful in getting me started. However, I am confused by the
error message I get when trying to validate the following page:

http://www3.sympatico.ca/tyler006/phdprop.html

1. Error Line 42 column 17: document type does not allow element "OL"
here; assuming missing "LI" start-tag.

 <ol class="lwrA">

2. Error Line 49 column 16: document type does not allow element "OL"
here; assuming missing "LI" start-tag.

<ol class="lwrA">

The error message suggests that my nested <ol> are not allowed, and
should be replaced by a <li>. From the context of the page this is
clearly not what I want. I can, however, pass the validation when I
remove the </li> tags immediately preceeding each nested <ol> (ie. at
line 41 or 48).

I thought that </li> tags were optional, but that good practice was to
include them so as to make my eventual conversion to XHTML smoother. In
this case the validator results indicate that they are not a good idea.
Could someone clarify this for me?

Thanks for your time, and my apologies if I've sent this to the wrong list!

Tyler


Reply | Threaded
Open this post in threaded view
|

Re: Trouble Validating a nested list

Lou King

Tyler,
Two issues:
1) Your web page was "Not Found" when I tried to look at your HTML. So I
don't know what DTD you specified. You may be able to get by with a
Deprecated nested list it you use "loose" vs "strict".

2) Look at HTML 4.01 Specification W3C Recommendation 24 December 1999,
Section 10.2 Unordered lists (UL), ordered lists (OL), and list
items (LI). Near the end of the section you will find, "List may also be
nested: DEPRECATED EXAMPLE:".  Suggest you find an other way to do what
you are trying to do.

Lou


Tyler Smith wrote:

>
> Hi,
>
> I'm a beginner with HTML, and I have found the validator and the W3C
> pages very helpful in getting me started. However, I am confused by the
> error message I get when trying to validate the following page:
>
> http://www3.sympatico.ca/tyler006/phdprop.html
>
> 1. Error Line 42 column 17: document type does not allow element "OL"
> here; assuming missing "LI" start-tag.
>
> <ol class="lwrA">
>
> 2. Error Line 49 column 16: document type does not allow element "OL"
> here; assuming missing "LI" start-tag.
>
> <ol class="lwrA">
>
> The error message suggests that my nested <ol> are not allowed, and
> should be replaced by a <li>. From the context of the page this is
> clearly not what I want. I can, however, pass the validation when I
> remove the </li> tags immediately preceeding each nested <ol> (ie. at
> line 41 or 48).
>
> I thought that </li> tags were optional, but that good practice was to
> include them so as to make my eventual conversion to XHTML smoother. In
> this case the validator results indicate that they are not a good idea.
> Could someone clarify this for me?
>
> Thanks for your time, and my apologies if I've sent this to the wrong list!
>
> Tyler
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Trouble Validating a nested list

David Dorward-3
In reply to this post by Tyler Smith

On Sat, 2005-10-29 at 20:40 -0400, Tyler Smith wrote:
> 1. Error Line 42 column 17: document type does not allow element "OL"
> here; assuming missing "LI" start-tag.

A list contains list items. Nothing else. A list can contain other
lists, but each other list must form part of a list item.

> The error message suggests that my nested <ol> are not allowed, and
> should be replaced by a <li>. From the context of the page this is
> clearly not what I want. I can, however, pass the validation when I
> remove the </li> tags immediately preceeding each nested <ol> (ie. at
> line 41 or 48).

<ul>
<li>
<ol>...</ol>
</ul>

Is the same as
<ul>
  <li>
    <ol>...</ol>
  </li>
</ul>

 
> I thought that </li> tags were optional

They are, which is why the above works.

--
David Dorward                           <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
                             -- The Greatest Show in the Galaxy

Reply | Threaded
Open this post in threaded view
|

Re: Trouble Validating a nested list

Lachlan Hunt
In reply to this post by Lou King

Lou King wrote:
> 2) Look at HTML 4.01 Specification W3C Recommendation 24 December 1999,
> Section 10.2 Unordered lists (UL), ordered lists (OL), and list
> items (LI). Near the end of the section you will find, "List may also be
> nested: DEPRECATED EXAMPLE:".  Suggest you find an other way to do what
> you are trying to do.

[ Referring to this example:
   <http://www.w3.org/TR/html401/struct/lists.html#idx-list-3> ]

The problem with that example, which isn't clear from the very
misleading prose around it, is that that the only deprecated feature in
it is the |start| attribute, which (arguably) should never have been
deprecated in the first place.

--
Lachlan Hunt
http://lachy.id.au/


Reply | Threaded
Open this post in threaded view
|

Re: Trouble Validating a nested list

Lou King

Thank you - I've read that example "hundreds" of times but never was
really happy with my understand. Now it makes sense!

Lachlan Hunt wrote:

>
> [ Referring to this example:
>   <http://www.w3.org/TR/html401/struct/lists.html#idx-list-3> ]
>
> The problem with that example, which isn't clear from the very
> misleading prose around it, is that that the only deprecated feature in
> it is the |start| attribute, which (arguably) should never have been
> deprecated in the first place.
>


Reply | Threaded
Open this post in threaded view
|

Re: Trouble Validating a nested list

Tyler Smith

Hi all,

Thanks for your suggestions. The reason you can't find my webpage is I
figured out the problem and corrected it, and in the process moved the
page to a new location:

http://www3.sympatico.ca/tyler006/phdprop/phdprop.html

I did send an updated email noting this, but it appears to have
vanished. Sorry for the confusion.

I understand now that nested lists must themselves occur within list
items for the next higher level list. This is demonstrated in the
tutorials I've been using (including Dave Raggett's at W3C), but it
isn't explicitly explained and I missed the point. I had thought the
</li> was optional because the end of line would be interpreted as
</li>. This obviously doesn't make sense now, but I'm just getting used
to the way HTML ignores white space and carriage returns.

Anyways, the page works now, and it validates, so it's off to the next
challenge.

Cheers,

Tyler