Geddi
Geddi

Reputation: 23

Why is my scheme not valid? The markup declarations contained or pointed to by the document type declaration must be well-formed

This is my XML:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE system SYSTEM "system.dtd">

<system>
<items>
    <item id="1">item1</item>
</items>
<stores>
    <store id="2">
        <name>name1</name>
        <type>normal</type>
        <capacity>5</capacity>
    </store>
</stores>
<area>
    <slot id="4" name="name3" parallel="true">
        <input id="3" name="name2">
            <item></item>
        </input>
        <machine>
            <cost></cost>
            <time></time>
        </machine>
    </slot>
</area>
</system>

And this is my DTD for the XML:

<!ELEMENT system (items?,stores?,area*)>
<!ELEMENT items (item*)>
<!ELEMENT item (#PCDATA)>
<!ATTLIST item id ID #REQUIRED>
<!ELEMENT stores (store*)>
<!Element store (name,type,capacity)> // Error appears here
<!Element name (#PCDATA)>
<!Element type (#PCDATA)>
<!Element capacity (#PCDATA)>
<!ATTLIST store id ID #REQUIRED>
<!ELEMENT area (slot*)>
<!ELEMENT slot (input*,output*,(slot | ref | conveyor | generator | machine | turntable)*>
<!ELEMENT input (item+)> 
<!ELEMENT output (item+)>
<!ELEMENT item (#PCDATA)>
<!ATTLIST input id ID #REQUIRED>
<!ATTLIST input name CDATA #IMPLIED>
<!ATTLIST output id ID #REQUIRED>
<!ATTLIST output name CDATA #IMPLIED>
<!ELEMENT ref (#PCDATA)>
<!ATTLIST ref id ID #IMPLIED>
<!ELEMENT conveyor (cost*,time*)>
<!ELEMENT generator (cost*,time*)>
<!ELEMENT machine (cost*,time*)>
<!ELEMENT turntable (cost*,time*)>
<!ELEMENT cost (#PCDATA)>
<!ELEMENT time (#PCDATA)>
<!ATTLIST slot id ID #REQUIRED>
<!ATTLIST slot name CDATA #REQUIRED>
<!ATTLIST slot parallel CDATA #IMPLIED>

I did a validation and I'm getting the error you can see in the Headline at where I marked it in the code. I imagine its a simple problem, but I just can't find the mistake.

Upvotes: 0

Views: 1818

Answers (1)

Michael Kay
Michael Kay

Reputation: 163448

It's not a great diagnostic, is it?

There are two errors in your DTD: (a) ELEMENT must be upper-case throughout, (b) there's a missing ')' in the declaration of ELEMENT slot.

Upvotes: 1

Related Questions