Simple validation question.

Questions about XML that are not covered by the other forums should go here.
adam
Posts: 2
Joined: Sat Nov 03, 2018 3:39 am

Simple validation question.

Post 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.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Simple validation question.

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
adam
Posts: 2
Joined: Sat Nov 03, 2018 3:39 am

Re: Simple validation question.

Post by adam »

That confirms exactly what I had down, thanks so much!
Post Reply