### Referencing constraints

No. 5

#### Representing extended <memo> instances

Q:

This exercise is about representing an online messaging system's data store:

<memo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="memo.xsd"
date="2014-09-24" ❶ priority="medium" ❷>
<contacts> ❸
<entry id="10"> ❹
<commonName>Susan Sonntag</commonName>
<tel>+44332232323</tel> ❺
<email>susan23@evermail.com</email> ❻
<email>susa112@private.uk</email>
</entry>
<entry id="20">
<commonName>John Balber</commonName>
<email>balber@hatebook.com</email>
<tel>017297123232</tel>
<email>home@balber.org</email>
</entry>
<entry id="25">
<commonName>Mary Palmer</commonName>
<tel>017297123232</tel>
</entry>
</contacts>

<from contact="10"/> ❼
<to contact="20"/> ❽
<to contact="25"/>
<subject>Best whishes</subject>
<content>
<para>Have a nice trip!</para>
</memo>
 Mandatory @date attribute of appropriate type. Optional @priority attribute allowing exactly one of {low, medium, high}.  defining a list of contacts having at least one . Each  represents an individual contact having a unique @id value. Rules: An  must have at least one  or  child.  and  children may appear in arbitrary order. Hint: Watch out for the  definition. A telephone number is subject to the following restrictions: A telephone number must start either with “0” or “+”. Apart from a “+” sign at the very beginning only digits are allowed. If starting with an (international) + indicator the next character must not be zero. A “+” indicator must be followed by at least three digits (two representing the country code plus at least one “national” digit). The  element represents the memo's sender with @contact referring to an  element. A  has got exactly one sender. Likewise each  element represents a recipient. All recipients form a set (having no duplicates). Thus within a given  all @contact attribute values appearing in  elements must be unique. para elements allow for mixed content possibly containing both  and  children. An  element's formatting expectation is e.g. using bold font weight.  elements are the equivalent to the HTML  element. Hint: XSD offers a type suitable for URI strings. There must be at least one  child within .