When you validate the XML against the given DTD schema, you will find that the document is invalid.
This is because the rules for defining some elements and attributes are
missing.
Examine the error messages, and try to identify what information and structure
in the XML document is not specified in the document type definition.
To validate the XML document, you will need to add DTD rules to describe the following structure.
Add a rule specifying the
nameelement, whose contents
should be character data.
Modify the rule for the
menuitemelement, so that its
contents begins with a
nameelement.
Add a rule specifying the
itemelement, which should be an
empty element.
Add a rule specifying the
ingredientselement; its contents
should be zero or more occurrences of the
itemelement.
Modify the rule for the
menuelement, so that its contents
requires an
ingredientselement, before zero or more
occurrences of the
serviceelement.
Modify the rule specifying the attributes of the
itemelement, to add the
idattribute; this should be of type
ID, and it is required.
Add a rule specifying that the
serviceelement should have
an attribute called
name; its value must be one of
breakfast, lunch, or dinnerand
it is a required attribute.
Lastly, write a rule specifying the
refand
amount attributes of the ingredientelement.
The
refattribute is required, and it should be of type
IDREF: this means that the value of this attribute must
refer to the value of an
IDtype attribute somewhere in the
XML document.
The value of the
amountattribute is allowed to be an
arbitrary string, and it should have a default value of
1.0.
Now try to validate the document again using the tool. You will find that there are two more errors. Fix these errors, by making one change in the XML code. xmllint
Once you have written all the ncessary DTD schema rules, and the XML validates, enter your final DTD schema in to the box below, or upload it as a separate file.
Comment peut-on qualifier cette activité ?
DOCTYPE declaration specifying a DTD (Document Type Definition) for an XML document whose root element name is “bibliography”?Consider the following DTD (Document Type Definition) schema.
<!ELEMENT book (title, author, price)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT price (#PCDATA)>
Which of the following XML documents is valid with respect to this schema?
Consider the following DTD (Document Type Definition) schema.
<!ELEMENT schedule (event*)> <!ELEMENT event (name, date, location)> <!ELEMENT name (#PCDATA)> <!ELEMENT location (#PCDATA)> <!ELEMENT date (#PCDATA)>
Which of the following XML documents is not valid with respect to this schema?
Consider the following DTD (Document Type Definition) schema.
<!ELEMENT employee ANY> <!ATTLIST employee department CDATA #IMPLIED>
Which of the following sentences correctly describes the meaning of the #IMPLIED in the context of this schema?
Consider the following DTD (Document Type Definition) schema rules.
<!ELEMENT title (#PCDATA)> <!ELEMENT description (#PCDATA)>
Along with these, which of the DTD schema rules below correctly defines an XML product element that must contain exactly one title element and one description element?
Consider the following DTD (Document Type Definition) schema.
<!ELEMENT order (item+)> <!ELEMENT item (#PCDATA)>
Which of the following sentences correctly describes the meaning of item+ in the context of this schema?
Fix all the syntax errors in the XML contained in the menu.xml file, and either enter the corrected XML code in the box below or upload it as a .xml file.
Describe the fifth syntax error in the XML document contained in the menu.xml file.