XML DTD Validation

Hello,
I cannot validate this markup:
 
<?xml version="1.0" encoding="ISO-8859-1" ?> 
<!DOCTYPE entry [
     <!ELEMENT entry (title, author,dayname, date, bodytext)>
     <!ELEMENT date (day,month,year)>
     <!ELEMENT title (#PCDATA)> 
     <!ELEMENT author (PCDATA)> 
     <!ELEMENT dayname (#PCDATA)> 
     <!ELEMENT date (#PCDATA)> 
      <!ELEMENT body (#PCDATA)> 
     <!ELEMENT day (#PCDATA)> 
      <!ELEMENT month (#PCDATA)> 
      <!ELEMENT year (#PCDATA)> ]>

<entry>

<!-- This is an XML comment - just like an HTML comment. -->

<!--
This file shows a simple data structure, which could be used,
perhaps, for weblog entries -->

<!--
The structure has a root node called "entry".
In this example author information has been included as a child within the entry.
In this example date information has been included as a child within the entry.

In this example the date information has itself been broken down into "child" nodes for day, month and year.

Some developers prefer this style
-->
   
<title>A rainy day</title>
<author>Sandra</author>
<dayname>Thursday</dayname>

<date>
	<day>5</day>
	<month>2</month>
	<year>2004</year>
</date>
<bodytext>Today it was raining ... more ... more ... </bodytext>

</entry>

Open in new window

I tried validome.org XML DTD
and it gives me this error: "Markup declarations contained in or pointed to by document type declaration must be well-formed."

How can I fixed it? Is there any other errors? How can I validate it?
LVL 16
SSupremeAsked:
Who is Participating?
 
Geert BormansInformation ArchitectCommented:
It seems that your validator does not support Internal Declarations of the DTD

I cite:
Please note: With respect to personalized (but still XML conform) grammars, we check the document against the grammar (DTD or Schema) you pointed to within document.
Please specify an available URL to your XML DTD or Schema, so Validome can process validation.

You need to exterialise the DTD, put it at a URL and use a SYSTEM identifier in your DOCTYPE declaration
0
 
Geert BormansInformation ArchitectCommented:
The DTD is wrong

<!ELEMENT date (day,month,year)>
...
<!ELEMENT date (#PCDATA)>

you declare "date" twice (with a different definition)
In DTD all declarations are global
0
 
Geert BormansInformation ArchitectCommented:
another bug
<!ELEMENT author (PCDATA)>
should be
<!ELEMENT author (#PCDATA)>
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Geert BormansInformation ArchitectCommented:
and you forgot a declaration
<!ELEMENT bodytext (#PCDATA)>

I added the full corrected DTD

Then both DTD and instance are valid
<!ELEMENT entry (title, author,dayname, date, bodytext)>
<!ELEMENT date (day,month,year)>
<!ELEMENT title (#PCDATA)> 
<!ELEMENT author (#PCDATA)> 
<!ELEMENT dayname (#PCDATA)> 
<!ELEMENT bodytext (#PCDATA)> 
<!ELEMENT body (#PCDATA)> 
<!ELEMENT day (#PCDATA)> 
<!ELEMENT month (#PCDATA)> 
<!ELEMENT year (#PCDATA)>

Open in new window

0
 
SSupremeAuthor Commented:
Why do I still get this error? Where can I validate it myself? Thanks
 Error DTD
0
 
SSupremeAuthor Commented:
Thanks
0
 
Geert BormansInformation ArchitectCommented:
Or use a better quality tool, such as www.oxygenxml.com (paid for license)
or http://free.editix.com/download.html (pretty basic, but free for non commercial use, windows only)
0
 
Geert BormansInformation ArchitectCommented:
welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.