XML(DTD): How can I make sure one of the children of an element is required, but not necessarily a specific one?



I have:


< !ELEMENT name (firstname*, surname*, companyname*)>


in my DTD file, where if the name type='person' in the xml, then it requires the firstname and surname elements, or if the name type='company', it requires the companyname element. How can I show this in my dtd?


Also later one I have a similar problem where I have:


< !ELEMENT telephone (home*, work*, mobile*, fax*, phone*)>


where if it's a person it needs at least one of home, work, mobile; and if it's a company it needs phone.


No comments:

Post a Comment