Page 1 of 1

Simple validation question.

Posted: Sat Nov 03, 2018 3:44 am
by adam
Hi I'm new to this forum and know this is probably really simple, but I cant work out how to make this code a valid XML document.
Any help would be greatly appreciated.

<?xml version=”1.0” encoding=”UTF-8”?>
<!DOCTYPE eMail [
<!ELEMENT eMail (to+, from+, topic?, message*)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT topic (#PCDATA)>
<!ELEMENT message (#PCDATA)>
<!ATTLIST message urgency (high|low) #REQUIRED”> ]>

<!—
XML code will go here (comment tags will be removed)
-->

Write the shortest possible fragment of XML code that would make the code in the box above into a valid XML document.

Re: Simple validation question.

Posted: Sun Nov 04, 2018 8:42 am
by Radu
Hi,

The shortest XML code should be something like:

Code: Select all


<eMail>
<to></to>
<from></from>
</eMail>
because all other elements inside "eMail" seem to be optional, "?" means 0 or 1, * means 0 or more but + means 1 ore more.

Regards,
Radu

Re: Simple validation question.

Posted: Sun Nov 04, 2018 9:46 am
by adam
That confirms exactly what I had down, thanks so much!