wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes DTD and validation - RSS 0.91 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "DTD and validation - RSS 0.91" Watch "DTD and validation - RSS 0.91" New topic
Author

DTD and validation - RSS 0.91

Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
The RSS 0.91 spec at
http://my.netscape.com/publish/formats/rss-spec-0.91.html
says that a <channel> is required to have <description>,
<language>, <link>, and <title> sub-elements, along with a
list of optional sub-elements.
The accompanying DTD expresses this constraint as follows:

which also appears to impose the additional requirements that the required
sub-elements appear exactly once, that at least one
<item> is present,
and that the other optional sub-elements appear no more than once.
Despite this, the following document validates successfully, with both "java sax.Counter -v"
and "java Validate":

even though it has two <language> tags, no <description> tag,
no <link>, no <title>, and no <item>s.
Is there a bug in the validator, or does the DTD not properly express the
requirement laid out in the specification?
[ October 02, 2002: Message edited by: Ron Newman ]

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1176
In order to verify that the "java sax.Counter -v" works, please test it with the following xml file -

My "java sax.Counter -v" gave the following output -
[Error] rss.xml:13:11: The content of element type "channel" must match "(language)".
C:\xml\rss.xml: 141 ms (4 elems, 1 attrs, 15 spaces, 13 chars)
Cheers,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Same here.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1176
Ron,
All is fine.
Please look at the * at the end of the element definition.

So channel can have any number of language/title/description ... elements.
Go figure why they didn't use a simpler definition like -

Cheers,
Dan
[ October 03, 2002: Message edited by: Dan Drillich ]
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
So are you saying that the DTD is incorrect, that it doesn't conform to the textual specification of this file format?
If I wanted to rewrite this part of the DTD to match the spec, how would I do so?
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1176
What I'm trying to say is that your understanding of the content model of the channel element is not correct. It is a very open model.
For example, all the following XML segments will be considered valid against this model.
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
But my understanding of the content model comes from the spec at http://my.netscape.com/publish/formats/rss-spec-0.91.html . Look under <channel>, and you'll see that four sub-elements are listed as required: description, language, link, and title.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1176
All that matters here is the content model of channel, which says that you can have -
Either title or description or link or language etc.
All the above can be present _any_ number of times, which means that two language elements in succession are valid.
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
So why does the DTD not match the textual specification that it is derived from? How could I change it to match?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DTD and validation - RSS 0.91